コード例 #1
0
 protected void OnAbortCommand()
 {
     RequestClose?.Invoke(new DialogParameters()
     {
         { "Result", false }
     });
 }
コード例 #2
0
        private void OKButtonExecute()
        {
            //MessageBox.Show("Save 합니다.");

            //var message = new DialogParameters();
            //message.Add(nameof(MessageBoxViewModel.Message), "저장합니다");
            //_dialogService.ShowDialog(nameof(MessageBoxView), message, null);



            if (_messageService.Question("저장 합니까?") == MessageBoxResult.OK)
            {
                _messageService.ShowDialog("저장 했습니다");
            }


            var p = new DialogParameters();

            p.Add(nameof(ViewCTextBox), ViewCTextBox);

            /* -------------------------------------------------------------
            *  IDialogAware에 정의 되어 있는 RequestClose를 Invoke하면 화면이
            *  닫치고 DialogResult와 파리미터가 호출처의 콜벡함수에 통지된다.
            *  ------------------------------------------------------------- */
            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
        }
コード例 #3
0
 private void CloseDialog(ButtonResult result)
 {
     if (RequestClose != null)
     {
         RequestClose.Invoke(new DialogResult(result));
     }
 }
コード例 #4
0
        /// <summary>
        /// Method to be executed when user (or program) tries to close the application
        /// </summary>
        public void OnRequestClose()
        {
            try
            {
                if (_ShutDownInProgress)
                {
                    return;
                }

                if (DialogCloseResult == null)
                {
                    DialogCloseResult = true;      // Execute Close event via attached property
                }
                ////if (_ShutDownInProgressCancel)
                ////{
                ////    _ShutDownInProgress = false;
                ////    _ShutDownInProgressCancel = false;
                ////    DialogCloseResult = null;
                ////}
                ////else
                {
                    _ShutDownInProgress = true;

                    CommandManager.InvalidateRequerySuggested();
                    RequestClose?.Invoke(this, EventArgs.Empty);
                }
            }
            catch { }
        }
コード例 #5
0
 protected void OnAddDrugCommand()
 {
     RequestClose?.Invoke(new DialogParameters()
     {
         { "Result", true }
     });
 }
コード例 #6
0
        /// <summary>Checks if it is OK to close all current document.  Returns false to cancel</summary>
        public static bool DoRequestClose()
        {
            CancelEventArgs e = new CancelEventArgs();

            RequestClose?.Invoke(e);
            return(!e.Cancel);
        }
コード例 #7
0
        private void OKButtonExecute()
        {
            var p = new DialogParameters();

            p.Add(nameof(ViewBTextBox), ViewBTextBox);
            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
        }
コード例 #8
0
        public SettingsViewModel()
        {
            AddCommand = new DelegateCommand(() =>
            {
                var fbd = new System.Windows.Forms.FolderBrowserDialog();
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Pathlist.Add(fbd.SelectedPath);
                }
            });

            RemoveCommand = new DelegateCommand(() =>
            {
                Pathlist.RemoveAt(SelectedPathIndex);
            });

            ReplaceCommand = new DelegateCommand(() =>
            {
                var fbd = new System.Windows.Forms.FolderBrowserDialog();
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Pathlist[SelectedPathIndex] = fbd.SelectedPath;
                }
            });

            OkCommand = new DelegateCommand(() =>
            {
                FileLocator.Pathlist = Pathlist.ToList();
                FileLocator.SaveConfiguration();
                RequestClose.Invoke(new DialogResult(ButtonResult.OK));
            });

            Pathlist = new ObservableCollection <string>(FileLocator.Pathlist);
        }
コード例 #9
0
        private void OnSignActivity()
        {
            var dialogParams = new DialogParameters();

            dialogParams.Add(NavigationParameterKeys._IsActivitySigned, true);
            RequestClose.Invoke(dialogParams);
        }
コード例 #10
0
ファイル: DialogViewModel.cs プロジェクト: hamtube9/CafeHouse
        private void AddReview()
        {
            ReviewItem         = new Reviews();
            ReviewItem.Rate    = Rate;
            ReviewItem.Avatar  = "dragonGray.png";
            ReviewItem.Content = Content;
            var listItem = new List <ImageReview>();

            foreach (var item in ListImage)
            {
                listItem.Add(new ImageReview()
                {
                    ImageContent = item
                });
            }
            ReviewItem.ListImage = listItem;
            var navigationParams = new DialogParameters();

            navigationParams.Add("reviews", ReviewItem);

            RequestClose.Invoke(navigationParams);
            ListImage.Clear();
            IsInvisible = false;
            IsVisible   = false;
        }
コード例 #11
0
        private void msgret(IDialogResult ret)
        {
            var p = new DialogParameters();

            p.Add(nameof(ViewCTextBox), ViewCTextBox);
            RequestClose?.Invoke(new DialogResult(ret.Result, p));
        }
コード例 #12
0
        /// <summary> Konstruktor uruchamiany w celu edycji istniejącego wpisu </summary>
        public AddressEditViewModel(Addresses entity, string connectionString)
        {
            this.idOfEntity                  = entity.id;
            this.CitiesComboBoxContent       = new ObservableCollection <string>();
            this.MonthOfBirthComboBoxContent = new ObservableCollection <string>();
            SetDefaultDateFormat();
            LoadMonthsComboBoxContent();
            LoadCitiesComboBoxContent(connectionString);
            LoadData(entity);

            this.SaveButtonClick = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                try
                {
                    if (this.NameTextBoxContent == null || this.SurnameTextBoxContent == null)
                    {
                        MessageBox.Show("Wypełnij pole z imieniem i nazwiskiem");
                    }
                    else
                    {
                        using (var ctx = new molkomEntities())
                        {
                            SaveEntry();
                            GlobalVariables.refreshMainWindowFlag = 1;
                            RequestClose?.Invoke(this, EventArgs.Empty);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });
        }
コード例 #13
0
        private void SetAnswer(string result)
        {
            Answer = result == "true";
            var answer = Answer ? ButtonResult.OK : ButtonResult.Cancel;

            RequestClose?.Invoke(new DialogResult(answer));
        }
コード例 #14
0
        public MainWindowViewModel(IGoalTrackerService gtService, IWindowService windowService, DateTime displayDate)
        {
            this.gtService     = gtService;
            this.windowService = windowService;

            PreviousMonthCommand = new DelegateCommand(SwitchToPreviousMonth);
            NextMonthCommand     = new DelegateCommand(SwitchToNextMonth);

            NewFileCommand      = new DelegateCommand(NewFile);
            LoadFileCommand     = new DelegateCommand(LoadFile);
            MoveFileCommand     = new DelegateCommand(MoveFile, IsSaveDataLoaded);
            ShowFilePathCommand = new DelegateCommand(RequestShowSaveFilePath);

            AddGoalCommand    = new DelegateCommand(AddGoal, IsSaveDataLoaded);
            RemoveGoalCommand = new DelegateCommand(RemoveGoal, IsSaveDataLoaded);

            ShowEditorCommand = new DelegateCommand(ShowSkinEditor, () => !IsEditorOpen);
            ChangeSkinCommand = new DelegateCommand <string>(skinName => RequestChangeSkin?.Invoke(skinName),
                                                             x => !IsEditorOpen);

            CloseCommand = new DelegateCommand(() => RequestClose?.Invoke());

            DisplayMonth = displayDate;

            PopulateCalendarDaysAndWeeks();
        }
コード例 #15
0
        public FocusedDeviceViewModel(DeviceCollectionViewModel mainViewModel, DeviceViewModel device)
        {
            DisplayName = device.DisplayName;
            Toolbar     = new ObservableCollection <ToolbarItemViewModel>();
            Toolbar.Add(new ToolbarItemViewModel
            {
                GlyphFontSize = 10,
                DisplayName   = Properties.Resources.CloseButtonAccessibleText,
                Glyph         = "\uE8BB",
                Command       = new RelayCommand(() => RequestClose.Invoke())
            });

            if (AddonContentItems != null)
            {
                Addons = new ObservableCollection <object>(AddonContentItems.Select(a => a.GetContentForDevice(device.Id, () => RequestClose.Invoke())).ToArray());
            }

            if (Features.IsEnabled(Feature.Addons) &&
                AddonContextMenuItems != null && AddonContextMenuItems.Any())
            {
                var menuItems = AddonContextMenuItems.SelectMany(a => a.GetItemsForDevice(device.Id));
                Toolbar.Insert(0, new ToolbarItemViewModel
                {
                    GlyphFontSize = 16,
                    DisplayName   = Properties.Resources.MoreCommandsAccessibleText,
                    Glyph         = "\uE10C",
                    Menu          = new ObservableCollection <ContextMenuItem>(menuItems)
                });
            }
        }
コード例 #16
0
 public void OnRequestClose()
 {
     if (OnClosing())
     {
         RequestClose?.Invoke(this, new EventArgs());
     }
 }
コード例 #17
0
        public IndexViewModel(Dispatcher dispatcher)
        {
            Dispatcher = dispatcher;

            GoToDetailsCommand  = new RelayCommand(GoToDetails);
            RequestCloseCommand = new RelayCommand(o => RequestClose?.Invoke(this, EventArgs.Empty));
        }
コード例 #18
0
        public void OnDialogClosed()
        {
            _isStopped = true;  // Stop radio
            _player.Close();    // to avoid a memory leak

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
        }
コード例 #19
0
        /// <summary> Konstruktor uruchamiany w celu dodania nowego wpisu </summary>
        public CityEditViewModel(string connectionString)
        {
            this.SaveButtonClick = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                try
                {
                    if (this.PostalCodeTextBoxContent == null || this.CityNameTextBoxContent == null)
                    {
                        MessageBox.Show("Wypełnij pole z kodem pocztowym i nazwą");
                    }
                    else
                    {
                        using (var ctx = new molkomEntities())
                        {
                            ctx.Cities.Add(GetCityObject());
                            ctx.SaveChanges();
                            GlobalVariables.refreshMainWindowFlag = 1;
                            RequestClose?.Invoke(this, EventArgs.Empty);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });

            SetDefaultDateFormat();
        }
コード例 #20
0
 public virtual void Close()
 {
     if (ProcessedUnsavedChanges() == true)
     {
         RequestClose?.Invoke();
     }
 }
コード例 #21
0
        public void OnDialogClosed()
        {
            var dialogParams = new DialogParameters();

            dialogParams.Add(NavigationParameterKeys._IsActivitySigned, false);
            RequestClose.Invoke(dialogParams);
        }
コード例 #22
0
        private void CloseDialog()
        {
            var parameters = new DialogParameters();

            parameters.Add("Trigger", Trigger);

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, parameters));
        }
コード例 #23
0
        private void SaveAndClose()
        {
            SaveChanges();

            _closeRequested = true;

            RequestClose?.Invoke();
        }
コード例 #24
0
 protected void onRequestClose()
 {
     if (RequestClose == null)
     {
         return;
     }
     RequestClose.Invoke(this, EventArgs.Empty);
 }
コード例 #25
0
 public StartupDialogViewModel()
 {
     Title = "Unclutter - Startup";
     EventAggregator.GetEvent <ProfileSelectedEvent>().Subscribe(p =>
     {
         RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
     });
 }
コード例 #26
0
 public AboutBoxControlViewModel()
 {
     Version   = Assembly.GetExecutingAssembly().GetName().Version;
     OkCommand = new DelegateCommand(() =>
     {
         RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
     });
 }
コード例 #27
0
        public void cc()
        {
            var r = ButtonResult.Cancel;
            var p = new DialogParameters();

            p.Add("param", "Cancel");
            RequestClose?.Invoke(new DialogResult(r, p));
        }
コード例 #28
0
        private void EndGame()
        {
            _gameRepository.FinishGame(GameHeader);
            var result = GameHeader.Qustions.SelectMany(x => x.Question.Answers.Where(y => y.Id == x.UserAnswerId).ToList()).ToList();

            MessageBox.Show($"Poprawne odpowiedzi: {result.Where(x => x.IsCorrect == true).Count()} z {result.Count()}");
            RequestClose.Invoke(this, EventArgs.Empty);
        }
コード例 #29
0
        public void co()
        {
            var r = ButtonResult.OK;
            var p = new DialogParameters();

            p.Add("param", "OK");
            RequestClose?.Invoke(new DialogResult(r, p));
        }
コード例 #30
0
        private void CloseAndSave()
        {
            var p = new DialogParameters();

            p.Add(nameof(EcgVariable), Variable);

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
        }