Exemplo n.º 1
0
        public DialogResult ShowDialog(string title, IDialogViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            var window = new DialogWindow
            {
                Title       = title,
                Owner       = Application.Current.MainWindow,
                DataContext = viewModel
            };

            try
            {
                DialogShown?.Invoke(this, EventArgs.Empty);
                window.ShowDialog();
                viewModel.Close(window.Result);
            }
            finally
            {
                DialogClosed?.Invoke(this, EventArgs.Empty);
            }

            return(window.Result);
        }
Exemplo n.º 2
0
 public void HideDialog(object Result)
 {
     HideDialogAnimation(PopUpDialogLayout, PopUpBgLayout);
     DialogClosed?.Invoke(null, new PopupClosedEventArgs()
     {
         result = Result
     });
 }
Exemplo n.º 3
0
 private void ContainerClosed(object sender, EventArgs e)
 {
     if (sender is IDialog dialog)
     {
         MinimizedDialogs.RemoveIfExists(dialog);
         ActiveDialogs.RemoveIfExists(dialog);
         DialogClosed?.Invoke(this, dialog);
     }
 }
Exemplo n.º 4
0
        private void GetResultAndCloseDialog()
        {
            if (!ResultFilename.EndsWith("." + FileFilter))
            {
                ResultFilename = ResultFilename + "." + FileFilter.ToLower();
            }

            Result = System.Windows.Forms.DialogResult.OK;
            DialogClosed?.Invoke(this);
        }
Exemplo n.º 5
0
        public void CancelDialog()
        {
            // Trigger the dialog close event, passing a success argument
            // to any subscribers that indicates it was canceled
            DialogClosedEventArgs dialogArgs = new DialogClosedEventArgs
            {
                Success = false
            };

            DialogClosed.Invoke(this, dialogArgs);

            mainCanvasGroup.interactable = true;
            Destroy(gameObject);
        }
        public void CloseDialogSuccess()
        {
            Reestr.Customer   = SelectedCustomer;
            Reestr.CustomerId = SelectedCustomer.Id;

            var model = new ModelDialogParameter <Reestr>
            {
                IsSuccess = true,
                Value     = Reestr
            };

            DialogClosed?.Invoke(model);
            _modalNavigationStore.Close();
        }
Exemplo n.º 7
0
        private async Task OKExecAsync()
        {
            IsAuthorizing = true;

            App.Cloud = new GoogleDriveStorage(Username);
            if (await App.Cloud.Connect())
            {
                await App.Local.Initialize();

                await App.Local.InsertUsername(Username);

                DialogClosed?.Invoke(this);
            }
            else
            {
                ErrorMessage = $"Google Drive authorization failed for { Username }.";
            }

            IsAuthorizing = false;
        }
Exemplo n.º 8
0
 public void Close()
 {
     if (Parent != null)
     {
         var parentPanel = (Panel)Parent;
         if (contentControl.Content is IDisposable disposable)
         {
             disposable.Dispose();
         }
         foreach (FrameworkElement element in parentPanel.Children)
         {
             if (!_tempDisabledElements.Contains(element))
             {
                 element.IsEnabled = true;
             }
         }
         parentPanel.Children.Remove(this);
         Closed?.Invoke(this, new RoutedEventArgs());
         DialogClosed?.Invoke(this, new EventsArgs <object>(contentControl.Content));
     }
 }
Exemplo n.º 9
0
        private async void ExecuteSubmitCommand()
        {
            ReestrSetting.RecipeId      = SelectedRecipe.Id;
            ReestrSetting.CurrentRecipe = SelectedRecipe;
            ReestrSetting.Customer      = SelectedCustomer;
            ReestrSetting.CustomerId    = SelectedCustomer.Id;
            if (ReestrSetting.Id == 0)
            {
                await _reestrSettingDataService.CreateReestrSetting(ReestrSetting);
            }
            else
            {
                await _reestrSettingDataService.UpdateReestrSetting(ReestrSetting);
            }

            var result = new ModelDialogParameter <ReestrSetting>
            {
                IsSuccess = true,
                Value     = (ReestrSetting)ReestrSetting.Clone()
            };

            _modalNavigationStore.Close();
            DialogClosed?.Invoke(result);
        }
Exemplo n.º 10
0
 void OnDialogClosed(object sender, EventArgs e)
 {
     DialogClosed?.Invoke(this, e);
 }
Exemplo n.º 11
0
 public void OnDialogClosed(string path)
 {
     DialogClosed?.Invoke(null, new FileDialogClosedEventArgs(path));
 }
Exemplo n.º 12
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            //get the selected name from shared preference
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
            var Name = prefs.GetString("SelectedName", "");

            var      view         = Activity.LayoutInflater.Inflate(Resource.Layout.TrainingNominateDialog, null);
            TextView tvMessage    = view.FindViewById <TextView>(Resource.Id.textView2);
            TextView tvwResultMsg = Activity.FindViewById <TextView>(Resource.Id.tvwMsgTrnReq);

            AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
            alert.SetTitle("Confirm selection");

            string Message = "are you nominating " + Name + " for the training?";

            //alert.SetMessage(Message);
            tvMessage.Text = Message;

            string uri = Values.ApiRootAddress + "training/SaveNominee";

            alert.SetPositiveButton("Nominate", async(senderAlert, args) =>
            {
                AppPreferences appPrefs = new AppPreferences();
                var NominateUser        = new FormUrlEncodedContent(new Dictionary <string, string>
                {
                    { "CompanyCode", appPrefs.GetValue(User.CompId) },                  // "CO000001",
                    { "TrainingCode", prefs.GetString("TrainingCode", "") },
                    { "TrainingSerialNo", prefs.GetInt("TrainingSerialNo", 0) + "" },   // 1,
                    { "NomineeEmployeeNo", prefs.GetInt("NomineeEmployeeNo", 0) + "" }, //43,
                    { "ReqEmployeeNo", appPrefs.GetValue(User.EmployeeNo) },            // 694,
                    { "Reason", view.FindViewById <EditText>(Resource.Id.edtTxtReason).Text },
                    { "Username", appPrefs.GetValue(User.UserId) }
                });

                tvwResultMsg.Text = Values.WaitingMsg;
                dynamic json      = await new DataApi().PostAsync(uri, NominateUser);
                tvwResultMsg.Text = "";
                if (DataApi.IsJsonObject(json))
                {
                    if (json != null)
                    {
                        if (json["status"] == 0)
                        {
                            DialogClosed?.Invoke(this, true);
                            tvwResultMsg.SuccessMsg((string)json["message"]);
                        }
                        else
                        {
                            tvwResultMsg.ErrorMsg((string)json["message"]);
                        }
                        //Toast.MakeText(new Activity(), json["message"].ToString(), ToastLength.Short).Show();
                    }
                }
                else
                {
                    tvwResultMsg.ErrorMsg((string)json);
                }
                Dismiss();
            });

            alert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                Dismiss();
                //Toast.MakeText(Activity, "Cancelled!", ToastLength.Short).Show();
            });

            alert.SetView(view);
            return(alert.Create());
        }
Exemplo n.º 13
0
 public override void OnDismiss(IDialogInterface dialog)
 {
     base.OnDismiss(dialog);
     DialogClosed?.Invoke(this, null);
 }
Exemplo n.º 14
0
 private Task CancelActivityDeletionCommandExecution(object parameter)
 {
     DialogClosed?.Invoke();
     return(Task.CompletedTask);
 }
Exemplo n.º 15
0
 protected virtual void OnDialogClosed(FilePickerClosedEventArgs e)
 {
     DialogClosed?.Invoke(this, e);
 }