Esempio n. 1
0
 public void OnDismiss()
 {
     if (ActiveDialog != null)
     {
         ActiveDialog.Dismiss();
     }
 }
    static async Task CreateDialog(ContentDialog Dialog, bool awaitPreviousDialog)
    {
        if (ActiveDialog != null)
        {
            if (awaitPreviousDialog)
            {
                ActiveDialog.Hide();
            }
            else
            {
                switch (Info.Status)
                {
                case AsyncStatus.Started:
                    Info.Cancel();
                    break;

                case AsyncStatus.Completed:
                    Info.Close();
                    break;

                case AsyncStatus.Error:

                    break;

                case AsyncStatus.Canceled:

                    break;
                }
            }
        }
        ActiveDialog          = Dialog;
        ActiveDialog.Closing += ActiveDialog_Closing;
        Info = ActiveDialog.ShowAsync();
    }
Esempio n. 3
0
            /// <summary>
            /// Set the index of a current dialog session. This dialog should be either the previous or next dialog
            /// from the last one (index wise) and the player must be in a dialog.
            /// </summary>
            ///
            /// <param name="target">The target merchant.</param>
            /// <param name="pursuitId">A dialog sequence (pursuit) ID.</param>
            /// <param name="newIndex">The index to which we are navigating.</param>
            /// <returns></returns>

            public bool SetDialogIndex(VisibleObject target, int pursuitId, int newIndex)
            {
                // Sanity checking
                if (target != Associate || pursuitId != CurrentPursuitId ||
                    target.Map.Id != User.Map.Id || !InDialog)
                {
                    Logger.DebugFormat("{0}: Failed check", User.Name);
                    return(false);
                }

                if (newIndex == (ActiveDialog.Index + 1) &&
                    newIndex != ActiveDialogSequence.Dialogs.Count() &&
                    newIndex < (ActiveDialogSequence.Dialogs.Count()))
                {
                    // Next
                    Logger.DebugFormat("Advancing one dialog");
                    ActiveDialog = ActiveDialogSequence.Dialogs[ActiveDialog.Index + 1];
                    Logger.DebugFormat("Active dialog is type {0}", ActiveDialog.GetType());
                    return(true);
                }
                else if (newIndex == (ActiveDialog.Index - 1) &&
                         newIndex >= 0)
                {
                    // Previous
                    Logger.DebugFormat("Rewinding one dialog");
                    ActiveDialog = ActiveDialogSequence.Dialogs[ActiveDialog.Index - 1];
                    return(true);
                }

                return(false);
            }
        public void EditName()
        {
            var vm = new EditNameVm {
                Name = Kunde.FirstName
            };
            var dlg = new ActiveDialog <EditNameDlg>(vm);

            if (dlg.ShowDialog() == true)
            {
                Kunde.FirstName = vm.Name;
                NotifyPropertyChanged(nameof(Kunde));
            }
        }
Esempio n. 5
0
        public void ShowDialog(GuiDialogBase dialog)
        {
            ActiveDialog?.OnClose();

            if (ActiveDialog != null)
            {
                RemoveScreen(ActiveDialog);
            }
            ActiveDialog = dialog;
            AddScreen(ActiveDialog);

            Game.IsMouseVisible = true;
        }
Esempio n. 6
0
        public void OnTabClosed()
        {
            if (ActiveDialog != null)
            {
                ActiveDialog.OnTabClosed();
            }

            if (Journal != null)
            {
                Journal.OnTabClosed();
            }

            TabClosed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 7
0
        protected bool CloseDialog(CloseSource source, bool AskSave)
        {
            if (TabParent.CheckClosingSlaveTabs(this as ITdiTab))
            {
                return(false);
            }

            if (ActiveDialog is ITdiDialog dlg)
            {
                if (AskSave && dlg.HasChanges)
                {
                    string        Message = "Объект изменён. Сохранить изменения перед закрытием?";
                    MessageDialog md      = new MessageDialog((Window)this.Toplevel, DialogFlags.Modal,
                                                              MessageType.Question,
                                                              ButtonsType.YesNo,
                                                              Message);
                    md.AddButton("Отмена", ResponseType.Cancel);
                    int result = md.Run();
                    md.Destroy();
                    if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                    {
                        return(false);
                    }
                    if (result == (int)ResponseType.Yes)
                    {
                        if (!dlg.Save())
                        {
                            logger.Warn("Объект не сохранён. Отмена закрытия...");
                            return(false);
                        }
                    }
                }
            }
            var oldTab = ActiveDialog;

            ActiveDialog.OnTabClosed();
            ActiveDialog = null;
            activeGlgWidget.Destroy();
            (TabParent as TdiNotebook)?.OnSliderTabClosed(this, oldTab, source);
            OnSliderTabChanged();
            return(true);
        }
Esempio n. 8
0
        static async Task CreateDialog(ContentDialog Dialog, bool awaitPreviousDialog)
        {
            if (ActiveDialog != null)
            {
                if (awaitPreviousDialog)
                {
                    await DialogAwaiter.Task;
                    DialogAwaiter = new TaskCompletionSource <bool>();
                }
                else
                {
                    ActiveDialog.Hide();
                }
            }
            ActiveDialog         = Dialog;
            ActiveDialog.Closed += ActiveDialog_Closed;
            await ActiveDialog.ShowAsync();

            ActiveDialog.Closed -= ActiveDialog_Closed;
        }
Esempio n. 9
0
 public override void Draw(IDrawContext context)
 {
     context.Draw(background, Vector2.Zero, Color.White);
     foreach (var wp in WeaponPods)
     {
         wp.Draw(context);
     }
     foreach (var wave in Waves)
     {
         wave.Draw(context);
     }
     if (Globals.ShowPaths)
     {
         foreach (var path in settings.Paths)
         {
             DrawPath(context, path);
         }
     }
     DrawHeader(context);
     ActiveDialog?.Draw(context);
     base.Draw(context);
 }
Esempio n. 10
0
            /// <summary>
            /// Set the index of a current dialog session. This dialog should be either the previous or next dialog
            /// from the last one (index wise) and the player must be in a dialog.
            /// </summary>
            ///
            /// <param name="target">The target merchant.</param>
            /// <param name="pursuitId">A dialog sequence (pursuit) ID.</param>
            /// <param name="newIndex">The index to which we are navigating.</param>
            /// <returns></returns>

            public bool SetDialogIndex(VisibleObject target, int pursuitId, int newIndex)
            {
                // Sanity checking
                if (target != null && (target != Associate || pursuitId != CurrentPursuitId ||
                                       target.Map.Id != User.Map.Id || !InDialog))
                {
                    Log.Error("{Username}: Failed dialog sanity check: target {target}, current pursuit {cpid}, pursuit {pid}, index {index}, target map {targetmap}, user map {usermap}, indialog {dialog}",
                              User.Name, target.Name, CurrentPursuitId, pursuitId, newIndex, target.Map.Id, User.Map.Id, InDialog);
                    return(false);
                }

                if (target == null && pursuitId > Constants.DIALOG_SEQUENCE_SHARED)
                {
                    Log.Error("{Username}: dialog associate is null but pursuitId is associate-specific");
                    return(false);
                }

                if (newIndex == (ActiveDialog.Index + 1) &&
                    newIndex != ActiveDialogSequence.Dialogs.Count() &&
                    newIndex < (ActiveDialogSequence.Dialogs.Count()))
                {
                    // Next
                    Log.Debug("Advancing one dialog");
                    ActiveDialog = ActiveDialogSequence.Dialogs[ActiveDialog.Index + 1];
                    Log.Debug("Active dialog is type {Type}", ActiveDialog.GetType());
                    return(true);
                }
                else if (newIndex == (ActiveDialog.Index - 1) &&
                         newIndex >= 0)
                {
                    // Previous
                    Log.Debug("Rewinding one dialog");
                    ActiveDialog = ActiveDialogSequence.Dialogs[ActiveDialog.Index - 1];
                    return(true);
                }

                return(false);
            }
Esempio n. 11
0
 public void Show()
 {
     ActiveDialog.Show();
 }
Esempio n. 12
0
 public void RunCallback(User target, VisibleObject associate)
 {
     ActiveDialog.RunCallback(target, associate);
 }
Esempio n. 13
0
 public void StartDialog(object src, Tokenizer tok, string name)
 {
     ActiveDialog.StartDialog(src, tok, name);
 }
Esempio n. 14
0
 public void ContinueDialog(object src, Tokenizer tok, string name)
 {
     ActiveDialog.ContinueDialog(src, tok, name);
 }
Esempio n. 15
0
 public void Show(Command.Exec e)
 {
     ActiveDialog.Show();
 }
Esempio n. 16
0
 void OnCommanderError(List <ParseError> errors)
 {
     ActiveDialog.ShowErrors(errors);
 }
Esempio n. 17
0
 public void Done(Command.Exec e)
 {
     ActiveDialog.Done();
 }
Esempio n. 18
0
 public void Hide(Command.Exec e)
 {
     ActiveDialog.Hide();
 }
Esempio n. 19
0
 public void ContinueDialog(Command.Exec e)
 {
     ActiveDialog.ContinueDialog(e.src, e.tok, e.tok.GetStr(1));
 }
Esempio n. 20
0
 public void StartDialog(Command.Exec e)
 {
     ActiveDialog.StartDialog(e.src, e.tok, e.tok.GetStr(1));
 }
Esempio n. 21
0
 public bool CompareHashName(string hashName)
 {
     return((Journal != null ? Journal.CompareHashName(hashName) : false) ||
            (ActiveDialog != null ? ActiveDialog.CompareHashName(hashName) : false));
 }
Esempio n. 22
0
 public void Hide()
 {
     ActiveDialog.Hide();
 }
Esempio n. 23
0
 public void Done()
 {
     ActiveDialog.Done();
 }