コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public void RestoreLastPluginLoadState()
        {
            foreach (string key in this.TabPagesCatalog.Keys)
            {
                try
                {
                    IPlugin tmpPluginObj       = this.TabPagesCatalog[key].PluginObject;
                    string  currentPluginState = WinRegistry.GetValue(key, "state");

                    if (currentPluginState == null)
                    {
                        LogCons.Inst.Write(LogLevel.Info, $"RestoreLastPluginLoadState(): No former state found for plugin {key}");
                    }
                    else if (currentPluginState.ToLower() == "on")
                    {
                        LogCons.Inst.Write(LogLevel.Info, $"Minary.RestoreLastPluginLoadState(): PluginName:{key} State:on");
                        this.ActivatePlugin(key);
                    }
                    else
                    {
                        LogCons.Inst.Write(LogLevel.Info, $"Minary.RestoreLastPluginLoadState(): PluginName:{key} State:off");
                        this.DeactivatePlugin(key);
                    }
                }
                catch (Exception ex)
                {
                    LogCons.Inst.Write(LogLevel.Error, $"RestoreLastPluginLoadState(): Exception: {ex.Message}\r\n{ex.StackTrace}");
                }
            }
        }
コード例 #2
0
ファイル: MinaryMain_Main.cs プロジェクト: Minary/Minary
        public void StartBackgroundThreads()
        {
            // Start data input thread.
            try
            {
                this.inputProcessorHandler.StartInputProcessing();
            }
            catch (Exception ex)
            {
                var message = $"An error occurred while starting the input processor NamedPipe : {ex.Message}" +
                              "\r\n\r\nAborting Minary now.";
                MessageDialog.Inst.ShowError(string.Empty, message, this);
                this.ShutDownMinary();
            }

            // Check if new Minary version is available
            Task.Run(() =>
            {
                string autoupdateStateStr = WinRegistry.GetValue("Updates", "Autoupdate");
                int autoupdateState       = Convert.ToInt32(autoupdateStateStr);

                if (autoupdateState > 0)
                {
                    Updates.Presentation.FormCheckNewVersion newVersionCheck = new Updates.Presentation.FormCheckNewVersion();
                    newVersionCheck.ShowDialog();
                }
            });
        }