Пример #1
0
 public DialogViewModel(string title, string message)
 {
     Title         = title;
     Message       = message;
     OkCommand     = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestEventArgs(true)));
     CancelCommand = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestEventArgs(false)));
 }
Пример #2
0
        public void AddPerson(object o)
        {
            IPerson person = m_personFactory.CreatePerson(Name, Address, Phone, IsActive);

            AddedPersonViewModel = m_personFactory.CreatePersonViewModel(person);
            CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true));
        }
 public UnitImportWindowViewModel(BattleInputViewModel battleInputViewModel)
 {
     _battleInputViewModel = battleInputViewModel;
     ResetCommand          = new RelayCommand(ResetWindow);
     SaveCommand           = new RelayCommand(SendToBattleInput);
     CloseCommand          = new RelayCommand(() => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
 }
Пример #4
0
        public YieldSelectorViewModel()
        {
            OkCommand     = new RelayCommand(P => CloseRequested?.Invoke(this, new DialogCloseRequestEventArgs(true)));
            CancelCommand = new RelayCommand(P => CloseRequested?.Invoke(this, new DialogCloseRequestEventArgs(false)));

            _minYield = 1.00;
        }
 void Ribbon_ExitClicked()
 {
     if (CloseRequested != null)
     {
         CloseRequested.Invoke();
     }
 }
 public CustomMessageBoxViewModel(string message, Icon icon)
 {
     Message         = message;
     recievedIcon    = icon;
     ImageVisibility = (recievedIcon == null) ? Visibility.Collapsed : Visibility.Visible;
     OkCommand       = new DelegateCommand(() => CloseRequested?.Invoke(this, new DialogCloseArgs(true)));
 }
        public PositionListViewModel(IDialogService dialogService, PositionListFacade positionList)
        {
            this.dialogService = dialogService;
            this.positionList  = positionList;
            positionList.LoadPositionList();
            Name = "Position List";

            #region Command Initialization
            CloseCommand            = new ActionCommand(p => CloseRequested?.Invoke(this, EventArgs.Empty));
            AddPositionCommand      = new ActionCommand(p => AddPosition());
            DeletePositionCommand   = new ActionCommand(p => DeletePosition());
            EditPositionCommand     = new ActionCommand(p => EditPosition());
            AddSizeCommand          = new ActionCommand(p => AddSize());
            DeleteSizeCommand       = new ActionCommand(p => DeleteSize());
            EditSizeCommand         = new ActionCommand(p => EditSize());
            AddIngredientCommand    = new ActionCommand(p => AddIngredient());
            DeleteIngredientCommand = new ActionCommand(p => DeleteIngredient());
            #endregion

            dataGridController = new DataGridController(positionList);

            #region Observable Collections Initialization
            Positions = new ObservableCollection <Position>();
            Sizes     = new ObservableCollection <Size>();
            #endregion
        }
Пример #8
0
        public LoadingTabPage(string tabTitle, DrawingBrush iconDrawingBrush, LoadingOperation operation)
        {
            _operation       = operation;
            HeaderText       = tabTitle;
            IconDrawingBrush = iconDrawingBrush;

            CancelCommand = new DelegateCommand(Close);

            operation.Completed += page =>
            {
                if (page == null)
                {
                    Close();
                    return;
                }

                Page = page;
                OnPropertyChanged(nameof(Page));
                HeaderText = page.HeaderText;
                OnPropertyChanged(nameof(HeaderText));
                IconDrawingBrush = page.IconDrawingBrush;
                OnPropertyChanged(nameof(IconDrawingBrush));
            };

            void Close()
            {
                operation.Cancel();
                CloseRequested?.Invoke();
            }
        }
Пример #9
0
 protected override void InitializeCommands()
 {
     CloseCommand = new DelegateCommand <object>(result =>
     {
         CloseRequested?.Invoke(this, result);
     });
 }
        public void SaveAccount()
        {
            AccountModel account = new AccountModel(UserName, Password, SiteName);

            //by design no validation as we will allow users to save empty rows.
            CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true, account));
        }
        public YesCancelDialogViewModel(ViewModelBase viewModelBase, string message)
        {
            _viewModelBase = viewModelBase;

            Message       = message;
            OkCommand     = new ActionCommand(_viewModelBase, p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)));
            CancelCommand = new ActionCommand(_viewModelBase, p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
        }
Пример #12
0
 private void OnInputPromptModelPromptCanceled(object id)
 {
     if (id == Id)
     {
         _selfProvider.GetInstance().PromptCanceled -= OnInputPromptModelPromptCanceled;
         ThreadUtils.RunInUiAsync(() => CloseRequested?.Invoke());
     }
 }
 public void ConfirmEditPerson(object o)
 {
     m_personViewModel.Name     = Name;
     m_personViewModel.Address  = Address;
     m_personViewModel.Phone    = Phone;
     m_personViewModel.IsActive = IsActive;
     CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true));
 }
Пример #14
0
        public PlayerInfoViewModel(Player currentPlayer)
        {
            CurrentPlayer = currentPlayer;

            CommandOk     = new RelayCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)), null);
            CommandCancel = new RelayCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)), null);
            //CommandCancel = new RelayCommand(CancelExecute, null);
        }
Пример #15
0
 public void RequestCloseForm(bool closeSesion = false)
 {
     TB_UserName.Text        = "";
     PB_Contraseña.Password  = "";
     TB_NUserName.Text       = "";
     PB_NContraseña.Password = "";
     CloseRequested?.Invoke(closeSesion);
 }
Пример #16
0
 public DialogViewModel(string message, string yes, string cancel)
 {
     Message       = message;
     YesText       = yes;
     CancelText    = cancel;
     TitleText     = "Confirm Action";
     OkCommand     = new RelayCommand(() => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)));
     CancelCommand = new RelayCommand(() => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
 }
Пример #17
0
 private void OkCommandExecute(object obj)
 {
     room.Number  = Number;
     room.Price   = Price;
     room.Type    = RoomType;
     room.Subtype = RoomSubtype;
     room.Size    = Size;
     CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true));
 }
Пример #18
0
 protected void Close(bool result)
 {
     Dispatcher?.CheckBeginInvokeOnUI(() =>
     {
         CloseRequested?.Invoke(this, result
                                 ? CloseEventArgs.Ok
                                 : CloseEventArgs.Cancel);
     });
 }
 public DyntaxaMatchingDialogViewModel(string message, string searchText, TaxonNameList search) : base(message)
 {
     SearchText = searchText;
     Result     = new ObservableCollection <Plankton>();
     this.UpdateCollection(search);
     this.SearchCommand = new RelayCommand(Search);
     this.OkCommand     = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)), param => this.canExecute);
     this.CancelCommand = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
 }
Пример #20
0
 private void CloseForm()
 {
     if (!EditandoTrans)
     {
         ResetTransaccionForm();
         CB_Tipo.SelectedIndex = -1;
     }
     CheckTipo();
     CloseRequested?.Invoke(parameters);
 }
Пример #21
0
        public ReportHoaDonViewModel(string maHD, string maKH)
        {
            idRequest = 1; // Report hóa đơn
            this.maHD = maHD;
            this.maKH = maKH;

            PayCommand = new ActionCommand(p => ahihi());

            SaveCommand   = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)));
            CancelCommand = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
        }
        public PaymentConditionViewModel(PaymentConditionSet paymentConditionSet, IUnityContainer container)
        {
            _unitOfWork             = container.Resolve <IUnitOfWork>();
            PaymentConditionWrapper = new PaymentConditionWrapper2(paymentConditionSet)
            {
                Part = 1.0 - paymentConditionSet.PaymentConditions.Sum(condition => condition.Part),
                PaymentConditionPoint = new PaymentConditionPointWrapper(_unitOfWork.Repository <PaymentConditionPoint>().GetAll().First())
            };

            OkCommand = new DelegateLogCommand(
                () =>
            {
                PaymentCondition paymentCondition = this.PaymentConditionWrapper.Model;

                //если условие новое
                if (_unitOfWork.Repository <PaymentCondition>()
                    .Find(condition => Equals(condition, paymentCondition))
                    .Any() == false)
                {
                    if (_unitOfWork.SaveEntity(paymentCondition).OperationCompletedSuccessfully)
                    {
                        this.PaymentConditionWrapper.AcceptChanges();
                        container.Resolve <IEventAggregator>().GetEvent <AfterSavePaymentConditionEvent>().Publish(paymentCondition);
                    }
                    else
                    {
                        return;
                    }
                }

                IsOk = true;
                CloseRequested?.Invoke(this, new DialogRequestCloseEventArgs(true));
            },
                () => PaymentConditionWrapper.IsValid && PaymentConditionWrapper.IsChanged);

            PaymentConditionWrapper.PropertyChanged += (sender, args) => OkCommand.RaiseCanExecuteChanged();

            SelectPaymentConditionPointCommand = new DelegateLogCommand(
                () =>
            {
                ISelectService selectService = container.Resolve <ISelectService>();
                PaymentConditionPoint point  = selectService.SelectItem(_unitOfWork.Repository <PaymentConditionPoint>().GetAll());
                if (point != null)
                {
                    this.PaymentConditionWrapper.PaymentConditionPoint = new PaymentConditionPointWrapper(point);
                }
            });

            ClearPaymentConditionPointCommand = new DelegateLogCommand(
                () =>
            {
                this.PaymentConditionWrapper.PaymentConditionPoint = null;
            });
        }
Пример #23
0
        public UserInfoDialogViewModel(MainTesterViewModel procedure)
        {
            _name = procedure.Name ?? String.Empty;
            _softwareLoadVersion = procedure.SoftwareLoadVersion ?? String.Empty;
            _programPhase        = procedure.ProgramPhase ?? String.Empty;
            _programType         = procedure.ProgramType ?? String.Empty;
            _classification      = procedure.Classification ?? String.Empty;

            SubmitCommand = new RelayCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)));
            CancelCommand = new RelayCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
        }
Пример #24
0
        private void CloseExecute()
        {
            if (Closed)
            {
                return;
            }

            Closed = true;
            ClosedCallback?.Invoke(this);
            CloseRequested?.Invoke(this, EventArgs.Empty);
        }
Пример #25
0
        /// <summary>
        /// Call this method to dismiss the dialog.
        /// The <see cref="Services.IDialogService" />
        /// implementation dismisses the dialog immediately.
        /// </summary>
        /// <param name="e">An optional event args object,
        /// which may be used to convey information to the
        /// <see cref="Services.IDialogService" /> implementation</param>
        public virtual void Close(EventArgs e = null)
        {
            CloseCalled = true;

            var synchronizationContext = Dependency.Resolve <ISynchronizationContext>();

            synchronizationContext.Send(() =>
            {
                CloseRequested?.Invoke(this, e ?? EventArgs.Empty);
            });
        }
Пример #26
0
        public ReportHoaDonViewModel(string maNV, int thang, int nam)
        {
            idRequest  = 2;
            this.maNV  = maNV;
            this.thang = thang;
            this.nam   = nam;

            PayCommand    = new ActionCommand(p => ahihi());
            SaveCommand   = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true)));
            CancelCommand = new ActionCommand(p => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
        }
Пример #27
0
 // TAB CLOSING COMMAND RELATED METHODS
 private void CloseTab()
 {
     if (ClosingAction())
     {
         CloseRequested?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         return;
     }
 }
Пример #28
0
        public AddBookingDialogWindowModel(DateTime dateTime, Booking booking, IHotelSystem hotel, int roomId)
        {
            Booking     = booking;
            this.hotel  = hotel;
            this.roomId = roomId;
            InDate      = dateTime;
            OutDate     = InDate.AddDays(1);

            OkCommand     = new RelayCommand(OkCommandExecute, CanOkCommandExecute);
            CancelCommand = new RelayCommand(o => CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(false)));
        }
 void Ribbon_RepackClicked()
 {
     lock (multiBoard)
     {
         Repack r = new Repack();
         r.ShowDialog();
     }
     if (Program.Restarting && CloseRequested != null)
     {
         CloseRequested.Invoke();
     }
 }
Пример #30
0
        /// <summary>
        /// Creates and initializes a new instance of the Window class.
        /// </summary>
        /// <param name="parent">
        /// Parent widget which this window is created on.
        /// </param>
        /// <param name="name">
        /// Window name.
        /// </param>
        /// <param name="type">
        /// Window type.
        /// </param>
        /// <remarks>
        /// Window constructor.show window indicator, set callback
        /// when closing the window in any way outside the program control,
        /// and set callback when window rotation is changed.
        /// </remarks>
        /// <since_tizen> preview </since_tizen>
        public Window(Window parent, string name, WindowType type)
        {
            Name = name;
            Type = type;
            Realize(parent);
            IndicatorMode = IndicatorMode.Show;

            _deleteRequest       = new SmartEvent(this, "delete,request");
            _rotationChanged     = new SmartEvent(this, "wm,rotation,changed");
            _deleteRequest.On   += (s, e) => CloseRequested?.Invoke(this, EventArgs.Empty);
            _rotationChanged.On += (s, e) => RotationChanged?.Invoke(this, EventArgs.Empty);
        }