internal static Color Darken(this Color color, Accents amount) { var value = (float)amount; value = value * .01f; return(Lerp(color, nearBlack, value)); }
/// <summary> /// Gets the <see cref="Accent"/> with the given resource dictionary. /// </summary> /// <param name="resources"><see cref="ResourceDictionary"/> from which the accent should be retrieved.</param> /// <returns>The <see cref="Accent"/> or <c>null</c>, if the accent wasn't found.</returns> public static Accent GetAccent(ResourceDictionary resources) { if (resources == null) { throw new ArgumentNullException(nameof(resources)); } var builtInAccent = Accents.FirstOrDefault(x => AreResourceDictionarySourcesEqual(x.Resources.Source, resources.Source)); if (builtInAccent != null) { return(builtInAccent); } // support dynamically created runtime resource dictionaries if (resources.Source == null) { if (IsAccentDictionary(resources)) { return(new Accent { Name = "Runtime accent", Resources = resources, }); } } return(null); }
internal static Color Lighten(this Color color, Accents amount) { var value = (float)amount; value = value * .01f; return(Lerp(color, nearWhite, value)); }
void DataChangeHandler(ApplicationData appData, object args) { if (_roamingSettingsService.ContainsKey(Key)) { var hex = _roamingSettingsService.GetData(Key).ToString(); Current = Accents.First(c => c.Hex.Equals(hex)); } }
/// <summary> /// Gets an accent color with the specified name, if it exists. /// </summary> /// <param name="name">The name.</param> /// <returns></returns> public static Maybe <IAccentColor> TryGetAccent(string name) { Requires.NotNullOrEmpty(name, nameof(name)); var ret = Accents.FirstOrDefault(v => v.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); return(ret == null ? new Maybe <IAccentColor>() : new Maybe <IAccentColor>(ret)); }
public override void setAdjacecyString(string adjacency) { if (accents == null) { accents = GetComponentInChildren <Accents>(); } base.setAdjacecyString(adjacency); accents.updateAccents(adjacency); }
/// <summary> /// Gets the <see cref="Accent"/> with the given resource dictionary. /// </summary> /// <param name="resources"></param> /// <returns>The <see cref="Accent"/> or <c>null</c>, if the accent wasn't found.</returns> public static Accent GetAccent(ResourceDictionary resources) { if (resources == null) { throw new ArgumentNullException("resources"); } return(Accents.FirstOrDefault(x => x.Resources.Source == resources.Source)); }
/// <summary> /// Gets the <see cref="Accent"/> with the given name. /// </summary> /// <returns>The <see cref="Accent"/> or <c>null</c>, if the app theme wasn't found</returns> public static Accent GetAccent(string accentName) { if (accentName == null) { throw new ArgumentNullException(nameof(accentName)); } return(Accents.FirstOrDefault(x => x.Name.Equals(accentName, StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets the <see cref="Accent"/> with the given name. /// </summary> /// <param name="accentName"></param> /// <returns>The <see cref="Accent"/> or <c>null</c>, if the app theme wasn't found</returns> public static Accent GetAccent(string accentName) { if (accentName == null) { throw new ArgumentNullException("accentName"); } return(Accents.FirstOrDefault(x => x.Name == accentName)); }
private void ProcessResxFile(string inputFileName) { try { var outputFileName = Path.Combine(Path.GetDirectoryName(inputFileName), Path.GetFileNameWithoutExtension(inputFileName) + ".qps-ploc" + Path.GetExtension(inputFileName)); using (var inputStream = new FileStream(inputFileName, FileMode.Open, FileAccess.Read)) using (var outputStream = new FileStream(outputFileName, FileMode.Create, FileAccess.Write)) { var processor = new ResxProcessor(); if (EnableExtraLength || UseDefaultOptions) { processor.TransformString += (s, e) => { e.Value = ExtraLength.Transform(e.Value); }; } if (EnableAccents || UseDefaultOptions) { processor.TransformString += (s, e) => { e.Value = Accents.Transform(e.Value); }; } if (EnableBrackets || UseDefaultOptions) { processor.TransformString += (s, e) => { e.Value = Brackets.Transform(e.Value); }; } if (EnableMirror) { processor.TransformString += (s, e) => { e.Value = Mirror.Transform(e.Value); }; } if (EnableUnderscores) { processor.TransformString += (s, e) => { e.Value = Underscores.Transform(e.Value); }; } processor.Transform(inputStream, outputStream); } Console.WriteLine("The file {0} was written successfully.", outputFileName); } catch (Exception ex) { if (ex is PathTooLongException || ex is FileNotFoundException || ex is DirectoryNotFoundException || ex is IOException || ex is SecurityException) { Console.WriteLine(ex.Message); } else { throw; } } }
public ThemeViewModel(IThemeController controller) { this.controller = controller; Themes = controller.Themes; Accents = controller.Accents; CurrentTheme = Themes.Single(t => t.Name == controller.CurrentTheme.Name); CurrentAccent = Accents.Single(a => a.Name == controller.CurrentAccent.Name); }
private void GetSetting() { Log.Debug(String.Format("Get Setting")); RegistryKey subKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\MP\UI DEV\PrevSesParameters"); SelectedAccent = Accents.FirstOrDefault(e => e.Tag.ToString() == subKey.GetValue("Accent", "Lime").ToString()); SelectedTheme = Themes.FirstOrDefault(e => e == subKey.GetValue("AppTheme", "NIGHT").ToString()); SelectedLanguage = Languages.FirstOrDefault(l => l.Culture == subKey.GetValue("Language", "en").ToString()); subKey.Close(); }
public static string ToStringFromEnum(this Accents accents) { switch (accents) { case Accents.Amber: return("Amber"); case Accents.Blue: return("Blue"); case Accents.Brown: return("Brown"); case Accents.Cobalt: return("Cobalt"); case Accents.Crimson: return("Crimson"); case Accents.Cyan: return("Cyan"); case Accents.Emerald: return("Emerald"); case Accents.Green: return("Green"); case Accents.Indigo: return("Indigo"); case Accents.Lime: return("Lime"); case Accents.Magenta: return("Magenta"); case Accents.Mauve: return("Mauve"); case Accents.Olive: return("Olive"); case Accents.Orange: return("Orange"); case Accents.Pink: return("Pink"); case Accents.Purple: return("Purple"); case Accents.Red: return("Red"); case Accents.Sienna: return("Sienna"); case Accents.Steel: return("Steel"); case Accents.Taupe: return("Taupe"); case Accents.Teal: return("Teal"); case Accents.Violet: return("Violet"); case Accents.Yellow: return("Yellow"); } return(""); }
public MainWindowsViewModel() { var fileDb = Database.OpenFile("c:\\mysql.db"); Accents = new[] { "Red", "Green", "Blue", "Purple", "Orange", "Lime", "Emerald", "Teal", "Cyan", "Cobalt", "Indigo", "Violet", "Pink", "Magenta", "Crimson", "Amber", "Yellow", "Brown", "Olive", "Steel", "Mauve", "Taupe", "Sienna" }; IsLight = false; Themes = new[] { "BaseLight", "BaseDark" }; SelectedAccent = Accents[0]; ComboBoxWidth = Accents.OrderByDescending(x => x.Length).First().Length * 15; }
public MainWindow() { InitializeComponent(); rnd = new Random(); Accents.Add(DefaultColors.Briliet); Accents.Add(DefaultColors.Hibiscus); Accents.Add(DefaultColors.LaSectur); Accents.Add(DefaultColors.Oros); Accents.Add(DefaultColors.SpectreOriginal); Accents.Add(DefaultColors.ThismakerOfficial); ApplyRandomAccent(); }
public static void LoadSettings(bool applyThemeAswell = false) { // Declare Registry var keyApp = Registry.CurrentUser.CreateSubKey("Software\\Xeraxic\\Metro WPF Template\\ApplicationSettings\\"); if (keyApp != null) ApplicationAccent = (Accents)keyApp.GetValue("accent", 0); if (applyThemeAswell) ApplyAccent(); if (keyApp == null) return; ApplicationSizeWidth = Convert.ToSingle(keyApp.GetValue("SizeWidth", 1100)); ApplicationSizeHeight = Convert.ToSingle(keyApp.GetValue("SizeHeight", 600)); ApplicationSizeMaximize = Convert.ToBoolean(keyApp.GetValue("SizeMaxamize", false)); }
public void ShouldAddFunnyAccentsWhenTransformingWithTheAccenterTransformation() { using (var inputStream = new FileStream(Test1FileName, FileMode.Open, FileAccess.Read)) using (var outputStream = new FileStream(OutputFileName, FileMode.Create, FileAccess.Write)) { var processor = new ResxProcessor(); processor.TransformString += (s, e) => { e.Value = Accents.Transform(e.Value); }; processor.Transform(inputStream, outputStream); } var transformed = File.ReadAllText(OutputFileName); Assert.That(transformed.Contains("<value>\u00d0\u00fb\u00f0\u00e9</value>")); Assert.That(!transformed.Contains("<value>Dude</value>")); Assert.That(transformed.Contains("<comment>Foo</comment>")); }
private void LoadSettings() { if (!File.Exists("settings.json")) { isInitalizating = true; Theme = "BaseDark"; // ThemeManager.Accents.Select(x=>x.Name).First(), Accent = "Amber"; // ThemeManager.AppThemes.Select(x => x.Name).First() AutoSaveLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); isInitalizating = false; UpdateSettings(); return; } var settings = JsonConvert.DeserializeObject <AudioViewSettings>(File.ReadAllText("settings.json")); isInitalizating = true; if (settings.Theme == null || Themes.All(x => x != settings.Theme)) { settings.Theme = "BaseDark"; SaveSettings(); } Theme = settings.Theme; if (settings.Accent == null || Accents.All(x => x != settings.Accent)) { settings.Accent = "Amber"; SaveSettings(); } Accent = settings.Accent; if (settings.AutoSaveLocation == null || !Directory.Exists(settings.AutoSaveLocation)) { settings.AutoSaveLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); SaveSettings(); } AutoSaveLocation = settings.AutoSaveLocation; isInitalizating = false; ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.Accents.Where(x => x.Name == Accent).First(), ThemeManager.AppThemes.Where(x => x.Name == Theme).First()); AudioViewSettings.Overwrite(settings); }
public MainWindow() { int comboBoxIndex = 0; int counter = 0; string currentLanguage = Properties.Settings.Default.CurrentLanguage; string currentInput = Properties.Settings.Default.CurrentInput; int currentRomanizationIndex = Properties.Settings.Default.CurrentRomanizationIndex; InitializeComponent(); textBoxInput.Text = currentInput; textBoxInput.SelectionStart = currentInput.Length; hideErrorsCheckBox.IsChecked = Properties.Settings.Default.HideErrors; languageManager = new LanguageManager(); accents = new Accents(); // Write available languages to the combo box foreach (string language in languageManager.Languages) { comboBoxLanguage.Items.Add(language); if (language == currentLanguage) { comboBoxIndex = counter; } counter++; } // Select the first item if it exists if (languageManager.Length != 0) { comboBoxLanguage.SelectedIndex = comboBoxIndex; } comboBoxRomanization.ItemsSource = languageManager.CurrentLanguage.RomanizationNames; Visibility visibility = (comboBoxRomanization.Items.Count == 0 ? Visibility.Hidden : Visibility.Visible); labelRomanization.Visibility = visibility; comboBoxRomanization.Visibility = visibility; if (currentRomanizationIndex != -1 && currentRomanizationIndex < comboBoxRomanization.Items.Count) { comboBoxRomanization.SelectedIndex = currentRomanizationIndex; } Transcribe(); }
public bool SetAccent(string name) { if (!Accents.ContainsKey(name)) { return(false); } Uri accent = Accents[name]; InvokeWindow(() => MainWindow.GetInstance().UpdateThemeManager(accent, ActiveTheme)); foreach (ITheme theme in Themes) { theme.SetAccent(accent); } return(SetTheme(ActiveTheme.Name)); }
public void Initialize() { var theme = Properties.Settings.Default.Theme; var accent = Properties.Settings.Default.Accent; if (!Themes.Any(c => c.Name == theme)) { theme = defaultTheme.Item1.Name; } if (!Accents.Any(c => c.Name == accent)) { accent = defaultTheme.Item2.Name; } SetTheme(theme); SetAccent(accent); }
private void LoadSettings() { var settings = Serializer.Load <Settings>(GetFileName("Settings.xml")); string accentName = null; if (settings != null) { accentName = settings.AccentName; Application.Current.MainWindow.Topmost = settings.IsAlwaysOnTop; } _settings = settings ?? new Settings(); if (accentName == null) { accentName = "Cobalt"; } ChangeAccentCommand.Execute(Accents.First(acc => acc.Name == accentName)); }
private void LoadAccents() { _accents = new ObservableCollection <Accent> { new Accent { Name = "Blue", Hex = "#1BA1E2" }, new Accent { Name = "Brown", Hex = "#A05000" }, new Accent { Name = "Green", Hex = "#339933" }, new Accent { Name = "Pink", Hex = "#E671B8" }, new Accent { Name = "Purple", Hex = "#A200FF" }, new Accent { Name = "Red", Hex = "#E51400" }, new Accent { Name = "Teal", Hex = "#00ABA9" }, new Accent { Name = "Lime", Hex = "#A2C139 " }, new Accent { Name = "Magenta", Hex = "#D80073 " } }; if (_roamingSettingsService.ContainsKey(Key)) { var hex = _roamingSettingsService.GetData(Key).ToString(); Current = Accents.First(c => c.Hex.Equals(hex)); } else { Current = Accents.First(); } }
private static void ReloadAccents() { string[] accents = { "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Amber.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Brown.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Cobalt.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Crimson.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Cyan.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Emerald.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Green.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Indigo.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Lime.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Magenta.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Mauve.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Olive.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Orange.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Pink.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Purple.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Sienna.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Taupe.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Violet.xaml", "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Yellow.xaml" }; Accents.Clear(); foreach (var a in accents) { var dic = new ResourceDictionary { Source = new Uri(a) }; var accent = new AccentColor(dic, Path.GetFileNameWithoutExtension(a)); Accents.Add(accent); } }
public MainViewModel(bool main, IWindow window) { IsMain = main; Window = window; AppManager = AppManager.Instance; DebugManager = AppManager.Debug; UIManager = AppManager.UI; UIManager.Windows.Add(this); if (IsMain) { var commandView = AppManager.Container.GetExportedValue <CommandViewModel>(); AddItem(commandView); } CurrentAccent = Accents.First(accent => accent.Name == "Cobalt"); DebugManager.Debugger.StatusChanged += Debugger_StatusChanged; }
public MidiProcessor(Plugin plugin) { _plugin = plugin; Events = new VstEventCollection(); NoteOnNumbers = new Queue <byte>(); NoteOffNumbers = new Queue <byte>(); _noteOnEvents = new List <VstMidiEvent>(); _octavesAddedOrderedNoteOnEvents = new List <VstMidiEvent>(); _rythm = new List <NoteLengthFrames>(); Probability = 100; NoteLengthsArray = new NoteLengths[4]; AccentsArray = new Accents[4]; for (int i = 0; i < 4; i++) { NoteLengthsArray[i] = NoteLengths.quarter; AccentsArray[i] = Accents.none; } CountRythm(); }
public SwordAccent(string texture, string suffix, int originX, int originY, int mana = 0, Action <Player, NPC, ProceduralSword, int, bool> onHit = null, float dpsModifier = 1f, int critBonus = 0, Action <Rectangle, Player> effect = null) { Type = Accents.Count; if (Main.netMode != NetmodeID.Server) { if (texture != null) { Texture = ModLoader.GetMod(Constants.ModName).GetTexture("Content/GFX/Items/Accents/" + texture); } } Suffix = suffix; Origin = new Vector2(originX, originY); OnHit = onHit; DpsModifier = dpsModifier; CritBonus = critBonus; Effect = effect; Mana = mana; if (!Accents.ContainsKey(Type)) { Accents.Add(Type, this); } }
public bool AddAccent(string name, Uri resource) { Accents.Add(name, resource); return(true); }
public static SwordAccent RandomAccent() { return(Accents.Random()); }
public static Color AccentDarken(this Color color, Accents amount) { var value = (float)amount; value = value * .01f; return Lerp(color, nearBlack, value); }
public static Color AccentLighten(this Color color, Accents amount) { var value = (float)amount; value = value * .01f; return Lerp(color, nearWhite, value); }
public static void LoadSettings(bool applyThemeAswell = false) { // Declare Registry var keyApp = Registry.CurrentUser.CreateSubKey("Software\\Xeraxic\\Assembly\\ApplicationSettings\\"); // Create a JSON Seralizer var jss = new JavaScriptSerializer(); if (keyApp != null) { applicationAccent = (Accents)keyApp.GetValue("accent", 0); applicationEasterEggs = Convert.ToBoolean(keyApp.GetValue("easterEggs", true)); applicationUpdateOnStartup = Convert.ToBoolean(keyApp.GetValue("CheckUpdatesOnStartup", true)); if (applyThemeAswell) ApplyAccent(); applicationRecents = jss.Deserialize<List<RecentFileEntry>>(keyApp.GetValue("RecentFiles", "").ToString()); applicationXBDMSidebarLocation = (Home.XBDMSidebarLocations)keyApp.GetValue("XBDMSidebarLocation", 0); applicationSizeWidth = Convert.ToSingle(keyApp.GetValue("SizeWidth", 1100)); applicationSizeHeight = Convert.ToSingle(keyApp.GetValue("SizeHeight", 600)); applicationSizeMaximize = Convert.ToBoolean(keyApp.GetValue("SizeMaxamize", false)); XDKNameIP = keyApp.GetValue("XDKNameIP", "192.168.1.0").ToString(); if (xbdm != null) { xbdm.UpdateDeviceIdent(XDKNameIP); //try { xbdm.Connect(); } catch { } } XDKAutoSave = Convert.ToBoolean(keyApp.GetValue("XDKAutoSave", true)); XDKScreenshotPath = keyApp.GetValue("XDKScreenshotPath", VariousFunctions.GetApplicationLocation() + @"Saved Images\").ToString(); XDKResizeImages = Convert.ToBoolean(keyApp.GetValue("XDKScreenshotResize", true)); XDKResizeScreenshotHeight = Convert.ToInt16(keyApp.GetValue("XDKScreenshotHeight", 1080)); XDKResizeScreenshotWidth = Convert.ToInt16(keyApp.GetValue("XDKScreenshotWidth", 1920)); XDKScreenshotGammaCorrect = Convert.ToBoolean(keyApp.GetValue("XDKScreenGammaCorrect", true)); XDKScreenshotGammaModifier = Convert.ToDouble(keyApp.GetValue("XDKScreenModifier", 0.5)); XDKScreenshotFreeze = Convert.ToBoolean(keyApp.GetValue("XDKScreenFreeze", false)); startpageShowOnLoad = Convert.ToBoolean(keyApp.GetValue("ShowStartPageOnLoad", true)); startpageHideOnLaunch = Convert.ToBoolean(keyApp.GetValue("HideStartPageOnLaunch", false)); startpageShowRecentsMap = Convert.ToBoolean(keyApp.GetValue("ShowRecentsMap", true)); startpageShowRecentsBLF = Convert.ToBoolean(keyApp.GetValue("ShowRecentsBLF", true)); startpageShowRecentsMapInfo = Convert.ToBoolean(keyApp.GetValue("ShowRecentsMapInfo", true)); halomapTagSort = (TagSort)keyApp.GetValue("TagSorting", 0); halomapShowEmptyClasses = Convert.ToBoolean(keyApp.GetValue("ShowEmptyClasses", false)); halomapLastSelectedMetaEditor = (LastMetaEditorType)keyApp.GetValue("LastSelectedMetaEditor", 0); halomapMapInfoDockSide = (MapInfoDockSide)keyApp.GetValue("MapInfoDockSide", 0); pluginsShowInvisibles = Convert.ToBoolean(keyApp.GetValue("ShowInvisibles", false)); pluginsShowComments = Convert.ToBoolean(keyApp.GetValue("ShowComments", true)); defaultMAP = Convert.ToBoolean(keyApp.GetValue("DefaultMAPEditor", true)); defaultBLF = Convert.ToBoolean(keyApp.GetValue("DefaultBLFEditor", false)); defaultMIF = Convert.ToBoolean(keyApp.GetValue("DefaultMIFEditor", false)); defaultAMP = Convert.ToBoolean(keyApp.GetValue("DefaultAMPEditor", true)); } OnSettingsChanged(); }
public async Task WindowLoaded() { MyMutex = new Mutex(true, "GTADownloaderOneInstance", out bool isNewInstance); if (!isNewInstance) { await TryCloseAsync(); } new Join(this, _tsViewModel); if (Accents.Count == 0) { foreach (var color in ThemeManager.Current.ColorSchemes) { Accents.Add(new AccentsModel() { ColorName = color }); } } if (IsServerChecked) { await Task.Delay(DelayJoinValue * 1000); if (Process.GetProcessesByName("steam").Length != 0) { if (Process.GetProcessesByName("arma3_x64").Length == 0 && Process.GetProcessesByName("arma3").Length == 0 && Process.GetProcessesByName("arma3launcher").Length == 0) { foreach (var server in Servers) { if (server.ContentButton == "Join TeamSpeak") { continue; } Join.Server(server); break; } } } else { MessageBox.Show("GTA Mission Downloader could not find steam.exe running! Make sure to launch Steam first before this application.", "Join Game Server Error", MessageBoxButton.OK, MessageBoxImage.Error); } } if (IsTsChecked) { if (Process.GetProcessesByName("ts3client_win64").Length == 0) { foreach (var server in Servers) { if (server.ContentButton != "Join TeamSpeak") { continue; } Join.Server(server); break; } } } _ = Update.ItemsAsync(); //Must be at the end, to prevent black screen if (IsHiddenChecked) { Helper.MyNotifyIcon.ShowBalloonTip("Reminder!", "The program is running in the background!", BalloonIcon.Info); WindowVisibility = Visibility.Hidden; } }