コード例 #1
0
 public void ResetLayout()
 {
     if (LayoutSerializationService != null)
     {
         LayoutSerializationService.Deserialize(null);
     }
 }
コード例 #2
0
 void SaveLayout()
 {
     if (LayoutSerializationService != null)
     {
         ViewModelLogicalLayoutHelper.PersistentViewsLayout[ViewName] = LayoutSerializationService.Serialize();
     }
 }
コード例 #3
0
        public virtual void OnLoaded()
        {
            string state = null;

            if (LayoutSerializationService != null && ViewModelLogicalLayoutHelper.PersistentViewsLayout.TryGetValue(ViewName, out state))
            {
                LayoutSerializationService.Deserialize(state);
            }
        }
コード例 #4
0
 public virtual void OnClosing(CancelEventArgs cancelEventArgs)
 {
     SaveLogicalLayout();
     if (LayoutSerializationService != null)
     {
         ViewModelLogicalLayoutHelper.PersistentViewsLayout[ViewLayoutName] = LayoutSerializationService.Serialize();
     }
     ViewModelLogicalLayoutHelper.SaveLayout();
 }
 /// <summary>
 /// Used to close all opened documents and allows you to save unsaved results and to cancel closing.
 /// Since DocumentsViewModel is a POCO view model, an instance of this class will also expose the OnClosingCommand property that can be used as a binding source in views.
 /// </summary>
 /// <param name="cancelEventArgs">An argument of the System.ComponentModel.CancelEventArgs type which is used to cancel closing if needed.</param>
 public virtual void OnClosing(CancelEventArgs cancelEventArgs)
 {
     SaveLogicalLayout();
     if (LayoutSerializationService != null)
     {
         ViewModelLogicalLayoutHelper.PersistentViewsLayout[ViewLayoutName] = LayoutSerializationService.Serialize();
     }
     Messenger.Default.Send(new CloseAllMessage(cancelEventArgs));
     ViewModelLogicalLayoutHelper.SaveLayout();
 }
 public void OnWindowLoaded()
 {
     if (Settings.Default.LogicalLayout != null)
     {
         this.RestoreDocumentManagerService(Settings.Default.LogicalLayout);
     }
     if (Settings.Default.RootLayout != null)
     {
         LayoutSerializationService.Deserialize(Settings.Default.RootLayout);
     }
 }
        /// <summary>
        /// Finalizes the DocumentsViewModel initialization and opens the default document.
        /// Since DocumentsViewModel is a POCO view model, an instance of this class will also expose the OnLoadedCommand property that can be used as a binding source in views.
        /// </summary>
        public virtual void OnLoaded(TModule module)
        {
            if (IsLoaded)
            {
                return;
            }
            IsLoaded = true;
            DocumentManagerService.ActiveDocumentChanged += OnActiveDocumentChanged;
            if (!RestoreLogicalLayout())
            {
                Show(module);
            }
            string state = null;

            if (LayoutSerializationService != null && ViewModelLogicalLayoutHelper.PersistentViewsLayout.TryGetValue(ViewLayoutName, out state))
            {
                LayoutSerializationService.Deserialize(state);
            }
        }
コード例 #8
0
 /// <summary>
 /// Used to close all opened documents and allows you to save unsaved results and to cancel closing.
 /// Since DocumentsViewModel is a POCO view model, an instance of this class will also expose the OnClosingCommand property that can be used as a binding source in views.
 /// </summary>
 /// <param name="cancelEventArgs">An argument of the System.ComponentModel.CancelEventArgs type which is used to cancel closing if needed.</param>
 public virtual void OnClosing(CancelEventArgs cancelEventArgs)
 {
     if (GroupedDocumentManagerService != null && GroupedDocumentManagerService.Groups.Count() > 1)
     {
         var activeGroup = GroupedDocumentManagerService.ActiveGroup;
         var message     = new CloseAllMessage(cancelEventArgs, vm =>
         {
             var activeVMs = activeGroup.Documents.Select(d => d.Content);
             return(activeVMs.Contains(vm));
         });
         Messenger.Default.Send(message);
         return;
     }
     SaveLogicalLayout();
     if (LayoutSerializationService != null)
     {
         PersistentLayoutHelper.PersistentViewsLayout[ViewLayoutName] = LayoutSerializationService.Serialize();
     }
     Messenger.Default.Send(new CloseAllMessage(cancelEventArgs, vm => true));
     PersistentLayoutHelper.SaveLayout();
 }
 public void OnWindowClosing()
 {
     Settings.Default.LogicalLayout = this.SerializeDocumentManagerService();
     Settings.Default.RootLayout    = LayoutSerializationService.Serialize();
     Settings.Default.Save();
 }