예제 #1
0
 public void LoadGraphFromText()
 {
     if (CheckGraphForClearing())
     {
         try
         {
             var dialog = new FileDialogViewModel(FileDialogMode.Open);
             var res    = WindowManager.ShowDialog(dialog);
             if (res.HasValue && res.Value)
             {
                 var textViewer       = new TextViewerViewModel(String.Empty, false, true, false);
                 var textViewerResult = WindowManager.ShowDialog(textViewer);
                 if (textViewerResult.HasValue && textViewerResult.Value)
                 {
                     _repository.LoadFromText(Document, textViewer.Text, dialog.SourceType);
                     EllipseVerticesPositionIfNeed();
                     UndoRedoManager.Instance.Clear();
                     Init();
                 }
             }
         }
         catch (Exception e)
         {
             ShowError(e);
         }
     }
 }
예제 #2
0
 public void SaveAsText()
 {
     try
     {
         var dialog = new FileDialogViewModel(FileDialogMode.Save);
         var res    = WindowManager.ShowDialog(dialog);
         if (res.HasValue && res.Value)
         {
             var text       = _repository.PresentAsText(Document, dialog.SourceType);
             var textViewer = new TextViewerViewModel(text, true, false, true);
             WindowManager.ShowDialog(textViewer);
         }
     }
     catch (Exception e)
     {
         ShowError(e);
     }
 }