public static void drawblanks(TexturesManager texman, StylesManager styman, String size, bool mySecs, bool myAm, bool existsSecs, bool existsAm, bool existsBoth) { if((mySecs && myAm) || (mySecs && !existsBoth)) return; if(!mySecs && !myAm) { if(existsBoth) { GUILayout.Label(texman.getTexture("secsblank_" + size), styman.texStyle); GUILayout.Label(texman.getTexture("amblank_" + size), styman.texStyle); } else if(existsSecs) GUILayout.Label(texman.getTexture("secsblank_" + size), styman.texStyle); else if(existsAm) GUILayout.Label(texman.getTexture("amblank_" + size), styman.texStyle); } else if(!mySecs && myAm) { if(existsBoth) GUILayout.Label(texman.getTexture("secsblank_" + size), styman.texStyle); else if(existsSecs) GUILayout.Label(texman.getTexture("interblank_" + size), styman.texStyle); } else if(mySecs && !myAm && existsBoth) GUILayout.Label(texman.getTexture("amblank_" + size), styman.texStyle); }
public void Load(string name, ResourceDictionary dictionary) { T GetValue <T>(string key) { return((T)dictionary[key]); } StyleName = name; Dictionary = dictionary; MahAppsDictionary = StylesManager.GetStyle( "MahApps", GetValue <string>("LoadingMahAppsThemeName")); TitleBackgroundBrush = GetValue <SolidColorBrush>("Window.Main.TitleBackground"); NonActiveTitleBackgroundBrush = GetValue <SolidColorBrush>("Window.Main.NonActiveTitleBackground"); BackgroundBrush = GetValue <SolidColorBrush>("Window.Main.Background"); ForegroundImagePath = GetValue <string>("LoadingForegroundImagePath"); if (!string.IsNullOrWhiteSpace(ForegroundImagePath) && !ForegroundImagePath.Equals("None", StringComparison.InvariantCultureIgnoreCase)) { ForegroundImagePath = ForegroundImagePath.Replace('\\', '/'); ForegroundImageUri = new Uri($"pack://application:,,,/{ForegroundImagePath}"); } else { ForegroundImagePath = null; ForegroundImageUri = null; } BackgroundImagePath = GetValue <string>("LoadingBackgroundImagePath"); if (!string.IsNullOrWhiteSpace(BackgroundImagePath) && !BackgroundImagePath.Equals("None", StringComparison.InvariantCultureIgnoreCase)) { BackgroundImagePath = BackgroundImagePath.Replace('\\', '/'); BackgroundImageUri = new Uri($"pack://application:,,,/{BackgroundImagePath}"); } else { BackgroundImagePath = null; BackgroundImageUri = null; } LoadingIndicatorHorizontalAlignment = Enum.Parse <HorizontalAlignment>( GetValue <string>("LoadingIndicatorHorizontalAlignment"), true); LoadingIndicatorVerticalAlignment = Enum.Parse <VerticalAlignment>( GetValue <string>("LoadingIndicatorVerticalAlignment"), true); }
private void ApplyLoadingStyle() { _loadingStyle = StylesManager.GetRandomLoadingStyle(); if (_loadingStyle.ForegroundImageUri != null) { loadingForegroundImage.Source = new BitmapImage( _loadingStyle.ForegroundImageUri); connectionFailedForegroundImage.Source = new BitmapImage( _loadingStyle.ForegroundImageUri); loadingForegroundImage.Visibility = Visibility.Visible; connectionFailedForegroundImage.Visibility = Visibility.Visible; } else { loadingForegroundImage.Source = null; connectionFailedForegroundImage.Source = null; loadingForegroundImage.Visibility = Visibility.Hidden; connectionFailedForegroundImage.Visibility = Visibility.Hidden; } if (_loadingStyle.BackgroundImageUri != null) { loadingBackgroundImage.Source = new BitmapImage( _loadingStyle.BackgroundImageUri); connectionFailedBackgroundImage.Source = new BitmapImage( _loadingStyle.BackgroundImageUri); loadingBackgroundImage.Visibility = Visibility.Visible; connectionFailedBackgroundImage.Visibility = Visibility.Visible; } else { loadingBackgroundImage.Source = null; connectionFailedBackgroundImage.Source = null; loadingBackgroundImage.Visibility = Visibility.Hidden; connectionFailedBackgroundImage.Visibility = Visibility.Hidden; } loadingIndicator.HorizontalAlignment = _loadingStyle.LoadingIndicatorHorizontalAlignment; loadingIndicator.VerticalAlignment = _loadingStyle.LoadingIndicatorVerticalAlignment; connectionFailedIndicator.HorizontalAlignment = _loadingStyle.LoadingIndicatorHorizontalAlignment; connectionFailedIndicator.VerticalAlignment = _loadingStyle.LoadingIndicatorVerticalAlignment; }
static void Main() { try { string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Data\chords.csv"); ArrangerState arrangerState = new ArrangerState(); ArrangerManager arrangerManager = new ArrangerManager(arrangerState); StylesManager stylesManager = new StylesManager(); GUIManager guiManager = new GUIManager(); stylesManager.ReadStyles(arrangerState); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm(arrangerManager, guiManager)); } catch (Exception e) { MessageBox.Show("Fatal error: " + e.Message); Application.Exit(); } }