EventArgs sent during deactivation.
상속: System.EventArgs
예제 #1
0
파일: Module.cs 프로젝트: NightyCode/GoHome
        private void OnShellDeactivated(object sender, DeactivationEventArgs e)
        {
            if (!e.WasClosed)
            {
                return;
            }

            UserActivityTracker.Stop();
        }
        private void SourceScreenDeactivated(object sender, DeactivationEventArgs e)
        {
            if(!e.WasClosed)
            {
                return;
            }

            var sourceScreen = sender as IScreen;
            if(sourceScreen == null)
            {
                return;
            }

            sourceScreen.Deactivated -= SourceScreenDeactivated;
            var view = GetView(sourceScreen);
            _contentGrid.Children.Remove(view);
        }
예제 #3
0
        private Task Deactivated(object sender, DeactivationEventArgs e)
        {
            if (!e.WasClosed)
            {
                return(Task.FromResult(false));
            }

            ((IDeactivate)model).Deactivated -= Deactivated;

            if (deactivatingFromView)
            {
                return(Task.FromResult(true));
            }

            deactivateFromViewModel = true;
            actuallyClosing         = true;
            view.Close();
            actuallyClosing         = false;
            deactivateFromViewModel = false;

            return(Task.FromResult(true));
        }
예제 #4
0
 void IDeactivate.Deactivate(bool close)
 {
     if (this.IsActive || this.IsInitialized)
     {
         DeactivationEventArgs e = new DeactivationEventArgs {
             WasClosed = close
         };
         this.AttemptingDeactivation(this, e);
         this.IsActive = false;
         Log.Info("Deactivating {0}.", new object[] { this });
         this.OnDeactivate(close);
         DeactivationEventArgs args2 = new DeactivationEventArgs {
             WasClosed = close
         };
         this.Deactivated(this, args2);
         if (close)
         {
             base.Views.Clear();
             Log.Info("Closed {0}.", new object[] { this });
         }
     }
 }
예제 #5
0
 private void AddClosed(object sender, DeactivationEventArgs e)
 {
     if (vm.WasCancelled)
         return;
     if (!context.IsSubmitting)
     {
         var newPresentation = vm.Presentation;
         BusyMessage = "Adding New Presentation...Please wait.";
         IsBusy = true;
         // verify we are truly adding a new presentation
         if (newPresentation.Id == 0)
         {
             // Map Model.Presentation to new Presentation
             var entityPresentation = new Presentation
                                          {
                                              Name = newPresentation.Name,
                                              Description = newPresentation.Description,
                                              Level = newPresentation.Level
                                          };
             // default EventPresentation status is Registered
             var eventPresentation = new EventPresentation
                                         {
                                             EventId = App.Event.Id,
                                             ApprovalStatus = "Registered",
                                             PresentationId = newPresentation.Id
                                         };
             var presentationSpeaker = new PresentationSpeaker
                                           {
                                               PresentationsAsSpeaker_Id = newPresentation.Id,
                                               Speakers_Id = App.LoggedInPerson.Id
                                           };
             entityPresentation.EventPresentations.Add(eventPresentation);
             entityPresentation.PresentationSpeakers.Add(presentationSpeaker);
             context.Presentations.Add(entityPresentation);
         }
         try
         {
             context.SubmitChanges(ChangesSubmitted, null);
         }
         catch (DomainOperationException dex)
         {
             EventAggregator.Publish(new ErrorWindowEvent {Exception = dex, ViewModelName = "SpeakerViewModel"});
             _loggingService.LogException(dex);
         }
     }
 }
            /// <summary>
            ///   Called when the view has been deactivated.
            /// </summary>
            /// <param name = "sender">The sender.</param>
            /// <param name = "e">The <see cref = "Caliburn.Micro.DeactivationEventArgs" /> instance containing the event data.</param>
            private void OnDeactivated(object sender, DeactivationEventArgs e)
            {
                ((IDeactivate)_viewModel).Deactivated -= OnDeactivated;

                if(!e.WasClosed || _isDeactivatingFromView)
                    return;

                _isDeactivatingFromViewModel = true;
                _isClosing = true;
                _view.ExecuteCommand(ContentPaneCommands.Close);
                _isClosing = false;
                _isDeactivatingFromViewModel = false;
            }
예제 #7
0
 //Juries TODO improve (remove typing tied to contentfactory)
 private void ViewModelDeactivated(object sender, DeactivationEventArgs e)
 {
     if(e.WasClosed)
     {
         var container = _target as TabGroupPane;
         if(container != null)
         {
             WorkSurfaceContextViewModel model = sender as WorkSurfaceContextViewModel;
             if(model != null)
             {
                 var vm = model.WorkSurfaceViewModel;
                 var toRemove = container.Items.Cast<ContentPane>().ToList()
                     .FirstOrDefault(p => p.Content != null && p.Content == vm);
                 RemovePane(toRemove);
                 if(toRemove != null &&
                     Application.Current != null &&
                     !Application.Current.Dispatcher.HasShutdownStarted)
                 {
                     container.Items.Remove(toRemove);
                 }
             }
         }
     }
 }
            /// <summary>
            ///   Called when the view has been deactivated.
            /// </summary>
            /// <param name = "sender">The sender.</param>
            /// <param name = "e">The <see cref = "Caliburn.Micro.DeactivationEventArgs" /> instance containing the event data.</param>
            private void OnDeactivated(object sender, DeactivationEventArgs e)
            {
                ((IDeactivate)m_ViewModel).Deactivated -= OnDeactivated;

                if (!e.WasClosed || m_IsDeactivatingFromView)
                    return;

                m_IsDeactivatingFromViewModel = true;
                m_IsClosing = true;
                m_View.Close();
                m_IsClosing = false;
                m_IsDeactivatingFromViewModel = false;
            }
예제 #9
0
            void Deactivated(object sender, DeactivationEventArgs e)
            {
                if (!e.WasClosed)
                    return;

                ((IDeactivate)model).Deactivated -= Deactivated;

                if (deactivatingFromView)
                    return;

                deactivateFromViewModel = true;
                actuallyClosing = true;
                view.Close();
                actuallyClosing = false;
                deactivateFromViewModel = false;
            }
예제 #10
0
 private void HandleDeactivation(object sender, DeactivationEventArgs e)
 {
     sender.As<IDeactivate>(d => d.Deactivated -= HandleDeactivation);
     if (_deactivationFromHere)
         return;
     Deactivate(e.WasClosed);
 }
 void _addTrackProperty_Deactivated(object sender, Caliburn.Micro.DeactivationEventArgs e)
 {
     ReloadList();
 }
예제 #12
0
 private void ShellDeactivating(object sender, DeactivationEventArgs e)
 {
     stateManager.SaveSettingsAsync();
 }
 public void ScopeDeactivated(object source, DeactivationEventArgs e)
 {
     foreach (var actionItem in scopeItems)
         actionItem.Deactivate(e.WasClosed);
 }
        private void MessageBoxDeactivated(object sender, DeactivationEventArgs e)
        {
            if (Callback != null)
                Callback(this);

            Deactivated -= MessageBoxDeactivated;
        }
예제 #15
0
 private void EditClosed(object sender, DeactivationEventArgs e)
 {
     if (vm.WasCancelled)
         return;
     var editedPresentation = vm.Presentation;
     BusyMessage = "Saving your Presentation...Please wait.";
     IsBusy = true;
     // Find and update existing EntitySpeakerPresentation
     var presentation = EntitySpeakerPresentations.GetReferenceItem(p => p.Id == editedPresentation.Id);
     if (presentation.Id != 0)
     {
         presentation.Name = editedPresentation.Name;
         presentation.Description = editedPresentation.Description;
         presentation.Level = editedPresentation.Level;
         if (presentation.EntityState == EntityState.Detached)
         {
             context.Presentations.Attach(presentation);
         }
         try
         {
             context.SubmitChanges(ChangesSubmitted, null);
         }
         catch (DomainOperationException dex)
         {
             EventAggregator.Publish(new ErrorWindowEvent { Exception = dex, ViewModelName="SpeakerViewModel" });
             _loggingService.LogException(dex);
         }
     }
 }
 private static void PageTwoViewModel_Deactivated(object sender, DeactivationEventArgs e)
 {
     Log.Info("PageTwoViewModel_Deactivated");
 }
예제 #17
0
 private void Deactivated(object sender, DeactivationEventArgs e)
 {
     if (e.WasClosed)
     {
         ((IDeactivate) this.model).Deactivated -= new EventHandler<DeactivationEventArgs>(this.Deactivated);
         if (!this.deactivatingFromView)
         {
             this.deactivateFromViewModel = true;
             this.actuallyClosing = true;
             this.view.Close();
             this.actuallyClosing = false;
             this.deactivateFromViewModel = false;
         }
     }
 }
예제 #18
0
            void Deactivated(object sender, DeactivationEventArgs e)
            {
                if (!e.WasClosed)
                {
                    return;
                }

                ((IDeactivate)this.model).Deactivated -= this.Deactivated;

                if (this.deactivatingFromView)
                {
                    return;
                }

                this.deactivateFromViewModel = true;
                this.actuallyClosing = true;
                this.view.Close();
                this.actuallyClosing = false;
                this.deactivateFromViewModel = false;
            }
예제 #19
0
 private void HandleDeactivation(object sender, DeactivationEventArgs e)
 {
     var model = (AppDialogAdapterViewModel)sender;
     model.Deactivated -= HandleDeactivation;
     _appDialogs.Remove(model);
 }