コード例 #1
0
        internal FrameworkElement ElementFromDocument(VmcDocument document)
        {
            FrameworkElement frameworkElement = this.documents.First((FrameworkElement o) => o.DataContext == document);

            if (frameworkElement != null && VisualTreeHelper.GetChildrenCount(frameworkElement) > 0)
            {
                return((FrameworkElement)VisualTreeHelper.GetChild(frameworkElement, 0));
            }
            return(null);
        }
コード例 #2
0
        private void TabItemCloseButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement frameworkElement  = (FrameworkElement)sender;
            FrameworkElement frameworkElement2 = (FrameworkElement)frameworkElement.DataContext;
            VmcDocument      vmcDocument       = (VmcDocument)frameworkElement2.DataContext;

            if (!this.QueryClose(vmcDocument))
            {
                VmcStudioUtil.Application.Documents.Remove(vmcDocument);
            }
        }
コード例 #3
0
        private void StartMenuExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            VmcStudioApp application = VmcStudioUtil.Application;
            VmcDocument  vmcDocument = application.Documents.FirstOrDefault((VmcDocument o) => o is StartMenuDocument);

            if (vmcDocument == null)
            {
                vmcDocument = new StartMenuDocument(application);
                application.Documents.Add(vmcDocument);
            }
            application.SelectedDocument = vmcDocument;
            e.Handled = true;
        }
コード例 #4
0
 private bool QueryClose(VmcDocument document)
 {
     if (document.IsDirty)
     {
         FrameworkElement target = this.ElementFromDocument(document);
         if (ApplicationCommands.Save.CanExecute(null, target))
         {
             MessageBoxResult messageBoxResult = MessageBox.Show(this, string.Format("Do you want to save changes to {0}?", document.Name), VmcStudioUtil.ApplicationTitle, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 ApplicationCommands.Save.Execute(null, target);
             }
             else
             {
                 if (messageBoxResult == MessageBoxResult.Cancel)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: kingpin2k/MCS
 internal FrameworkElement ElementFromDocument(VmcDocument document)
 {
     FrameworkElement frameworkElement = this.documents.First((FrameworkElement o) => o.DataContext == document);
     if (frameworkElement != null && VisualTreeHelper.GetChildrenCount(frameworkElement) > 0)
     {
         return (FrameworkElement)VisualTreeHelper.GetChild(frameworkElement, 0);
     }
     return null;
 }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: kingpin2k/MCS
 private bool QueryClose(VmcDocument document)
 {
     if (document.IsDirty)
     {
         FrameworkElement target = this.ElementFromDocument(document);
         if (ApplicationCommands.Save.CanExecute(null, target))
         {
             MessageBoxResult messageBoxResult = MessageBox.Show(this, string.Format("Do you want to save changes to {0}?", document.Name), VmcStudioUtil.ApplicationTitle, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 ApplicationCommands.Save.Execute(null, target);
             }
             else
             {
                 if (messageBoxResult == MessageBoxResult.Cancel)
                 {
                     return true;
                 }
             }
         }
     }
     return false;
 }