Example #1
0
 private void SubscribeToEvents()
 {
     m_ArrowGraphDataUpdatedSubscriptionToken =
         m_EventService.GetEvent <PubSubEvent <ArrowGraphDataUpdatedPayload> >()
         .Subscribe(payload =>
     {
         ArrowGraphAreaCtrl.ClearLayout();
         ArrowGraphData arrowGraphData = ViewModel.ArrowGraphData;
         if (arrowGraphData != null)
         {
             ArrowGraphAreaCtrl.GenerateGraph(arrowGraphData);
             ResetGraph();
         }
     }, ThreadOption.UIThread);
 }
Example #2
0
 public ArrowGraphManagerView(
     IArrowGraphManagerViewModel viewModel,
     IFileDialogService fileDialogService,
     IProjectSettingService projectSettingService,
     IEventAggregator eventService)
 {
     m_FileDialogService     = fileDialogService ?? throw new ArgumentNullException(nameof(fileDialogService));
     m_ProjectSettingService = projectSettingService ?? throw new ArgumentNullException(nameof(projectSettingService));
     m_EventService          = eventService ?? throw new ArgumentNullException(nameof(eventService));
     InitializeComponent();
     ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
     ArrowGraphAreaCtrl.ShowAllEdgesLabels();
     ArrowGraphAreaCtrl.SetVerticesDrag(true);
     SubscribeToEvents();
 }
Example #3
0
        private void ResetGraph()
        {
            IGXLogicCore <ArrowGraphVertex, ArrowGraphEdge, BidirectionalGraph <ArrowGraphVertex, ArrowGraphEdge> > logicCore = ArrowGraphAreaCtrl.LogicCore;

            if (logicCore == null)
            {
                throw new InvalidOperationException("LogicCore is null");
            }
            BidirectionalGraph <ArrowGraphVertex, ArrowGraphEdge> graph = logicCore.Graph;

            logicCore.ExternalLayoutAlgorithm = new ArrowGraphLayoutAlgorithm <ArrowGraphVertex, ArrowGraphEdge, BidirectionalGraph <ArrowGraphVertex, ArrowGraphEdge> >(graph);
            ArrowGraphAreaCtrl.RelayoutGraph();
            ArrowGraphAreaCtrl.GenerateAllEdges();
            logicCore.ExternalLayoutAlgorithm = null;
            ZoomCtrl.ZoomToFill();
            ZoomCtrl.Mode = ZoomControlModes.Custom;
        }
Example #4
0
        private void ExportGraphML_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string directory = m_SettingService.PlanDirectory;

                var filter = new FileDialogFileTypeFilter(
                    Resource.ProjectPlan.Filters.SaveGraphMLFileType,
                    Resource.ProjectPlan.Filters.SaveGraphMLFileExtension
                    );

                bool result = m_FileDialogService.ShowSaveDialog(directory, filter);

                if (result)
                {
                    {
                        string filename = m_FileDialogService.Filename;
                        if (string.IsNullOrWhiteSpace(filename))
                        {
                            MessageBox.Show(
                                Resource.ProjectPlan.Resources.Message_EmptyFilename,
                                Resource.ProjectPlan.Resources.Title_Error,
                                MessageBoxButton.OKCancel,
                                MessageBoxImage.Error);
                        }
                        else
                        {
                            File.WriteAllBytes(
                                filename,
                                ViewModel.ExportArrowGraphToDiagram(
                                    ArrowGraphAreaCtrl.ToDiagramArrowGraph()));
                            m_SettingService.SetDirectory(filename);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(
                    ex.Message,
                    Resource.ProjectPlan.Resources.Title_Error,
                    MessageBoxButton.OKCancel,
                    MessageBoxImage.Error);
            }
        }
Example #5
0
 private void ExportGraphML_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string directory = m_AppSettingService.ProjectPlanFolder;
         if (m_FileDialogService.ShowSaveDialog(
                 directory,
                 Properties.Resources.Filter_SaveGraphMLFileType,
                 Properties.Resources.Filter_SaveGraphMLFileExtension) == DialogResult.OK)
         {
             {
                 string filename = m_FileDialogService.Filename;
                 if (string.IsNullOrWhiteSpace(filename))
                 {
                     System.Windows.MessageBox.Show(
                         Properties.Resources.Message_EmptyFilename,
                         Properties.Resources.Title_Error,
                         MessageBoxButton.OKCancel,
                         MessageBoxImage.Error);
                 }
                 else
                 {
                     File.WriteAllBytes(
                         filename,
                         ViewModel.ExportArrowGraphToDiagram(
                             ArrowGraphAreaCtrl.ToDiagramArrowGraphDto()));
                     m_AppSettingService.ProjectPlanFolder = Path.GetDirectoryName(filename);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show(
             ex.Message,
             Properties.Resources.Title_Error,
             MessageBoxButton.OKCancel,
             MessageBoxImage.Error);
     }
 }