/// <summary> /// 初始化 /// </summary> /// <returns></returns> public List <SkinM> Init() { List <SkinM> listSkinMs = new List <SkinM>(6); SkinM skinM; //黄 skinM = new SkinM(); skinM.Name = "黄"; skinM.TitleColorS = new MyColour(255, 248, 247, 182); skinM.TitleColorE = new MyColour(255, 248, 247, 182); skinM.ContentColorS = new MyColour(255, 253, 253, 203); skinM.ContentColorE = new MyColour(255, 252, 249, 162); listSkinMs.Add(skinM); //红 skinM = new SkinM(); skinM.Name = "红"; skinM.TitleColorS = new MyColour(255, 241, 195, 241); skinM.TitleColorE = new MyColour(255, 241, 195, 241); skinM.ContentColorS = new MyColour(255, 245, 209, 245); skinM.ContentColorE = new MyColour(255, 235, 174, 235); listSkinMs.Add(skinM); //紫 skinM = new SkinM(); skinM.Name = "紫"; skinM.TitleColorS = new MyColour(255, 212, 205, 243); skinM.TitleColorE = new MyColour(255, 212, 205, 243); skinM.ContentColorS = new MyColour(255, 221, 217, 254); skinM.ContentColorE = new MyColour(255, 198, 184, 254); listSkinMs.Add(skinM); //蓝 skinM = new SkinM(); skinM.Name = "蓝"; skinM.TitleColorS = new MyColour(255, 201, 236, 248); skinM.TitleColorE = new MyColour(255, 201, 236, 248); skinM.ContentColorS = new MyColour(255, 215, 242, 250); skinM.ContentColorE = new MyColour(255, 184, 218, 244); listSkinMs.Add(skinM); //绿 skinM = new SkinM(); skinM.Name = "绿"; skinM.TitleColorS = new MyColour(255, 197, 247, 193); skinM.TitleColorE = new MyColour(255, 197, 247, 193); skinM.ContentColorS = new MyColour(150, 209, 254, 203); skinM.ContentColorE = new MyColour(255, 177, 232, 174); listSkinMs.Add(skinM); //白 skinM = new SkinM(); skinM.Name = "白"; skinM.TitleColorS = new MyColour(255, 245, 245, 245); skinM.TitleColorE = new MyColour(255, 245, 245, 245); skinM.ContentColorS = new MyColour(150, 254, 254, 254); skinM.ContentColorE = new MyColour(255, 235, 235, 235); listSkinMs.Add(skinM); return(listSkinMs); }
/// <summary> /// 获取皮肤 /// </summary> /// <param name="name">皮肤名称</param> /// <returns></returns> public SkinM GetSkin(string name) { List <SkinM> list = Init(); SkinM skinM = list.Find(m => m.Name == name); if (skinM == null) { skinM = GetDefault(); } return(skinM); }
/// <summary> /// 设置提醒回调函数 /// </summary> private void RemindAction() { if (Dispatcher.Thread != Thread.CurrentThread) { this.Dispatcher.Invoke(new Action(() => { WindowTopmost = true; Activate(); WindowTopmost = false; })); } else { WindowTopmost = true; Activate(); WindowTopmost = false; } SkinM oldSkinM = this.SkinM; System.Collections.Generic.List <SkinM> list = new SkinManage().Init(); foreach (SkinM m in list) { this.SkinM = m; Thread.Sleep(300); } this.SkinM = oldSkinM; if (Dispatcher.Thread != Thread.CurrentThread) { this.Dispatcher.Invoke(new Action(() => { RemindActionShowWindowMessage2(); })); } else { RemindActionShowWindowMessage2(); } }
/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window1_OnLoaded(object sender, RoutedEventArgs e) { if (File.Exists(CacheFileName)) { RichTextBoxTool.Read(RichTextBox1, CacheFileName); SetCaption(); } SkinM = new SkinManage().GetSkin(WindowSettings.BackColorName); //设置提醒 if (WindowSettings.RemindDateTime != null) { SetRemind((DateTime)WindowSettings.RemindDateTime); } //窗体效果设置 WindowsTool tool = new WindowsTool(this); tool.SetTopAutoShow(GridTitleBottom, GridTitle); tool.SetNotMax(GridTitle); tool.DragMove(GridTitle); RichTextBox1.Focus(); //Visibility = WindowSettings.NotepadState == NotepadState.Visible // ? Visibility.Visible // : Visibility.Collapsed; if (WindowSettings.Left != 0) { Left = WindowSettings.Left; } if (WindowSettings.Left != 0) { Top = WindowSettings.Top; } }
/// <summary> /// 事件--选择颜色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuItemColour_OnClick(object sender, RoutedEventArgs e) { string header = ((System.Windows.Controls.HeaderedItemsControl)sender).Tag.ToString(); SkinM = new SkinManage().GetSkin(header); }