static void openSettings() { ShowSettings s = window.showSettings; window.Invoke(s); Console.WriteLine("BOOM"); }
public void SaveSettings(string showFilePath, BitmapSource source, DisplayMatrix displayMatrix) { ShowSettings showSettings = this.Models.FirstOrDefault(m => m.GetType() == typeof(ShowSettings)) as ShowSettings; this.Models.RemoveAll(m => m.GetType() == typeof(ShowSettings)); if (showSettings == null) { showSettings = new ShowSettings(); } showSettings.PrimaryDisplayMatrix = displayMatrix; showSettings.ShowPath = showFilePath; string imagePath = showFilePath + ".png"; using (var stream = new FileStream(imagePath, FileMode.Create)) { PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(source)); encoder.Save(stream); } showSettings.ImagePath = imagePath; this.Models.Insert(0, showSettings); }
public ShowSettings LoadShowSettingsFromFile(string path) { ShowModelCollection models; try { using (Stream stream = File.Open(path, FileMode.OpenOrCreate)) { models = Serializer.Deserialize(stream) as ShowModelCollection; } } catch (Exception e) { Debug.WriteLine("Error loading: " + e.ToString()); return(null); } if (models == null) { return(null); } foreach (ShowModel model in models) { ShowSettings showSettings = model as ShowSettings; if (showSettings != null) { showSettings.ShowPath = path; return(showSettings); } } return(null); }
private Task Add(Command command) { switch (command) { case Command.ToggleWindow: return(ToggleWindow.Add()); case Command.NextTab: return(NextTab.Add()); case Command.PreviousTab: return(PreviousTab.Add()); case Command.NewTab: return(NewTab.Add()); case Command.CloseTab: return(CloseTab.Add()); case Command.NewWindow: return(NewWindow.Add()); case Command.ShowSettings: return(ShowSettings.Add()); case Command.Copy: return(Copy.Add()); case Command.Paste: return(Paste.Add()); } return(Task.CompletedTask); }
private void InitializeControls() { var xPosition = GetLabelPosition(); gameLabel = new GameLogoControl { Position = new Point(xPosition, 4) }; Add(gameLabel); startGameButton = new StandardButton(20) { Position = new Point(xPosition - 2, 9), Text = "Start Game" }; startGameButton.Click += (sender, args) => StartGame?.Invoke(this, EventArgs.Empty); Add(startGameButton); continueGameButton = new StandardButton(20) { Position = new Point(xPosition - 2, 13), Text = "C0nt1nue Game" }; continueGameButton.Click += (sender, args) => ContinueGame?.Invoke(this, EventArgs.Empty); Add(continueGameButton); spellsLibraryButton = new StandardButton(20) { Position = new Point(xPosition - 2, 17), Text = "Spells L1brary" }; spellsLibraryButton.Click += (sender, args) => ShowSpellLibrary?.Invoke(this, EventArgs.Empty); Add(spellsLibraryButton); settingsButton = new StandardButton(20) { Position = new Point(xPosition - 2, 21), Text = "Sett1ngs" }; settingsButton.Click += (sender, args) => ShowSettings?.Invoke(this, EventArgs.Empty); Add(settingsButton); exitButton = new StandardButton(20) { Position = new Point(xPosition - 2, 25), Text = "Ex1t" }; exitButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty); Add(exitButton); }
protected override void OnContentRendered(EventArgs e) { base.OnContentRendered(e); // On first time startup, display the settings before creating the data directory if (!Path_.DirExists(Settings.Instance.DataPath)) { ShowSettings.Execute(); // Ensure the data directory exists Path_.CreateDirs(Settings.Instance.DataPath); } // Apply settings Settings.Instance.NotifySettingChanged(nameof(Settings.Origin)); Settings.Instance.NotifySettingChanged(nameof(Settings.Destination)); }
public async Task <GetShowSettingsResponse> Handle(GetShowSettingsRequest request, CancellationToken cancellationToken) { var errorMessage = string.Empty; ShowSettings response = null; try { response = await _infoServiceWrapper.GetShowSettings(request.AccountId); } catch (Exception ex) { errorMessage = ex.Message; } return(await Task.FromResult(new GetShowSettingsResponse { Success = string.IsNullOrEmpty(errorMessage) ? true : false, ErrorMessage = errorMessage, ShowSettings = response })); }
public static void HandleShowSettings() => ShowSettings.SafeInvoke();