private void LoadSettings() { RegistryKey key = Registry.CurrentUser.OpenSubKey("KazyCrypter"); SkinStyle style = SkinStyle.Office2007Black; if (key != null) { try { string name = key.GetValue("Skin").ToString(); if (name == "None") { skin.Shutdown(); comboBox2.SelectedIndex = 0; } else { foreach (SkinStyle s in Enum.GetValues(typeof(SkinStyle))) { if (s.ToString() == name) { style = s; } } skin.Shutdown(); skin.Style = style; for (int i = 0; i < comboBox2.Items.Count; i++) { if (comboBox2.Items[i].ToString() == skin.Style.ToString()) { comboBox2.SelectedIndex = i; } } } } catch { } key.Close(); } else { skin.Shutdown(); skin.Style = style; for (int i = 0; i < comboBox2.Items.Count; i++) { if (comboBox2.Items[i].ToString() == skin.Style.ToString()) { comboBox2.SelectedIndex = i; } } } }
private static GUIStyle GetScopeStyle(SkinStyle style) { switch (style) { case SkinStyle.Normal: return(null); case SkinStyle.Box: return(Style.boxedScopeStyle); case SkinStyle.Round: return(Style.roundScopeStyle); } return(Style.labelScopeStyle); }
private static GUIStyle GetScopeStyle(SkinStyle style) { switch (style) { case SkinStyle.Normal: return(Style.skinLabelStyle); case SkinStyle.Box: return(Style.skinBoxStyle); case SkinStyle.Round: return(Style.skinHelpStyle); } return(Style.skinLabelStyle); }
public void SetStyle(SkinStyle style) { Uri uri = new Uri(style.ToString() + ".xaml", UriKind.Relative); ResourceDictionary skin = LoadComponent(uri) as ResourceDictionary; if (skin == null) { return; } var res = Resources.MergedDictionaries; if (res.Count > 0) { res.Clear(); } res.Add(skin); }
private void LoadSettings() { RegistryKey key = Registry.CurrentUser.OpenSubKey("KazyCrypter"); SkinStyle style = SkinStyle.Office2007Black; if (key != null) { try { string name = key.GetValue("Skin").ToString(); if (name == "None") { skin.Shutdown(); } else { foreach (SkinStyle s in Enum.GetValues(typeof(SkinStyle))) { if (s.ToString() == name) { style = s; } } skin.Shutdown(); skin.Style = style; } checkBox1.Checked = bool.Parse(key.GetValue("RememberMe").ToString()); if (checkBox1.Checked) { textBox1.Text = key.GetValue("Username").ToString(); textBox2.Text = key.GetValue("Password").ToString(); checkBox2.Checked = bool.Parse(key.GetValue("AutoLogin").ToString()); } } catch { } key.Close(); } else { skin.Shutdown(); skin.Style = style; } }
private async void Settings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case "ColorScheme": if (Settings.Default.ColorScheme != mColorScheme) { SetStyle(Settings.Default.ColorScheme); mColorScheme = Settings.Default.ColorScheme; } break; case "UpdateBackgroundSettings": if (Settings.Default.UpdateBackgroundSettings > 0 && ServiceLink.IsConnected) { await UpdateBackgroundService(); } break; } }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { SkinStyle style = SkinStyle.Office2007Black; if (comboBox2.SelectedItem.ToString() == "None") { skin.Shutdown(); } else { foreach (SkinStyle s in Enum.GetValues(typeof(SkinStyle))) { if (s.ToString() == comboBox2.SelectedItem.ToString()) { style = s; } } skin.Shutdown(); skin.Style = style; } }
/// <summary> /// Inserts newStyle into a dependency tree</summary> /// <param name="newStyle">A SkinStyle that is not currently in the tree</param> /// <param name="roots">The sibling roots at this current level of the tree. These must be /// independent of each other (i.e., they must not represent subclasses of each other). /// This list may be modified to add or remove styles.</param> private static void InsertStyleIntoTree(SkinStyle newStyle, List<SkinStyle> roots) { // We may need to make newStyle a child of one of the roots. foreach (SkinStyle root in roots) { if (newStyle.TargetType.IsSubclassOf(root.TargetType)) { InsertStyleIntoTree(newStyle, root.Dependents); return; } } // Or we may need to make one or more of 'roots' be children of 'newStyle' and to add // newStyle to the list of roots. // Or newStyle is independent of existing roots and should simply be added to the list // of roots. int numRemaining = 0; for(int i = 0; i < roots.Count; i++) { SkinStyle root = roots[i]; if (root.TargetType.IsSubclassOf(newStyle.TargetType)) newStyle.Dependents.Add(root); else roots[numRemaining++] = root; } roots.RemoveRange(numRemaining, roots.Count - numRemaining); roots.Add(newStyle); }
private void LoadSkin(XmlDocument xmlDoc) { ActiveSkin.Styles.Clear(); var rootStyles = new List<SkinStyle>(); // iterate through the document and populate the skin list with styles XmlElement root = xmlDoc.DocumentElement; // get all the styles XmlNodeList styles = root.SelectNodes(StyleElement); if (styles == null) throw new FileFormatException("Error loading the skin file."); foreach (XmlElement style in styles) { try { string targetTypeValue = style.GetAttribute(TargetTypeAttribute); Type targetType = GetTypeFromString(targetTypeValue); // It's not really an error if TargetType doesn't exist, because the same skin file // can be used by multiple apps that have different types defined. if (targetType != null) { var styleDef = new SkinStyle(targetType); styleDef.Setters.AddRange(GetSetters(style)); InsertStyleIntoTree(styleDef, rootStyles); } } catch (Exception ex) { Outputs.WriteLine(OutputMessageType.Error, ex.Message); } } // Make each SkinStyle contain all the Setters for both itself and from its base SkinStyle (if any). SetInheritedSetters(new List<Setter>(), rootStyles); if (rootStyles.Count > 0) ActiveSkin.Styles.AddRange(rootStyles); else ActiveSkin = null; }
private void Application_Startup(object sender, StartupEventArgs e) { mLog.Info("Application Instance Startup"); if (Client.Commands.ConnectToExistingClient(50)) { mLog.Info("Existing instance found forwarding commandline and exiting"); if (e.Args.Length == 0) { Client.Commands.SendCommand("ShowWindow"); } else { Client.Commands.SendCommand(new ApplicationCommand(ParseUrlCmdline(e.Args))); } Shutdown(); return; } ServiceLink = new ServiceConnection(new Common.LoggerWrapperFactory()); ServiceLink.StateChanged += ServiceLink_StateChanged; ServiceLink.ShutdownInitiated += ServiceLink_ShutdownInitiated; ServiceLink.Connect(); ShutdownMode = ShutdownMode.OnExplicitShutdown; AddProcessCount(); mColorScheme = Settings.Default.ColorScheme; Settings.Default.PropertyChanged += Settings_PropertyChanged; Client.Commands.CommandRecieved += Commands_CommandRecieved; Client.Commands.RegisterCommandHandler("ShowWindow", Command_ShowWindow); Client.Commands.RegisterCommandHandler("NewMail", Command_NewMail); Client.Commands.RegisterCommandHandler("CheckMail", Command_CheckMail); Client.Commands.RegisterCommandHandler("NoOp", delegate(object s, CommandEventArgs ce) { }); Client.AccountNotification += mClient_AccountNotification; Client.ControllerIdle += mClient_ControllerIdle; Client.ControllerActive += mClient_ControllerActive; Task discard = Client.Commands.StartServerLoop(); SetStyle(Settings.Default.ColorScheme); Client.Init(); if (e.Args.Length == 0) { Client.Commands.SendCommand("ShowWindow"); } else { Client.Commands.SendCommand(new ApplicationCommand(ParseUrlCmdline(e.Args))); } RemoveProcessCount(); }
public LabelAttribute(string label, FontStyle fontStyle = FontStyle.Bold, SkinStyle skinStyle = SkinStyle.Normal) { Label = label; FontStyle = fontStyle; SkinStyle = skinStyle; }
public ColorThemePage(ConfigPage parent) : base(parent) { mColorScheme = Settings.Default.ColorScheme; }