Пример #1
0
        private void SetCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand cmd = new SettingsCommand(
                 "sample",
                 "Feedback",
                 (x) =>
                 {
                     // create a new instance of the flyout
                     SettingsFlyout settings = new SettingsFlyout();
                     settings.Title = "Provide Feedback";
                     BitmapImage bitmap = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png"));
                     settings.IconSource = bitmap;

                     // set the content for the flyout
                     var settingsContent = new FeedbackContent();
                     settingsContent.FeedbackSent += (s, e) =>
                     {
                         settings.Hide();
                     };

                     settings.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
                     settings.Content = settingsContent;

                     // open it
                     settings.Show();
                 });

            args.Request.ApplicationCommands.Add(cmd);
        }
 public void Close()
 {
     _flyout.Hide();
 }
Пример #3
0
 private void SettingsDone_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     SettingsFlyout.Hide();
 }
 private void BeforeUploadPrepareUI()
 {
     MainGrid.AllowDrop = false;
     OpenSettingsFlyoutButton.Visibility = Visibility.Collapsed;
     SettingsFlyout.Hide();
 }
        public ServiceSchedulingPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator, SettingsFlyout settingsFlyout)
            : base(navigationService)
        {
            _navigationService = navigationService;
            _settingsFlyout    = settingsFlyout;
            _eventAggregator   = eventAggregator;
            this.Address       = new Address();
            this.IsAddFlyoutOn = Visibility.Collapsed;
            this.Model         = new ServiceSchedulingDetail();
            this.GoToSupplierSelectionCommand = new DelegateCommand(async() =>
            {
                try
                {
                    if (await ODOImageValidate() && this.Model.ValidateProperties())
                    {
                        var messageDialog = new MessageDialog("Details once saved cannot be edited. Do you want to continue ?");
                        messageDialog.Commands.Add(new UICommand("Yes", OnYesButtonClicked));
                        messageDialog.Commands.Add(new UICommand("No"));
                        await messageDialog.ShowAsync();
                    }
                }
                catch (Exception ex)
                {
                    this.IsBusy = false;
                    AppSettings.Instance.ErrorMessage = ex.Message;
                }
            });

            this.AddAddressCommand = new DelegateCommand <string>((x) =>
            {
                settingsFlyout.Title = x + " Address";
                settingsFlyout.ShowIndependent();
            });

            this.ODOReadingPictureCommand = new DelegateCommand(async() =>
            {
                CameraCaptureUI cam = new CameraCaptureUI();
                var file            = await cam.CaptureFileAsync(CameraCaptureUIMode.Photo);
                if (file != null)
                {
                    ODOReadingImagePath = file.Path;
                }
            });

            this.OpenImageViewerCommand = new DelegateCommand <ImageCapture>(param =>
            {
                CoreWindow currentWindow = Window.Current.CoreWindow;
                Popup popup = new Popup();
                popup.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
                popup.VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Stretch;

                if (_imageViewer == null)
                {
                    _imageViewer = new ImageViewerPopup();
                }
                else
                {
                    _imageViewer      = null;
                    this._imageViewer = new ImageViewerPopup();
                }
                _imageViewer.DataContext = param;


                popup.Child           = _imageViewer;
                this._imageViewer.Tag = popup;

                this._imageViewer.Height = currentWindow.Bounds.Height;
                this._imageViewer.Width  = currentWindow.Bounds.Width;

                popup.IsOpen = true;
            });

            this._eventAggregator.GetEvent <AddressEvent>().Subscribe((address) =>
            {
                if (address != null)
                {
                    this.Address     = address;
                    StringBuilder sb = new StringBuilder();


                    sb.Append(address.Street).Append(",").Append(Environment.NewLine);

                    if ((address.SelectedSuburb != null) && !String.IsNullOrEmpty(address.SelectedSuburb.Name))
                    {
                        sb.Append(address.SelectedSuburb.Name).Append(",").Append(Environment.NewLine);
                    }
                    if (address.SelectedRegion != null)
                    {
                        sb.Append(address.SelectedRegion.Name).Append(",").Append(Environment.NewLine);
                    }
                    if ((address.SelectedCity != null) && !String.IsNullOrEmpty(address.SelectedCity.Name))
                    {
                        sb.Append(address.SelectedCity.Name).Append(",").Append(Environment.NewLine);
                    }
                    if ((address.SelectedProvince != null) && !String.IsNullOrEmpty(address.SelectedProvince.Name))
                    {
                        sb.Append(address.SelectedProvince.Name).Append(",").Append(Environment.NewLine);
                    }

                    if ((address.SelectedCountry != null) && !String.IsNullOrEmpty(address.SelectedCountry.Name))
                    {
                        sb.Append(address.SelectedCountry.Name).Append(",").Append(Environment.NewLine);
                    }

                    sb.Append(address.SelectedZip);


                    this.Model.Address = sb.ToString();
                }
                settingsFlyout.Hide();
            });

            this.TakePictureCommand = DelegateCommand <ImageCapture> .FromAsyncHandler(async (param) =>
            {
                await TakePictureAsync(param);
            });

            #region Location Type Changed
            this.LocTypeChangedCommand = new DelegateCommand <object>(async(param) =>
            {
                try
                {
                    var locType = ((LocationType)param).LocType;
                    this.IsBusy = true;
                    if (this.Model.DestinationTypes != null)
                    {
                        this.Model.DestinationTypes.Clear();
                        this.Model.SelectedDestinationType = null;
                    }
                    if (this.Model.DestinationTypes != null && locType == LocationTypeConstants.Driver && this._task != null)
                    {
                        this.Model.DestinationTypes.AddRange(await SSProxyHelper.Instance.GetDriversFromSvcAsync(this._task.CustomerId));
                    }
                    if (this.Model.DestinationTypes != null && locType == LocationTypeConstants.Customer && this._task != null)
                    {
                        this.Model.DestinationTypes.AddRange(await SSProxyHelper.Instance.GetCustomersFromSvcAsync(this._task.CustomerId));
                    }

                    if (this.Model.DestinationTypes != null && locType == LocationTypeConstants.Vendor)
                    {
                        this.Model.DestinationTypes.AddRange(await SSProxyHelper.Instance.GetVendorsFromSvcAsync());
                    }
                    this.IsAddFlyoutOn = Visibility.Collapsed;
                    this.IsAlternative = Visibility.Visible;
                    if (locType == LocationTypeConstants.Other)
                    {
                        this.Model.DestinationTypes        = new ObservableCollection <DestinationType>();
                        this.Model.SelectedDestinationType = new DestinationType();
                        this.IsAddFlyoutOn = Visibility.Visible;
                        this.IsAlternative = Visibility.Collapsed;
                    }

                    this.IsBusy = false;
                }
                catch (Exception ex)
                {
                    this.IsBusy = false;
                    AppSettings.Instance.ErrorMessage = ex.Message;
                }
            });
            #endregion

            this.DestiTypeChangedCommand = new DelegateCommand <object>(async(param) =>
            {
                try
                {
                    this.IsBusy = true;
                    if (param != null)
                    {
                        if (param is DestinationType)
                        {
                            this.Address.EntityRecId        = ((DestinationType)param).RecID;
                            DestinationType destinationType = param as DestinationType;
                            this.Model.Address = destinationType.Address;
                        }
                    }
                    this.IsBusy = false;
                }
                catch (Exception ex)
                {
                    this.IsBusy = false;
                    AppSettings.Instance.ErrorMessage = ex.Message;
                }
            });
        }