コード例 #1
0
        /// <summary>
        /// 创建便签
        /// </summary>
        /// <param name="path">缓存路径</param>
        /// <param name="imdex"></param>
        /// <param name="oldNotepad"></param>
        public static void CreateNotepad(string path, int imdex, WindowNotepad oldNotepad)
        {
            if (WindowList.Count >= 15)
            {
                MessageBox.Show("便签数据日经达到最大值15个!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (WindowList.Exists(t => t.CacheFileName == path))
            {
                return;
            }

            WindowNotepad      window            = null;
            WindowSettingsAllM windowSettingsAll = ReadSetings();
            string             id       = Path.GetFileNameWithoutExtension(path);
            WindowSettingsM    settings = windowSettingsAll?.WindowSettingses.Find(t => t.ID == id);

            if (settings == null)
            {
                settings = GetDefaultWindowSettingsM(id);
            }

            window = new WindowNotepad(settings);
            SetTop(window, oldNotepad);
            window.Show();
            WindowList.Add(window);
            ShowWindowListCount++;
            WindowListCount++;
        }
コード例 #2
0
 /// <summary>
 /// 移除便签
 /// </summary>
 /// <param name="window"></param>
 public static void RemoveNotepad(WindowNotepad window)
 {
     if (WindowList.Contains(window))
     {
         WindowList.Remove(window);
     }
 }
コード例 #3
0
        /// <summary>
        /// 设置新窗体位置
        /// </summary>
        /// <param name="newNotepad">新窗体</param>
        /// <param name="oldNotepad">老窗体</param>
        /// <param name="isContinuous">是否连续添加</param>
        private static void SetTop(WindowNotepad newNotepad, WindowNotepad oldNotepad, bool isContinuous = false)
        {
            if (oldNotepad == null)
            {
                return;
            }

            //如果左边位置可放一个新窗体
            if (oldNotepad.Left > newNotepad.Width)
            {
                newNotepad.Left = oldNotepad.Left - newNotepad.Width - 5;
            }
            else
            {
                if (isContinuous)
                {
                    newNotepad.Top = newNotepad.Top + 30;
                }

                newNotepad.Left = oldNotepad.Left + newNotepad.Width + 5;
            }


            ContinuousCheck(newNotepad);
        }
コード例 #4
0
 /// <summary>
 /// 设置页面
 /// </summary>
 /// <param name="windowNotepad">操作页面</param>
 public WindowSet(WindowNotepad windowNotepad) : this()
 {
     WindowNotepad          = windowNotepad;
     Opacity                = windowNotepad.Opacity;
     GridTitleBottom.Height = windowNotepad.WindowSettings.TitleBottomHeight;
     TextBlock1.FontSize    = windowNotepad.TxtTitleBottom.FontSize;
     Boot = AutoBoot.GetAutoBootStatu(SystemCommon.SystemName);
 }
コード例 #5
0
 /// <summary>
 /// 位置检测 新位置是否已经有便笺
 /// </summary>
 /// <param name="newNotepad"></param>
 private static void ContinuousCheck(WindowNotepad newNotepad)
 {
     foreach (WindowNotepad notepad in WindowList)
     {
         if (!notepad.Equals(newNotepad) && notepad.Top == newNotepad.Top && notepad.Left == newNotepad.Left)
         {
             SetTop(newNotepad, notepad, true);
         }
     }
 }
コード例 #6
0
        /// <summary>
        /// 保存所有便签设置
        /// </summary>
        public static void SaveSetings(WindowNotepad windowNotepad = null)
        {
            WindowSettingsAllM windowSettingsAll = ReadSetings();

            if (windowSettingsAll == null)
            {
                windowSettingsAll = new WindowSettingsAllM();
            }
            if (windowSettingsAll.WindowSettingses == null)
            {
                windowSettingsAll.WindowSettingses = new List <WindowSettingsM>();
            }

            windowSettingsAll.SystemSetting = SystemSetting;

            List <WindowNotepad> list;

            if (windowNotepad != null)
            {
                list = WindowList.FindAll(m => m.WindowSettings.ID == windowNotepad.WindowSettings.ID);
            }
            else
            {
                list = WindowList;
            }
            foreach (WindowNotepad notepad in list)
            {
                notepad.WindowSettings.Top           = notepad.Top;
                notepad.WindowSettings.Left          = notepad.Left;
                notepad.WindowSettings.BackColorName = notepad.SkinM.Name;
                notepad.WindowSettings.Width         = notepad.Width;
                notepad.WindowSettings.Height        = notepad.Height;

                //替换为新设置
                int index = windowSettingsAll.WindowSettingses.FindIndex(t => t.ID == notepad.WindowSettings.ID);
                if (index > 0)
                {
                    windowSettingsAll.WindowSettingses.RemoveAt(index);
                }

                windowSettingsAll.WindowSettingses.Add(notepad.WindowSettings);
            }

            XMLSerializer.Serializer(windowSettingsAll);
        }
コード例 #7
0
        /// <summary>
        /// 设置便签
        /// </summary>
        /// <param name="window"></param>
        public static void SetWindowNotepad(WindowNotepad window)
        {
            WindowSettingsAllM windowSettingsAll = ReadSetings();

            if (windowSettingsAll == null)
            {
                return;
            }
            //if (_systemSetting == null && windowSettingsAll.SystemSetting != null)
            //    _systemSetting = windowSettingsAll.SystemSetting;
            WindowSettingsM settings = windowSettingsAll.WindowSettingses.Find(t => t.ID == window.WindowSettings.ID);

            if (settings != null)
            {
                window.WindowSettings = settings;
                window.SkinM          = new SkinManage().GetSkin(settings.BackColorName);
            }
        }
コード例 #8
0
        /// <summary>
        /// 创建便签
        /// </summary>
        /// <param name="path">缓存路径</param>
        /// <param name="settingses"></param>
        public static void CreateNotepad(string path, List <WindowSettingsM> settingses)
        {
            if (WindowList.Exists(t => t.CacheFileName == path))
            {
                return;
            }

            WindowNotepad window = null;

            string id = Path.GetFileNameWithoutExtension(path);

            WindowSettingsM settings = settingses.Find(t => t.ID == id);

            if (settings == null)
            {
                settings = GetDefaultWindowSettingsM(id);
            }

            window = new WindowNotepad(settings);
            window.Show();
            WindowList.Add(window);
            ShowWindowListCount++;
            WindowListCount++;
        }
コード例 #9
0
 /// <summary>
 /// 创建便签
 /// </summary>
 public static void CreateNotepad(WindowNotepad oldNotepad)
 {
     CreateNotepad(string.Empty, GetNewIndex(), oldNotepad);
 }