Esempio 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);
        }
Esempio n. 2
0
 public void HideDialog(object Result)
 {
     HideDialogAnimation(PopUpDialogLayout, PopUpBgLayout);
     DialogClosed?.Invoke(null, new PopupClosedEventArgs()
     {
         result = Result
     });
 }
Esempio 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);
     }
 }
Esempio n. 4
0
        private void GetResultAndCloseDialog()
        {
            if (!ResultFilename.EndsWith("." + FileFilter))
            {
                ResultFilename = ResultFilename + "." + FileFilter.ToLower();
            }

            Result = System.Windows.Forms.DialogResult.OK;
            DialogClosed?.Invoke(this);
        }
Esempio 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();
        }
Esempio 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;
        }
Esempio 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));
     }
 }
Esempio 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);
        }
Esempio n. 10
0
 void OnDialogClosed(object sender, EventArgs e)
 {
     DialogClosed?.Invoke(this, e);
 }
Esempio n. 11
0
 public void OnDialogClosed(string path)
 {
     DialogClosed?.Invoke(null, new FileDialogClosedEventArgs(path));
 }
Esempio 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());
        }
Esempio n. 13
0
 public override void OnDismiss(IDialogInterface dialog)
 {
     base.OnDismiss(dialog);
     DialogClosed?.Invoke(this, null);
 }
Esempio n. 14
0
 private Task CancelActivityDeletionCommandExecution(object parameter)
 {
     DialogClosed?.Invoke();
     return(Task.CompletedTask);
 }
Esempio n. 15
0
 protected virtual void OnDialogClosed(FilePickerClosedEventArgs e)
 {
     DialogClosed?.Invoke(this, e);
 }