Exemple #1
0
        /// <summary>
        /// 选择主题发生改变
        /// </summary>
        /// <param name="obj"></param>
        private void SelectionChangedMethod(SelectionChangedEventArgs e)
        {
            var content = e.AddedItems[0] as string;

            ThemeAssist.ChangeTheme(content);
        }
Exemple #2
0
        /// <summary>
        /// 程序启动
        /// </summary>
        /// <param name="e"></param>
        protected override void OnStartup(StartupEventArgs e)
        {
            #region 是否只能运行一个APP

            bool ret;
            mutex = new System.Threading.Mutex(true, "StickyNotesAPP", out ret);

            if (!ret)
            {
                MessageBox.Show("程序已经运行了");
                Environment.Exit(0);
            }
            #endregion


            Logger.Log().Info("程序启动");
            /// 将全局异常保存到文件目录下
            Current.DispatcherUnhandledException       += App_OnDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            //Messenger.Default.Register<SaveMessage>(this, SaveDataMessage);
            var systemtray  = SystemTray.Instance;
            var programData = XMLHelper.DecodeXML <ProgramData>(ConstData.SaveSettingDataName);
            if (programData == null)
            {
                LanguageManager.ChangeLanguage(Language.English);
            }
            else
            {
                LanguageManager.ChangeLanguage(programData.Language);
            }

            if (programData != null)
            {
                var windowsDatas = programData.Datas;
                ProgramData.Instance.IsWindowTopMost     = programData.IsWindowTopMost;
                ProgramData.Instance.IsStartUpWithSystem = programData.IsStartUpWithSystem;
                ProgramData.Instance.CurrentTheme        = programData.CurrentTheme;
                ProgramData.Instance.ShowAllHotKey       = programData.ShowAllHotKey;
                ProgramData.Instance.IsAutoCheckUpdate   = programData.IsAutoCheckUpdate;
                ProgramData.Instance.HideWindowData      = programData.HideWindowData;
                ProgramData.Instance.Language            = programData.Language;
                ThemeAssist.ChangeTheme(programData.CurrentTheme);
                //有创建过的窗口
                if (windowsDatas.Count > 0)
                {
                    for (int i = 0; i < windowsDatas.Count; i++)
                    {
                        OpenNewWindow(windowsDatas[i]);
                    }
                }
                else//以前的窗口都被删掉了
                {
                    OpenNewWindow();
                }
            }
            //没有创建过的窗口
            else
            {
                OpenNewWindow();
            }
            IsInited  = false;
            TimerUtil = new TimerUtil(SaveDataAction);
            new Task(CheckUpdate).Start();
        }