Esempio n. 1
0
        protected override void HandleOnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            base.HandleOnNavigatingFrom(e);
            AddEditAudioViewModel dataContext = (AddEditAudioViewModel)base.DataContext;

            if (dataContext == null || ((string)e.Uri.OriginalString).Contains("app://external"))
            {
                return;
            }
            dataContext.CancelUploading();
        }
Esempio n. 2
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            if (this._isInitialized)
            {
                return;
            }
            this._isInitialized = true;
            AddEditAudioViewModel viewModel = new AddEditAudioViewModel((StorageFile)ParametersRepository.GetParameterForIdAndReset("AudioForUpload"), (AudioObj)ParametersRepository.GetParameterForIdAndReset("AudioForEdit"));

            base.DataContext = viewModel;
            ApplicationBarIconButton applicationBarIconButton1 = new ApplicationBarIconButton();
            Uri uri1 = new Uri("/Resources/check.png", UriKind.Relative);

            applicationBarIconButton1.IconUri = uri1;
            string appBarMenuSave = CommonResources.AppBarMenu_Save;

            applicationBarIconButton1.Text = appBarMenuSave;
            int num = !viewModel.IsFormCompleted ? 0 : (viewModel.IsFormEnabled ? 1 : 0);

            applicationBarIconButton1.IsEnabled = (num != 0);
            ApplicationBarIconButton appBarButtonSave          = applicationBarIconButton1;
            ApplicationBarIconButton applicationBarIconButton2 = new ApplicationBarIconButton();
            Uri uri2 = new Uri("/Resources/appbar.cancel.rest.png", UriKind.Relative);

            applicationBarIconButton2.IconUri = uri2;
            string appBarCancel = CommonResources.AppBar_Cancel;

            applicationBarIconButton2.Text = appBarCancel;
            ApplicationBarIconButton applicationBarIconButton3 = applicationBarIconButton2;

            appBarButtonSave.Click += ((EventHandler)((p, f) =>
            {
                ((Control)this).Focus();
                viewModel.SaveChanges();
            }));
            applicationBarIconButton3.Click += ((EventHandler)((p, f) => Navigator.Current.GoBack()));
            this.ApplicationBar              = ((IApplicationBar)ApplicationBarBuilder.Build(new Color?(), new Color?(), 0.9));
            viewModel.PropertyChanged       += (PropertyChangedEventHandler)((p, f) => appBarButtonSave.IsEnabled = (viewModel.IsFormCompleted && viewModel.IsFormEnabled));
            this.ApplicationBar.Buttons.Add(appBarButtonSave);
            this.ApplicationBar.Buttons.Add(applicationBarIconButton3);
        }