/// <summary> /// Создание нового ярлыка /// </summary> /// <param name="labelPath"></param> /// <param name="task"></param> /// <param name="imagePath"></param> public void CreateLabel(String labelPath, String task, String imagePath) { LabelService.CreateLabel(task, imagePath, labelPath, true, LabelService.GetLabelsCount() - 1); Labels[DesktopService.GetDesktop(DesktopIndex).LabelCount] = new LabelViewModel(LabelService.GetLabel(LabelService.GetLabelsCount() - 1), User.Login, User.Font, User.FontSize, User.FontBold, User.FontItalic, User.FontUnderline, User.FontStrikeout, User.FontColor); DesktopService.GetDesktop(DesktopIndex).LabelCount++; }
/// <summary> /// Загрузка ярлыков на текущий рабочий стол /// </summary> public void LoadLabels() { Labels.Clear(); var tmpList = LabelService.GetLabelsRange(DesktopIndex, DesktopService.GetDesktop(DesktopIndex).LabelCount); foreach (LabelModel labelModel in tmpList) { Labels.Add(new LabelViewModel(labelModel, User.Login, User.Font, User.FontSize, User.FontBold, User.FontItalic, User.FontUnderline, User.FontStrikeout, User.FontColor)); } }
/// <summary> /// Применить настройки /// </summary> public void ApplySettingsFunc() { if (DesktopChangeFlag) { for (int i = 0; i < DesktopImagePathes.Count; i++) { DesktopService.GetDesktop((short)i).WallpaperImage = DesktopImagePathes[i]; } } SettingsEvent(Login, OldLogin, LoginChangeFlag, Password, PasswordChangeFlag, DesktopImagePath, Font, FontSize, FontColor, FontBold, FontItalic, FontUnderline, FontChangeFlag); }
private void LabelService_SettingsEvent1() { DesktopService.GetDesktop((short)(User.DesktopCount - 1)).LabelCount--; if (DesktopService.DesktopRepositori.GetDesktop((short)(User.DesktopCount - 1)).LabelCount > 0) { if (DesktopIndex == User.DesktopCount - 1) { LoadLabels(); LoadNoneLabel(); } else { LoadLabels(); } } else if (DesktopService.DesktopRepositori.GetDesktop((short)(User.DesktopCount - 1)).LabelCount == 0) { if (DesktopIndex == User.DesktopCount - 1) { LoadLabels(); LoadNoneLabel(); } else { LoadLabels(); } } else { DesktopService.DeleteLastDesktop(); User.DesktopCount--; DesktopService.GetDesktop((short)(User.DesktopCount - 1)).LabelCount--; if (DesktopIndex > User.DesktopCount - 1) { DesktopIndex--; RightButtonFlag = false; LoadLabels(); LoadNoneLabel(); } else if (DesktopIndex == User.DesktopCount - 1) { RightButtonFlag = false; LoadLabels(); LoadNoneLabel(); } else { LoadLabels(); } } }
/// <summary> /// Отменить настройки /// </summary> public void CancelSettingsFunc() { if (ChangeFlag) { if (DesktopChangeFlag) { for (int i = 0; i < DesktopImagePathes.Count; i++) { DesktopService.GetDesktop((short)i).WallpaperImage = OldDesktopImagePathes[i]; } } SettingsCencelEvent(OldLogin, Login, LoginChangeFlag, OldPassword, PasswordChangeFlag, OldDesktopImagePath, OldFont, OldFontSize, OldFontColor, OldFontBold, OldFontItalic, OldFontUnderline, FontChangeFlag); } }
/// <summary> /// Создание копии оригинальных рабочих столов /// </summary> /// <returns></returns> public ObservableCollection <Int32> SetDesktops() { var tmpCollection = new ObservableCollection <Int32>(); var tmpDesktopCollection = new ObservableCollection <String>(); var tmpArray = new String[User.DesktopCount]; for (Int32 i = 0; i < User.DesktopCount; i++) { tmpCollection.Add(i + 1); tmpDesktopCollection.Add(DesktopService.GetDesktop((short)i).WallpaperImage); tmpArray[i] = DesktopService.GetDesktop((short)i).WallpaperImage; } DesktopImagePathes = tmpDesktopCollection; OldDesktopImagePathes = tmpArray; return(tmpCollection); }
/// <summary> /// Создание нулевого ярлыка /// </summary> public void CreateNoneLabel() { if (LabelService.LabelCountTest(DesktopService.GetDesktop(DesktopIndex).LabelCount)) { LabelService.CreateLabel(false); Labels.Add(new LabelViewModel(LabelService.GetLabel(LabelService.GetLabelsCount() - 1), CreateViewModel())); } else { if (DesktopIndex == User.DesktopCount - 1) { DesktopService.CreateDesktop(); User.DesktopCount++; } DesktopIndex++; LoadLabels(); CreateNoneLabel(); LeftButtonFlag = true; } }
/// <summary> /// Изменение кнопок при переключении /// </summary> /// <param name="index"></param> /// <param name="flag"></param> public void ChangeButtons(Int16 index, Boolean flag) { if (flag) { if (index == User.DesktopCount - 1) { RightButtonFlag = false; LeftButtonFlag = true; } else { LeftButtonFlag = true; } if (DesktopService.GetDesktop(DesktopIndex).LabelCount == 0) { Labels.Clear(); LoadNoneLabel(); LoadDesktopImage(); } else { LoadLabels(); LoadNoneLabel(); LoadDesktopImage(); } } else { if (index == 0) { LeftButtonFlag = false; RightButtonFlag = true; } else { RightButtonFlag = true; } LoadLabels(); LoadDesktopImage(); } }