Beispiel #1
0
        private void ShowBackStep()
        {
            if (CurrentPage >= 1)
            {
                CurrentPage -= 1;
            }

            if (CurrentPage == 0)             // Back to previ view.
            {
                GoBackCommand.Execute();
            }
            else if (CurrentPage == 1)
            {
                View.PanToPage(CurrentPage);
                HightlightStep(true, false, false, false);
            }
            else if (CurrentPage == 2)
            {
                View.PanToPage(CurrentPage);
                HightlightStep(true, true, false, false);
            }
            else if (CurrentPage == 3)
            {
                View.PanToPage(CurrentPage);
                HightlightStep(true, true, true, false);
            }
        }
 private void OnNavigated(object sender, NavigationEventArgs e)
 {
     ShowSettingsCommand.RaiseCanExecuteChanged();
     NavigateCommand.RaiseCanExecuteChanged();
     GoBackCommand.RaiseCanExecuteChanged();
     RaisePropertyChanged("CanGoBack");
 }
 public EditLicensViewModel()
 {
     Shared           = StaticClassSingleton.Instance;
     GoBackBtn        = new GoBackCommand();
     SaveChangesBtn   = new ExecuteAndNavigateBackCommand(SaveChanges);
     _originalLicense = Shared.SelectedLicens;
 }
Beispiel #4
0
        /// <summary>
        ///     当此页处于活动状态并占用整个窗口时,在每次鼠标单击、触摸屏点击
        ///     或执行等效交互时调用。    用于检测浏览器样式下一页和
        ///     上一步鼠标按钮单击以在页之间导航。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件数据。</param>
        private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender,
                                               PointerEventArgs e)
        {
            PointerPointProperties properties = e.CurrentPoint.Properties;

            // 忽略与鼠标左键、右键和中键的键关联
            if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||
                properties.IsMiddleButtonPressed)
            {
                return;
            }

            // 如果按下后退或前进(但不是同时),则进行相应导航
            bool backPressed    = properties.IsXButton1Pressed;
            bool forwardPressed = properties.IsXButton2Pressed;

            if (backPressed ^ forwardPressed)
            {
                e.Handled = true;
                if (backPressed)
                {
                    GoBackCommand.Execute(null);
                }
                if (forwardPressed)
                {
                    GoForwardCommand.Execute(null);
                }
            }
        }
        public async Task Initialize(GroupVm group)
        {
            if (group == null)
            {
                return;
            }

            GoBackCommand.RaiseCanExecuteChanged();
            ParentGroupName = group.Title;
            ParentGroupIcon = group.Icon;

            BreadcrumbItems.Add(new BreadcrumbItem {
                Path = group.Id, Name = group.Title, Icon = group.Icon
            });
            var parentGroup = group;

            while (!string.IsNullOrEmpty(parentGroup.ParentGroupId))
            {
                parentGroup = await _mediator.Send(new GetGroupQuery { Id = parentGroup.ParentGroupId });

                BreadcrumbItems.Add(new BreadcrumbItem {
                    Path = parentGroup.Id, Name = parentGroup.Title, Icon = parentGroup.Icon
                });
            }
        }
Beispiel #6
0
 public CustomersViewModel()
 {
     GoBack           = new GoBackCommand();
     NewCustomerBtn   = new GoToPageCommand("AddCustomer");
     Shared           = StaticClassSingleton.Instance;
     SelectedCustomer = null;
 }
        /// <summary>
        /// Supprimer une note
        /// </summary>
        public void DeleteNote()
        {
            DataServiceNote dsNote = new DataServiceNote();

            dsNote.DeleteNote(Note);
            GoBackCommand.Execute(null);
        }
Beispiel #8
0
 public EditSupplierViewModel()
 {
     Shared    = StaticClassSingleton.Instance;
     EditBtn   = new RelayCommand(EditMethod);
     _name     = Shared.SelectedLicensSupplier.Name;
     GoBackBtn = new GoBackCommand();
 }
Beispiel #9
0
        /// <summary>
        /// Invoked on every keystroke, including system keys such as Alt key combinations, when
        /// this page is active and occupies the entire window.  Used to detect keyboard navigation
        /// between pages even when the page itself doesn't have focus.
        /// </summary>
        /// <param name="sender">Instance that triggered the event.</param>
        /// <param name="e">Event data describing the conditions that led to the event.</param>
        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
        {
            VirtualKey virtualKey = e.VirtualKey;

            // Only investigate further when Left, Right, or the dedicated Previous or Next keys
            // are pressed
            if ((e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
                 e.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
                (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right ||
                 (int)virtualKey == 166 || (int)virtualKey == 167))
            {
                CoreWindow           coreWindow = Window.Current.CoreWindow;
                CoreVirtualKeyStates downState  = CoreVirtualKeyStates.Down;
                bool menuKey     = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                bool controlKey  = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                bool shiftKey    = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
                bool noModifiers = !menuKey && !controlKey && !shiftKey;
                bool onlyAlt     = menuKey && !controlKey && !shiftKey;

                if (((int)virtualKey == 166 && noModifiers) ||
                    (virtualKey == VirtualKey.Left && onlyAlt))
                {
                    // When the previous key or Alt+Left are pressed navigate back
                    e.Handled = true;
                    GoBackCommand.Execute(null);
                }
                else if (((int)virtualKey == 167 && noModifiers) ||
                         (virtualKey == VirtualKey.Right && onlyAlt))
                {
                    // When the next key or Alt+Right are pressed navigate forward
                    e.Handled = true;
                    GoForwardCommand.Execute(null);
                }
            }
        }
Beispiel #10
0
        protected override Task OnInitialise()
        {
            return(Task.Factory
                   .StartNew(() =>
            {
                var steps = GetSteps();

                var index = 0;
                foreach (var step in steps)
                {
                    step.Context = Context;
                    step.Ordinal = index;

                    this.SyncViewModelActivationStates(step).AddDisposable(Disposables);
                    this.SyncViewModelBusy(step).AddDisposable(Disposables);

                    _steps.Add(step);

                    index++;
                }

                CurrentStep = _steps.First();

                GoBackCommand.RaiseCanExecuteChanged();
                GoForwardCommand.RaiseCanExecuteChanged();
            }, Scheduler.Task.TPL));
        }
        private void CoreWindowOnPointerPressed(CoreWindow sender, PointerEventArgs args)
        {
            var properties = args.CurrentPoint.Properties;

            if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||
                properties.IsMiddleButtonPressed)
            {
                return;
            }

            var backPressed    = properties.IsXButton1Pressed;
            var forwardPressed = properties.IsXButton2Pressed;

            if (backPressed ^ forwardPressed)
            {
                args.Handled = true;
                if (backPressed)
                {
                    GoBackCommand.Execute(null);
                }
                if (forwardPressed)
                {
                    GoForwardCommand.Execute(null);
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Invoked on every mouse click, touch screen tap, or equivalent interaction when this
        /// page is active and occupies the entire window.  Used to detect browser-style next and
        /// previous mouse button clicks to navigate between pages.
        /// </summary>
        /// <param name="sender">Instance that triggered the event.</param>
        /// <param name="e">Event data describing the conditions that led to the event.</param>
        private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e)
        {
            PointerPointProperties properties = e.CurrentPoint.Properties;

            // Ignore button chords with the left, right, and middle buttons
            if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||
                properties.IsMiddleButtonPressed)
            {
                return;
            }

            // If back or foward are pressed (but not both) navigate appropriately
            bool backPressed    = properties.IsXButton1Pressed;
            bool forwardPressed = properties.IsXButton2Pressed;

            if (backPressed ^ forwardPressed)
            {
                e.Handled = true;
                if (backPressed)
                {
                    GoBackCommand.Execute(null);
                }
                if (forwardPressed)
                {
                    GoForwardCommand.Execute(null);
                }
            }
        }
 public EditLicensViewModel()
 {
     Shared          = StaticClassSingleton.Instance;
     GoBackBtn       = new GoBackCommand();
     ChanceBtn       = new RelayCommand(Change);
     _originalLicens = Shared.SelectedLicens;
 }
Beispiel #14
0
        private void GoBackInViewModels()
        {
            switch (CheckSize())
            {
            case "Small":
                if (_thirdColumnVisibility)
                {
                    FirstColumnVisibility  = false;
                    SecondColumnVisibility = true;
                    ThirdColumnVisibility  = false;
                }
                else
                {
                    FirstColumnVisibility  = true;
                    SecondColumnVisibility = false;
                }
                break;

            case "Medium":
                FirstColumnVisibility  = true;
                SecondColumnVisibility = true;
                ThirdColumnVisibility  = false;
                break;
            }
            GoBackCommand.RaiseCanExecuteChanged();
            GoForwardCommand.RaiseCanExecuteChanged();
        }
 /// <summary>
 /// Invoked when the hardware back button is pressed. For Windows Phone only.
 /// </summary>
 /// <param name="sender">Instance that triggered the event.</param>
 /// <param name="e">Event data describing the conditions that led to the event.</param>
 private void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
 {
     if (GoBackCommand.CanExecute(null))
     {
         e.Handled = true;
         GoBackCommand.Execute(null);
     }
 }
 protected virtual void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (GoBackCommand.CanExecute(null))
     {
         e.Handled = true;
         GoBackCommand.Execute(null);
     }
 }
        //private void Frame_Navigated(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e)
        //{
        //    DeregisterPageEvents();
        //    RefreshPage();
        //    RegisterPageEvents();
        //}

        private void App_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            if (GoBackCommand.CanExecute(null))
            {
                e.Handled = true;
                GoBackCommand.Execute(null);
            }
        }//
        private void OnNavigated(object sender, string viewModelName)
        {
//^^
//{[{

            GoBackCommand.NotifyCanExecuteChanged();
//}]}
        }
 /// <summary>
 ///     Invoked when the hardware back button is pressed. For Windows Phone only.
 /// </summary>
 /// <param name="sender">Instance that triggered the event.</param>
 /// <param name="e">Event data describing the conditions that led to the event.</param>
 protected virtual void HardwareButtonsBackPressed(object sender, BackPressedEventArgs e)
 {
     if (GoBackCommand.CanExecute(null))
     {
         e.Handled = true;
         GoBackCommand.Execute(null);
     }
 }
        public EditCustomerViewModel()
        {
            CancelThis          = new GoBackCommand();
            RegisterCustomerBtn = new RelayCommand(UpdateCustomer, ValidateCustomer);
            Shared        = StaticClassSingleton.Instance;
            ProxyCustomer = new Customer(Shared.SelectedCustomer);

            _originalName = ProxyCustomer.CompanyName;
        }
Beispiel #21
0
 public LicensViewModel()
 {
     GoBack          = new GoBackCommand();
     DeleteBtn       = new RelayCommand(Delete);
     ChanceBtn       = new RelayCommand(Change);
     EditSupplierBtn = new RelayCommand(EditSupplier);
     Shared          = StaticClassSingleton.Instance;
     SelectedLicens  = null;
 }
Beispiel #22
0
 public void GoTo <TPage>() where TPage : Page
 {
     if (CurrentPage != null)
     {
         pageStack.Push(CurrentPage);
     }
     CurrentPage = SimpleIoc.Default.GetInstance <TPage>();
     GoBackCommand.RaiseCanExecuteChanged();
 }
Beispiel #23
0
        public void BackStackGoBack()
        {
            var expected = new JObject {
                { "type", "Back:GoBack" }
            };
            var goBack = GoBackCommand.For(new BackstackExtension("Back"));

            Assert.True(JToken.DeepEquals(expected, JObject.FromObject(goBack)));
        }
Beispiel #24
0
 private void PublishIsGameOver(bool isOver)
 {
     _isGameOver = isOver;
     MoveCommand.RaiseCanExecuteChanged();
     HintMoveCommand.RaiseCanExecuteChanged();
     GoForwardCommand.RaiseCanExecuteChanged();
     GoBackCommand.RaiseCanExecuteChanged();
     IsGameOverEvent_EA_PUB(isOver);
 }
        private void OnMainFrameAfterNavigation()
        {
            CurrentPage = GetCurrentPage();

            GoBackCommand.RaiseCanExecuteChanged();
            GoForwardCommand.RaiseCanExecuteChanged();
            NavigateToHomeCommand.RaiseCanExecuteChanged();

            _usageCalculator.UpdateUsage(CurrentPage);
        }
        public void Navigate(Guid pageId)
        {
            var page = Module.ChartingPages[pageId];

            _mainFrame.Navigate(new Uri(page.Uri, UriKind.RelativeOrAbsolute));

            GoBackCommand.RaiseCanExecuteChanged();
            GoForwardCommand.RaiseCanExecuteChanged();
            NavigateToHomeCommand.RaiseCanExecuteChanged();
        }
Beispiel #27
0
        public void BackStackGoBackFull()
        {
            var expected = new JObject {
                { "type", "Back:GoBack" }, { "backType", "id" }, { "backValue", "myDocument" }
            };
            var goBack = GoBackCommand.For(new BackstackExtension("Back"));

            goBack.BackType  = BackTypeKind.Id;
            goBack.BackValue = "myDocument";
            Assert.True(JToken.DeepEquals(expected, JObject.FromObject(goBack)));
        }
        public BucketContentViewModel(IObjectService objectService, IBucketService bucketService, ILoginService loginService)
        {
            Entries = new ObservableCollection <BucketEntryViewModel>();

            _objectService = objectService;
            _bucketService = bucketService;
            _loginService  = loginService;

            GoBackCommand     = new GoBackCommand();
            UploadFileCommand = new UploadFileCommand(this, _objectService, _bucketService, _loginService);
        }
        private async Task SaveTask()
        {
            if (Model.IsValid)
            {
                TaskDao dao = _taskMapper.Convert(Model);

                var obj = await _taskAPiService.SaveToDoItemAsync(dao);

                GoBackCommand.Execute();
            }
        }
Beispiel #30
0
        private async void SaveDetailsAsync()
        {
            IsLoading = true;
            // Show a progress dialog.
            var progressDialog = _dialogService.ShowProgress("Please wait...",
                                                             "The details are being saved to your Office 365 tenant.");

            if (IsExisting)
            {
                // Calculate address (range).
                const int startRow = 2;
                var       endRow   = 2 + (_configService.DataFile.PropertyTable.Rows.Length - 1);
                var       address  = $"{Constants.DataFilePropertyTableColumnStart}{startRow}:" +
                                     $"{Constants.DataFilePropertyTableColumnEnd}{endRow}";

                // Update the table row.
                await _graphService.UpdateGroupTableRowsAsync(_configService.AppGroup,
                                                              _configService.DataFile.DriveItem, Constants.DataFileDataSheet, address,
                                                              _configService.DataFile.PropertyTable.Rows.Cast <TableRowModel>().ToArray());
            }
            else
            {
                // Create property group.
                var mailNickname = new string(_streetName.ToCharArray()
                                              .Where(char.IsLetterOrDigit)
                                              .ToArray())
                                   .ToLower();
                var propertyGroup = await _graphService.AddGroupAsync(GroupModel.CreateUnified(
                                                                          StreetName,
                                                                          Details.Description,
                                                                          mailNickname));

                // Add the current user as a member of the app group.
                await _graphService.AddGroupUserAsync(propertyGroup, _configService.User);

                // We need the file storage to be ready in order to place any files.
                // Wait for it to be configured.
                await _graphService.WaitForGroupDriveAsync(propertyGroup);

                // Add details to data file.
                Details.Id = propertyGroup.Mail;
                await _graphService.AddGroupTableRowAsync(_configService.AppGroup,
                                                          _configService.DataFile.DriveItem, Constants.DataFilePropertyTable, Details);

                // Add group and details to local config.
                _configService.Groups.Add(propertyGroup);
                _configService.DataFile.PropertyTable.AddRow(Details);
            }

            // Close the progress dialog.
            progressDialog.Close();
            IsLoading = false;
            GoBackCommand.Execute(null);
        }