public void Decompile(SelectionDialog message) { var pattern = ""; if (message.Pattern == SelectionDialogPattern.Top) { pattern = "top"; } else if (message.Pattern == SelectionDialogPattern.Bottom) { pattern = "bottom"; } else { pattern = ((int)message.Pattern).ToString(); } WriteTag("sel", FormatIdentifier(message.Name), pattern); mWriter.WriteLine(); foreach (var line in message.Options) { Decompile(line); mWriter.WriteLine(); } }
private void dispose() { Console.Out.WriteLine("[NewInjectionViewModel] Closing New Injection Window now, begin to unregister events"); //release all the resources deleteConfirmDialog.Cancel.Click -= deleteDialog_OnCloseDown; deleteConfirmDialog.Confirm.Click -= deleteDialog_OnDeleteDown; dischargeConfirmDialog.Cancel.Click -= dischargeDialog_OnCloseDown; dischargeConfirmDialog.Confirm.Click -= dischargeDialog_OnConfirmDown; readmitConfirmDialog.Cancel.Click -= readmitDialog_OnCloseDown; readmitConfirmDialog.Confirm.Click -= readmitDialog_OnConfirmDown; duplicatedRoomConfirmDialog.Cancel.Click -= duplicatedRoomConfirmDialog_OnCloseDown; duplicatedRoomConfirmDialog.Confirm.Click -= duplicatedRoomConfirmDialog_OnConfirmDown; ((NewInjection)NewInjection.window).RP_injection.SelectionChanged -= reselectUptakeTime; ((NewInjection)NewInjection.window).PatientSelection.SelectionChanged -= patientSelectionChanged; deleteConfirmDialog = null; dischargeConfirmDialog = null; readmitConfirmDialog = null; duplicatedRoomConfirmDialog = null; Cancel = null; Confirm = null; Delete = null; Discharge = null; Readmit = null; ClearPatient = null; Injection = null; SelectedPatient = null; NewInjection.window = null; }
/// <summary> /// The button assign_ on click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private async void ButtonAssign_OnClick([NotNull] object sender, [NotNull] RoutedEventArgs e) { if (sender == null) { throw new ArgumentNullException(nameof(sender)); } if (e == null) { throw new ArgumentNullException(nameof(e)); } try { var item = (sender as FrameworkElement)?.DataContext; var index = this.ListView1.Items.IndexOf(item ?? throw new InvalidOperationException()); var data = (Train)this.ListView1.Items[index]; var dialog = new SelectionDialog { DataContext = new SelectTteViewModel(data) }; var result = await DialogHost.Show(dialog, "RootDialog", this.ClosingEventHandler) .ConfigureAwait(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Decompile(SelectionDialog message) { WriteTag("sel", message.Name); mWriter.WriteLine(); foreach (var line in message.Options) { Decompile(line); mWriter.WriteLine(); } }
private void PushButton_Click(object sender, RoutedEventArgs e) { SelectionDialog dialogBox = new SelectionDialog(paretocalculator); Nullable <bool> dialogResult = dialogBox.ShowDialog(); if (dialogResult == true) { string s = (string)dialogBox.selectionListbox.SelectedItem; this.paretocalculator.push(s); } this.UpdateStack(); }
private bool TryCompileSelectionDialog(MessageScriptParser.SelectionDialogContext context, out SelectionDialog selectionWindow) { LogContextInfo(context); selectionWindow = null; // // Parse identifier // string identifier; { if (!TryGetFatal(context, context.Identifier, "Expected selection window name", out var identifierNode)) { return(false); } identifier = identifierNode.Symbol.Text; } LogInfo(context, $"Compiling selection window: {identifier}"); // // Parse text content // List <TokenText> options; { if (!TryGetFatal(context, context.tokenText, "Expected selection window text", out var tagTextContext)) { return(false); } if (!TryCompileTokenText(tagTextContext, out options)) { LogError(tagTextContext, "Failed to compile selection window text"); return(false); } } // // Create Selection window // selectionWindow = new SelectionDialog(identifier, options); return(true); }
public void OnOpening(object enterInformation) { var graphicsDeviceManager = GameInstance.GetService <GraphicsDeviceManager>(); graphicsDeviceManager.PreferMultiSampling = true; graphicsDeviceManager.ApplyChanges(); _mainOverlay = new UiOverlay(); var translation = GameInstance.GetService <TranslationProvider>(); _mainOverlay.AddElement(new HexagonBackground()); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "StartNewGame"), new Vector2(26, 45), OnStartNewGame)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "LoadGame"), new Vector2(26, 107), OnLoadGame)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Gamejolt"), new Vector2(26, 169), null)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Options"), new Vector2(26, 231), null)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "QuitGame"), new Vector2(26, 293), OnExitGame)); _mainOverlay.AddInputController(new KeyboardUiInputController()); _mainOverlay.AutoEnumerateTabIndices(); _closeDialog = new SelectionDialog(translation.CreateValue("System", "ReallyQuitGameQuestion"), translation.CreateValue("System", "UnsavedChangesLost"), new[] { new LeftSideButton(translation.CreateValue("System", "No"), new Vector2(50, 50), b => { _mainOverlay.CloseModal(); }), new LeftSideButton(translation.CreateValue("System", "Yes"), new Vector2(50, 100), b => { GameInstance.GetService <ScreenManager>().NotifyQuitGame(); }) }); var bar = new ControlBar(); bar.AddEntry(translation.CreateValue("System", "Select"), Buttons.A, Keys.Enter); _mainOverlay.AddElement(bar); _mainOverlay.Show(); }
public void AddDialog(SelectionDialog message) { if (mDialogs == null) { mDialogs = new List <Tuple <BinaryDialogKind, object> >(); } BinarySelectionDialog binary; binary.Name = message.Name.Substring(0, Math.Min(message.Name.Length, BinarySelectionDialog.IDENTIFIER_LENGTH)); binary.Pattern = ( BinarySelectionDialogPattern )message.Pattern; binary.Ext = binary.Reserved = 0; binary.OptionCount = ( short )message.Options.Count; binary.OptionStartAddresses = new int[message.Options.Count]; var textBuffer = new List <byte>(); { int lineStartAddress = 0x20 + (binary.OptionCount * 4) + 4; for (int i = 0; i < message.Options.Count; i++) { binary.OptionStartAddresses[i] = lineStartAddress; var lineBytes = ProcessLine(message.Options[i]); lineBytes.Add(0); // intentional textBuffer.AddRange(lineBytes); lineStartAddress += lineBytes.Count; } textBuffer.Add(0); // intentional } binary.TextBuffer = textBuffer.ToArray(); binary.TextBufferSize = binary.TextBuffer.Length; mDialogs.Add(new Tuple <BinaryDialogKind, object>(BinaryDialogKind.Selection, binary)); }
public void AddDialog(SelectionDialog message) { if (mDialogs == null) { mDialogs = new List <Tuple <BinaryDialogKind, object> >(); } BinarySelectionDialog binary; binary.Name = message.Name; binary.Field18 = binary.Field1C = binary.Field1E = 0; binary.OptionCount = ( short )message.Options.Count; binary.OptionStartAddresses = new int[message.Options.Count]; var textBuffer = new List <byte>(); { int lineStartAddress = 0x20 + (binary.OptionCount * 4) + 4; for (int i = 0; i < message.Options.Count; i++) { binary.OptionStartAddresses[i] = lineStartAddress; var lineBytes = ProcessLine(message.Options[i]); lineBytes.Add(0); // intentional textBuffer.AddRange(lineBytes); lineStartAddress += lineBytes.Count; } textBuffer.Add(0); // intentional } binary.TextBuffer = textBuffer.ToArray(); binary.TextBufferSize = binary.TextBuffer.Length; mDialogs.Add(new Tuple <BinaryDialogKind, object>(BinaryDialogKind.Selection, binary)); }
private bool TryCompileSelectionDialog(MessageScriptParser.SelectionDialogContext context, out SelectionDialog selectionWindow) { LogContextInfo(context); selectionWindow = null; // // Parse identifier // string identifier; { if (!TryGetFatal(context, context.Identifier, "Expected selection window name", out var identifierNode)) { return(false); } identifier = ParseIdentifier(identifierNode); } LogInfo(context, $"Compiling selection window: {identifier}"); // // Parse pattern // SelectionDialogPattern pattern = SelectionDialogPattern.Top; { if (TryGet(context, context.selectionDialogPattern, out var patternCtx)) { if (TryGet(patternCtx, patternCtx.SelectionDialogPatternId, out var patternIdNode)) { switch (patternIdNode.Symbol.Text) { case "top": pattern = SelectionDialogPattern.Top; break; case "bottom": pattern = SelectionDialogPattern.Bottom; break; default: LogError(patternCtx, $"Unknown selection dialog pattern: {patternIdNode.Symbol.Text}"); return(false); } } else if (TryParseShortIntLiteral(context, "Failed to parse selection dialog pattern ID", patternCtx.IntLiteral, out var patternId)) { pattern = (SelectionDialogPattern)patternId; } else { LogError(patternCtx, "Invalid selection dialog pattern"); return(false); } } } // // Parse text content // List <TokenText> options; { if (!TryGetFatal(context, context.tokenText, "Expected selection window text", out var tagTextContext)) { return(false); } if (!TryCompileTokenText(tagTextContext, out options)) { LogError(tagTextContext, "Failed to compile selection window text"); return(false); } } // // Create Selection window // selectionWindow = new SelectionDialog(identifier, pattern, options); return(true); }
private void Modal() { SelectedIndex = SelectionDialog.Show(_items, _font, _selIndex, _bZebra); }
/// <summary> /// The button add on click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private async void ButtonAddOnClick([CanBeNull] object sender, [CanBeNull] RoutedEventArgs e) { try { if (string.Compare(this.currentSelectedItem, "Coach", StringComparison.Ordinal) == 0) { var dialog1 = new SelectionDialog { DataContext = new SelectCoachCategoryViewModel() }; var result1 = await DialogHost.Show(dialog1, "RootDialog") .ConfigureAwait(false); if ((bool)result1) { this.Dispatcher.Invoke( () => { var coaches = this.root.Items ?? throw new InvalidOperationException(); var item = new MenuItem { Name = DataHelper.SelectedCoach }; if (!coaches.Contains(item)) { coaches.Add(item); } this.TreeView.Items[0] = this.root; }); } } else { var o = this.list; if (o?.Contains(this.currentSelectedItem) == true) { DataHelper.SelectedCoach = (this.list ?? throw new InvalidOperationException()).FirstOrDefault( a => a.Contains(this.currentSelectedItem ?? throw new InvalidOperationException())); var dialog2 = new SelectionDialog { DataContext = new EnterCoachesViewModel() }; var result2 = await DialogHost.Show(dialog2, "RootDialog") .ConfigureAwait(false); if ((bool)result2) { this.Dispatcher.Invoke( () => { var coaches = (this.root.Items ?? throw new InvalidOperationException()).FirstOrDefault( c => c.Name == DataHelper.SelectedCoach); if (DataHelper.CoachesList != null) { foreach (var coach in DataHelper.CoachesList) { coaches?.Items?.Add(new MenuItem { Name = coach }); } } this.TreeView.Items[0] = this.root; }); } } else { MessageBox.Show("Invalid request!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }