protected virtual void NewTheme() { try { using (var dialog = new InputDialog( "New Theme", "Enter a name for the new theme", "<New Theme>")) { if (dialog.ShowDialog(this) != DialogResult.Cancel) { var theme = new Theme() { Id = Guid.NewGuid() }; theme.Name = dialog.Value; Themes.Add(theme); PopulateThemeList(); lstThemes.SelectedItem = theme; } } } catch (Exception ex) { ExceptionHandler("Error creating a new theme", ex); } }
/// <summary>添加主题</summary> /// <param name="theme"></param> public void AddTheme(String theme) { if (!Themes.Contains(theme)) { Themes.Add(theme); } }
public ViewModel() { SelectedEmployee = new Employee() { Name = "John Son", Age = 25, DOB = new DateTime(1995, 12, 28), Address = "New yark", Experience = 5, Gender = Gender.Male, EmployeeType = EmployeeType.Fulltime_Employee, Id = "56", MobileNo = "4556789", EmailID = "*****@*****.**" }; //Theme list added in the collection Themes.Add("Blend"); Themes.Add("Lime"); Themes.Add("MaterialDark"); Themes.Add("MaterialDarkBlue"); Themes.Add("MaterialLight"); Themes.Add("MaterialLightBlue"); Themes.Add("Metro"); Themes.Add("Office2010Black"); Themes.Add("Office2010Blue"); Themes.Add("Office2010Silver"); Themes.Add("Office2013DarkGray"); Themes.Add("Office2013LightGray"); Themes.Add("Office2013White"); Themes.Add("Office2016Colorful"); Themes.Add("Office2016DarkGray"); Themes.Add("Office2016White"); Themes.Add("Office2019Black"); Themes.Add("Office2019Colorful"); Themes.Add("Office365"); Themes.Add("Saffron"); Themes.Add("VisualStudio2013"); Themes.Add("VisualStudio2015"); selectionChangedCommand = new DelegateCommand <object>(selectionChanged); }
public void ProcessExecute() { Themes.Clear(); int nRet = Engine.PrepareText(TextToAnalyse); if (nRet == 0) { // Get themes List <SalienceTheme> myThemes = Engine.GetDocumentThemes(String.Empty); foreach (SalienceTheme aTheme in myThemes) { Themes.Add(new Theme(aTheme.sNormalizedTheme, aTheme.fScore, aTheme.nThemeType, aTheme.fSentiment, aTheme.nEvidence)); } // Get named entities List <SalienceEntity> myEntities = Engine.GetNamedEntities(String.Empty); foreach (SalienceEntity anEntity in myEntities) { NamedEntities.Add(new NamedEntity(anEntity.sNormalizedForm, anEntity.sType, anEntity.fSentimentScore, anEntity.nEvidence, anEntity.nCount)); } // Get summary SalienceSummary mySummary = Engine.GetSummary(3, String.Empty); Summary.SummaryText = mySummary.sSummary; } else { // there was an error, in which case this needs to be handled somehow } }
public ViewModel() { //Theme list added in the collection Themes.Add("Blend"); Themes.Add("Lime"); Themes.Add("MaterialDark"); Themes.Add("MaterialDarkBlue"); Themes.Add("MaterialLight"); Themes.Add("MaterialLightBlue"); Themes.Add("Metro"); Themes.Add("Office2010Black"); Themes.Add("Office2010Blue"); Themes.Add("Office2010Silver"); Themes.Add("Office2013DarkGray"); Themes.Add("Office2013LightGray"); Themes.Add("Office2013White"); Themes.Add("Office2016Colorful"); Themes.Add("Office2016DarkGray"); Themes.Add("Office2016White"); Themes.Add("Office2019Black"); Themes.Add("Office2019Colorful"); Themes.Add("Office365"); Themes.Add("Saffron"); Themes.Add("VisualStudio2013"); Themes.Add("VisualStudio2015"); selectionChangedCommand = new DelegateCommand <object>(selectionChanged); }
public async Task LoadThemesFromCacheAsync() { Themes.Clear(); StorageFolder themeFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Themes", CreationCollisionOption.OpenIfExists); IReadOnlyList <StorageFile> themeFiles = await themeFolder.GetFilesAsync(); if (themeFiles.Count == 0) { await CreateDefaultThemesAsync(themeFolder); } else { foreach (var file in themeFiles) { Debug.WriteLine(file.Name); HueTheme theme = await LoadThemeFromFile(file); if (theme != null) { Themes.Add(theme); } } } return; }
public override void OnNavigatedTo() { Debug.WriteLine($"{nameof(ThemeListViewModel)} - {nameof(OnNavigatedTo)}"); Themes.Clear(); var tmp = ThemeRepository.GetAll(); foreach (var item in tmp) { Themes.Add(item); } // Print all the values to the screen to debug //foreach (var item in AccessTokenRepository.GetAll()) //{ // Debug.WriteLine($"Access Tokens: {item.Path} - {item.AccessTokenType} | {item.AccessToken}"); //} //foreach (var item in ThemeRepository.GetAll()) //{ // Debug.WriteLine($"Theme: {item.Name}"); //} //foreach (var item in DirectoryRepository.GetAll()) //{ // Debug.WriteLine($"Directories: {item.Path}"); //} }
/// <summary> /// Initializes a new instance of the <see cref="AppearanceViewModel"/> class. /// </summary> protected AppearanceViewModel() { // add the default themes Themes.Add(new Link { DisplayName = "dark", Source = AppearanceManager.DarkThemeSource }); Themes.Add(new Link { DisplayName = "light", Source = AppearanceManager.LightThemeSource }); // add additional themes Themes.Add(new Link { DisplayName = "hello kitty", Source = new Uri("/IDE;component/Common/Views/CustomThemes/ModernUI.HelloKitty.xaml", UriKind.Relative) }); Themes.Add(new Link { DisplayName = "WE ZUT", Source = new Uri("/IDE;component/Common/Views/CustomThemes/ModernUI.WE.xaml", UriKind.Relative) }); SelectedFontSize = AppearanceManager.Current.FontSize == FontSize.Small ? FontLarge : FontSmall; SyncThemeAndColor(); AppearanceManager.Current.PropertyChanged += OnAppearanceManagerPropertyChanged; }
public ThemesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider, IThemeParserFactory themeParserFactory, IFileSystemService fileSystemService) { _settingsService = settingsService; _dialogService = dialogService; _defaultValueProvider = defaultValueProvider; _themeParserFactory = themeParserFactory; _fileSystemService = fileSystemService; CreateThemeCommand = new RelayCommand(CreateTheme); ImportThemeCommand = new RelayCommand(ImportTheme); CloneCommand = new RelayCommand <ThemeViewModel>(CloneTheme); _settingsService.TerminalOptionsChanged += OnTerminalOptionsChanged; BackgroundOpacity = _settingsService.GetTerminalOptions().BackgroundOpacity; var activeThemeId = _settingsService.GetCurrentThemeId(); foreach (var theme in _settingsService.GetThemes()) { var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService, fileSystemService); viewModel.Activated += OnThemeActivated; viewModel.Deleted += OnThemeDeleted; if (theme.Id == activeThemeId) { viewModel.IsActive = true; } Themes.Add(viewModel); } SelectedTheme = Themes.First(t => t.IsActive); }
public async Task <HueTheme> CreateThemeAsync() { var newTheme = new HueTheme(); var newIndex = Themes.Count + 1; newTheme.Name = "theme " + newIndex.ToString(); newTheme.FileName = "theme_" + newIndex.ToString(); newTheme.IsSystemTheme = false; // Add a default color newTheme.ColorList.Add(HSBColor.FromColor(Color.FromArgb(0xff, 0xec, 0xcd, 0x67))); newTheme.ColorList.Add(HSBColor.FromColor(Color.FromArgb(0xff, 0xec, 0xcd, 0x67))); newTheme.ColorList.Add(HSBColor.FromColor(Color.FromArgb(0xff, 0xec, 0xcd, 0x67))); // Add to themes Themes.Add(newTheme); await SaveThemeToFileAsync(newTheme); // Notify theme list changes if (ThemeListChanged != null) { ThemeListChanged(this, null); } return(newTheme); }
public ThemesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider) { _settingsService = settingsService; _dialogService = dialogService; _defaultValueProvider = defaultValueProvider; CreateThemeCommand = new RelayCommand(CreateTheme); var activeThemeId = _settingsService.GetCurrentThemeId(); foreach (var theme in _settingsService.GetThemes()) { var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService); viewModel.Activated += OnThemeActivated; viewModel.Deleted += OnThemeDeleted; if (theme.Id == activeThemeId) { viewModel.IsActive = true; } Themes.Add(viewModel); } SelectedTheme = Themes.First(t => t.IsActive); }
protected virtual void CopyTheme() { try { using (var dialog = new InputDialog( "Copy Theme", "Enter a name for the new theme", $"Copy of {_selectedTheme.Name}")) { if (dialog.ShowDialog(this) != DialogResult.Cancel) { var theme = new Theme() { Name = dialog.Value, Id = Guid.NewGuid() }; _currentSampleView.UpdateTheme(theme); Themes.Add(theme); PopulateThemeList(); lstThemes.SelectedItem = theme; } } } catch (Exception ex) { ExceptionHandler("Error copying theme", ex); } }
public ViewModel() { //Days added in the collection DaysCollection.Add("Sunday"); DaysCollection.Add("Monday"); DaysCollection.Add("Tuesday"); DaysCollection.Add("Wednesday"); DaysCollection.Add("Thursday"); DaysCollection.Add("Friday"); DaysCollection.Add("Saturday"); //Theme list added in the collection Themes.Add("Blend"); Themes.Add("Lime"); Themes.Add("Metro"); Themes.Add("Office2010Black"); Themes.Add("Office2010Blue"); Themes.Add("Office2010Silver"); Themes.Add("Office2013DarkGray"); Themes.Add("Office2013LightGray"); Themes.Add("Office2013White"); Themes.Add("Office2016Colorful"); Themes.Add("Office2016DarkGray"); Themes.Add("Office2016White"); Themes.Add("Office365"); Themes.Add("Saffron"); Themes.Add("VisualStudio2013"); Themes.Add("VisualStudio2015"); selectionChangedCommand = new DelegateCommand <object>(selectionChanged); }
/// <summary> /// Sets the theme. /// </summary> /// <param name="parserId">The parser identifier.</param> /// <param name="theme">The theme.</param> public virtual void SetTheme(string parserId, Theme theme) { if (!Themes.ContainsKey(parserId)) { Themes.Add(parserId, theme); } Themes[parserId] = theme; }
public void AddTheme(ThemeViewModel theme) { if (Themes != null) { Themes.Add(theme); CurrentTheme = theme; } }
public void AddNewTheme(string themeName, string templateThemeName, bool isDefault) { if (Themes.ContainsKey(themeName) == false) { Themes.Add(themeName, new Theme(themeName, templateThemeName, isDefault)); IsModified = true; } }
public MainViewModel(MainView host) { _host = host; _wizardVersion = "0.0.0.0"; _templatesVersion = "0.0.0.0"; Themes.Add("Light"); Themes.Add("Dark"); SelectedTheme = Themes.First(); }
public MainViewModel(MainView host) { _host = host; _wizardVersion = "0.0.0.0"; _templatesVersion = "0.0.0.0"; Themes.Add("Light"); Themes.Add("Dark"); SystemService = new SystemService(); }
/// <summary> /// Adds a theme to the registry /// </summary> /// <param name="theme">The theme to be added</param> /// <returns>Whether the the theme is already registered</returns> public bool AddTheme(ITheme theme) { if (Themes.Contains(theme)) { return(false); } Themes.Add(theme); return(true); }
public bool AddTheme(ITheme theme) { if (!_themeDictionary.ContainsKey(theme.Name)) { _themeDictionary.Add(theme.Name, theme); Themes.Add(theme); return(true); } return(false); }
public DictionaryBuilder AddTheme(Theme theme) { if (theme == null) { throw new ArgumentException("The theme cannot be null."); } Themes.Add(theme); return(this); }
public Page() { InitializeComponent(); DataContext = this; Themes.Add("Light"); Themes.Add("Dark"); mw = Application.Current.MainWindow as MainWindow; }
public MainWindow() { Themes.Add(Theme.DeepBlue); Themes.Add(Theme.LightGray); Themes.Add(Theme.Office2007Black); Themes.Add(Theme.Office2007Blue); Themes.Add(Theme.Office2007Silver); Themes.Add(Theme.Seven); DataContext = this; InitializeComponent(); }
public void AddTheme(ITheme theme) { if (IsThemeInCategory(theme.categorie.Themes, theme.Name)) { throw new Exception($"{theme.Name} already exist in this category {Name}!"); } else { Themes.Add(theme); } }
protected override void BeforeExecute(Workbook workbook, string[] userAgents) { if (AgentIsMac(userAgents)) { Themes themes = new Themes(); ITheme theme = themes.Add("testTheme", Themes.OfficeTheme); theme.ThemeFontScheme.Minor[FontLanguageIndex.Latin].Name = "Trebuchet MS"; workbook.Theme = theme; var style_Normal = workbook.Styles["Normal"]; style_Normal.Font.ThemeFont = ThemeFont.Minor; } }
public MainWindowViewModel(ThemeInfoProvider themeInfoProvider) { this.themeInfoProvider = themeInfoProvider; changeThemeCommand = new AsyncDelegateCommand <ThemeInfoPair>(ChangeTheme); changeWpfThemeCommand = new AsyncDelegateCommand <WpfThemeInfo>(ChangeWpfTheme); foreach (var theme in themeInfoProvider.Themes) { Themes.Add(theme); } foreach (var theme in themeInfoProvider.WpfThemes) { WpfThemes.Add(theme); } foreach (var theme in themeInfoProvider.NativeThemes) { NativeThemes.Add(theme); } Themes.CollectionChanged += (s, e) => UpdateMenu(); WpfThemes.CollectionChanged += (s, e) => UpdateMenu(); NativeThemes.CollectionChanged += (s, e) => UpdateMenu(); UpdateMenu(); Pages.Add(ControlComparisonViewModel.Create <TextBoxSampleNative, TextBoxSampleWpf>("TextBox")); Pages.Add(ControlComparisonViewModel.Create <ButtonSampleNative, ButtonSampleWpf>("Button")); Pages.Add(ControlComparisonViewModel.Create <RadioCheckSampleNative, RadioCheckSampleWpf>("Radio/Check")); Pages.Add(ControlComparisonViewModel.Create <MenuSampleNative, MenuSampleWpf>("Menu")); Pages.Add(ControlComparisonViewModel.Create <ScrollBarSampleNative, ScrollBarSampleWpf>("ScrollBar")); Pages.Add(ControlComparisonViewModel.Create <ComboBoxSampleNative, ComboBoxSampleWpf>("ComboBox")); Pages.Add(ControlComparisonViewModel.Create <ListBoxSampleNative, ListBoxSampleWpf>("ListBox")); Pages.Add(ControlComparisonViewModel.Create <ListViewSampleNative, ListViewSampleWpf>("ListView")); Pages.Add(ControlComparisonViewModel.Create <TreeViewSampleNative, TreeViewSampleWpf>("TreeView")); Pages.Add(ControlComparisonViewModel.Create <DataGridSampleNative, DataGridSampleWpf>("DataGrid")); Pages.Add(ControlComparisonViewModel.Create <TabControlSampleNative, TabControlSampleWpf>("TabControl")); Pages.Add(ControlComparisonViewModel.Create <ProgressBarSampleNative, ProgressBarSampleWpf>("ProgressBar")); Pages.Add(ControlComparisonViewModel.Create <TrackbarSampleNative, TrackbarSampleWpf>("Trackbar")); Pages.Add(ControlComparisonViewModel.Create <GroupBoxSampleNative, GroupBoxSampleWpf>("GroupBox")); Pages.Add(ControlComparisonViewModel.Create <StatusBarSampleNative, StatusBarSampleWpf>("StatusBar")); Pages.Add(ControlComparisonViewModel.Create <ToolBarSampleNative, ToolBarSampleWpf>("ToolBar")); Pages.Add(ControlComparisonViewModel.Create <CalendarSampleNative, CalendarSampleWpf>("Calendar")); Pages.Add(ControlComparisonViewModel.Create <MiscSampleNative, MiscSampleWpf>("Misc")); Pages.Add(ControlComparisonViewModel.Create <System.Windows.Forms.UserControl, ExpanderSampleWpf>("Expander")); Pages.Add(ControlComparisonViewModel.Create <CombinedSampleNative, CombinedSampleWpf>("All")); Pages.Add(ControlComparisonViewModel.Create <System.Windows.Forms.UserControl, DocumentSample>("Doc")); Pages.Add(new ColorList()); CurrentPage = Pages[0]; NativeThemeName = "Native: Default"; WpfThemeName = "WPF: Default"; }
/// <summary> /// Save the current theme settings to a custom configuration file. /// </summary> public static bool SaveConfig() { StreamWriter fileStream = null; string uiFilePath = CustomThemeFile; bool success = false; try { CIX.UIConfigFolder = Path.GetDirectoryName(uiFilePath); if (CIX.UIConfigFolder != null) { Directory.CreateDirectory(CIX.UIConfigFolder); } fileStream = new StreamWriter(uiFilePath, false); XmlWriterSettings settings = new XmlWriterSettings { Indent = true, OmitXmlDeclaration = true, NewLineOnAttributes = true }; using (XmlWriter writer = XmlWriter.Create(fileStream, settings)) { fileStream = null; XmlSerializer serializer = new XmlSerializer(typeof(UIConfig)); serializer.Serialize(writer, _uiConfig); } Themes.Add(Resources.Custom); Preferences.StandardPreferences.CurrentTheme = Resources.Custom; LogFile.WriteLine("Saved UI themes to {0}", uiFilePath); success = true; } catch (Exception e) { LogFile.WriteLine("Cannot save UI themes to {0} : {1}", uiFilePath, e.Message); } finally { if (fileStream != null) { fileStream.Dispose(); } } return(success); }
public AppearanceViewModel() { // add the default _themes Themes.Add(new Link { DisplayName = "ciemny", Source = AppearanceManager.DarkThemeSource }); Themes.Add(new Link { DisplayName = "jasny", Source = AppearanceManager.LightThemeSource }); SelectedFontSize = AppearanceManager.Current.FontSize == FontSize.Large ? FontLarge : FontSmall; SyncThemeAndColor(); AppearanceManager.Current.PropertyChanged += OnAppearanceManagerPropertyChanged; }
/// <summary> /// 初始化主题资源文件 /// </summary> private static void InitializeThemes() { var resources = _assembly.GetManifestResourceNames(); var themes = resources.Where(a => a.EndsWith(".xaml") && a.Contains("Theming")); foreach (var item in themes) { Stream stream = _assembly.GetManifestResourceStream(item); ResourceDictionary rd = XamlReader.Load(stream) as ResourceDictionary; Themes.Add(item.Replace(_assembly.FullName, string.Empty), rd); } }
//Constructor public MainWindowViewModel() { Themes.Add(new Theme("Default", "/PresentationFramework.Aero2;component/themes/Aero2.normalcolor.xaml")); Themes.Add(new Theme("Aero", "/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml")); Themes.Add(new Theme("Classic", "/PresentationFramework.Classic;component/themes/Classic.xaml")); Themes.Add(new Theme("Luna", "/PresentationFramework.Luna;component/themes/Luna.normalcolor.xaml")); _currentTheme = Themes[0]; BrowseCommand = new Command(BrowseFile); SaveAsCommand = new Command(SaveFileAs); ChangeThemeCommand = new Command(ChangeTheme); SaveCommand = new Command(SaveFile); ExitCommand = new Command(Exit); _model = new PeopleViewModel(); }
public string GetThemeInfo(string ThemeID) { string RetVal = string.Empty; string TempFileWPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath + Constants.FolderName.TempCYV, DateTime.Now.Ticks.ToString() + ".xml"); string AbsoluteTempFile = HttpContext.Current.Request.Url.AbsoluteUri; string MapFolder = string.Empty; Map diMap = null; Themes themes = null; bool visible = false; try { //step To load map from session/ NewMap/ From preserved file diMap = this.GetSessionMapObject(); if (!string.IsNullOrEmpty(ThemeID)) { themes = new Themes(); visible = diMap.Themes[ThemeID].Visible; Theme theme = (Theme)diMap.Themes[ThemeID].Clone(); theme.AreaIndexes = new System.Collections.Hashtable(); themes.Add(theme); theme.Visible = visible; } else { themes = (Themes)diMap.Themes.Clone(); foreach (Theme theme in themes) { theme.Visible = diMap.Themes[theme.ID].Visible; theme.AreaIndexes = new System.Collections.Hashtable(); } } //get theme info xml for all themes RetVal = this.GetXmlOfSerializeObject(TempFileWPath, themes); } catch (Exception ex) { //Global.WriteErrorsInLog("From GetThemeInfo ->" + ex.Message); RetVal = "false" + Constants.Delimiters.ParamDelimiter + ex.Message; Global.CreateExceptionString(ex, null); } finally { } return RetVal; }