private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     //加载原先保存的主题配色
     if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Data\Palette\Palette.txt"))
     {
         using (StreamReader sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Data\Palette\Palette.txt", Encoding.UTF8))
         {
             string temp = sr.ReadToEnd();
             MaterialDesignThemes.Wpf.Palette obj = JObject.Parse(temp).ToObject <MaterialDesignThemes.Wpf.Palette>();
             new PaletteHelper().ReplacePalette(obj);
         }
     }
 }
        /// <summary>
        /// Replaces the entire palette
        /// </summary>
        public virtual void ReplacePalette(Palette palette)
        {
            if (palette == null) throw new ArgumentNullException(nameof(palette));

            var allHues = palette.PrimarySwatch.PrimaryHues.ToList();
            ReplacePrimaryColor(
                palette.PrimarySwatch, 
                allHues[palette.PrimaryLightHueIndex], 
                allHues[palette.PrimaryMidHueIndex],
                allHues[palette.PrimaryDarkHueIndex],
                allHues);

            var accentHue = palette.AccentSwatch.AccentHues.ElementAt(palette.AccentHueIndex);
            ReplaceEntry("SecondaryAccentBrush", new SolidColorBrush(accentHue.Color));
            ReplaceEntry("SecondaryAccentForegroundBrush", new SolidColorBrush(accentHue.Foreground));
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            WindowToolTip.Opacity = 0;

            TextBlockSoftName.Text      = SoftResources.StringResouce.SoftName;
            TextBlockSoftVersion.Text   = UserClient.CurrentVersion.ToString();
            TextBlockSoftCopyright.Text = $"本软件著作权归{CommonLibrary.SoftResources.StringResouce.SoftCopyRight}所有";


            // 上次登录为7天以前则清除账户密码
            if ((DateTime.Now - UserClient.JsonSettings.LoginTime).TotalDays < UserClient.JsonSettings.PasswordOverdueDays)
            {
                //加载数据
                NameTextBox.Text     = UserClient.JsonSettings.LoginName ?? "";
                PasswordBox.Password = UserClient.JsonSettings.Password ?? "";
                Remember.IsChecked   = UserClient.JsonSettings.Password != "";
            }

            //初始化输入焦点
            if (UserClient.JsonSettings.Password != "")
            {
                LoginButton.Focus();
            }
            else if (UserClient.JsonSettings.LoginName != "")
            {
                PasswordBox.Focus();
            }
            else
            {
                NameTextBox.Focus();
            }


            // 加载原先保存的主题配色
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"Palette.txt"))
            {
                using (StreamReader sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"Palette.txt", Encoding.UTF8))
                {
                    string temp = sr.ReadToEnd();
                    MaterialDesignThemes.Wpf.Palette obj = JObject.Parse(temp).ToObject <MaterialDesignThemes.Wpf.Palette>();
                    new PaletteHelper().ReplacePalette(obj);
                }
            }
        }