Exemplo n.º 1
0
        public static void Init()
        {
            try
            {
                Logger.Log.Info("RestoreTabs Init");
                UserSettingsService.RegPlugin(PluginName, CreateUserSettings, CheckUserSettings);
                UserSettingsService.ChangeSettings += UserSettingsService_ChangeSettings;

                // Добавление кнопки в статус бар
                StatusBarEx.AddPane(string.Empty, "Откытие чертежей", (p, e) => Restore(), icon: Resources.restoreFiles16);

                var isOn = UserSettingsService.GetPluginValue <bool>(PluginName, ParamRestoreIsOn);
                if (isOn)
                {
                    Logger.Log.Info("RestoreTabs включен.");
                    Subscribe();
                    var tabsData = LoadData();
                    if (tabsData.Data?.Sessions?.Any(s => s?.Drawings?.Count > 0) == true)
                    {
                        Restore();
                    }
                }
                else
                {
                    Logger.Log.Info("RestoreTabs отключен.");
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex, "RestoreTabs.Init");
            }
        }
Exemplo n.º 2
0
        private static void UserSettingsService_ChangeSettings(object sender, EventArgs e)
        {
            var isOn = UserSettingsService.GetPluginValue <bool>(PluginName, ParamRestoreIsOn);

            if (isOn)
            {
                Subscribe();
            }
            else
            {
                Unsubscribe();
            }
        }
Exemplo n.º 3
0
 public static bool GetIsOn()
 {
     return(UserSettingsService.GetPluginValue <bool>(PluginName, ParamRestoreIsOn));
 }