KellyReport_D/Ribbon1.cs

50 lines
1.3 KiB
C#
Raw Normal View History

2025-08-10 18:19:27 +08:00
using KellyReport_D.Properties;
using Microsoft.Office.Tools;
using Microsoft.Office.Tools.Ribbon;
using System;
using System.Collections.Generic;
using System.Diagnostics;
2025-08-10 18:19:27 +08:00
using System.Linq;
using System.Reflection;
2025-08-10 18:19:27 +08:00
using System.Text;
namespace KellyReport_D
{
public partial class Ribbon1
{
private CustomTaskPane jqSalesSummaryPanel;
private string GetAppVersion()
{
var asm = Assembly.GetExecutingAssembly();
try
{
var fvi = FileVersionInfo.GetVersionInfo(asm.Location);
if (!string.IsNullOrWhiteSpace(fvi.FileVersion))
return fvi.FileVersion;
}
catch { }
return asm.GetName().Version.ToString();
}
2025-08-10 18:19:27 +08:00
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
this.button1.Label = Resources.APP_NAME;
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
if (jqSalesSummaryPanel == null)
{
var panel = new JQSalesSummaryPanel();
jqSalesSummaryPanel = Globals.ThisAddIn.CustomTaskPanes.Add(panel, $"{Resources.APP_NAME} v{GetAppVersion()}");
2025-08-10 18:19:27 +08:00
jqSalesSummaryPanel.Width = 600;
}
jqSalesSummaryPanel.Visible = true;
}
}
}