예제 #1
0
        private void OnOpen()
        {
            var notification = new OpenFileDialogNotification();

            notification.RestoreDirectory = true;
            notification.Filter           = "Packaging Spec (*.xaml)|*.xaml";
            notification.FilterIndex      = 0;
            notification.CheckFileExists  = false;

            OpenFileRequest.Raise(notification,
                                  n =>
            {
                if (n.Confirmed)
                {
                    if (File.Exists(n.FileName))
                    {
                        using (var reader = new StreamReader(n.FileName, true))
                        {
                            Document.Text = reader.ReadToEnd();
                        }
                    }
                    else
                    {
                        using (var stream = GetType().Assembly.GetManifestResourceStream("Plainion.GraphViz.Modules.CodeInspection.Resources.SystemPackagingTemplate.xaml"))
                        {
                            using (var reader = new StreamReader(stream))
                            {
                                Document.Text = reader.ReadToEnd();
                            }
                        }
                    }
                    Document.FileName = n.FileName;
                }
            });
        }
예제 #2
0
        private void OnBrowseClicked()
        {
            var notification = new OpenFileDialogNotification();

            notification.RestoreDirectory = true;
            notification.Filter           = "Assemblies (*.dll,*.exe)|*.dll;*.exe";
            notification.FilterIndex      = 0;

            OpenFileRequest.Raise(notification,
                                  n =>
            {
                if (n.Confirmed)
                {
                    AssemblyToAnalyseLocation = n.FileName;
                }
            });
        }
예제 #3
0
        private void OnOpenConfigFile()
        {
            var notification = new OpenFileDialogNotification();

            notification.RestoreDirectory = true;
            notification.Filter           = "PathFinder config (*.json)|*.json";
            notification.FilterIndex      = 0;

            OpenFileRequest.Raise(notification,
                                  n =>
            {
                if (n.Confirmed)
                {
                    ConfigFile = n.FileName;
                }
            });
        }
예제 #4
0
        private void OpenDocument()
        {
            var notification = new OpenFileDialogNotification();

            notification.RestoreDirectory = true;
            notification.Filter           = "DOT files (*.dot)|*.dot|DGML files (*.dgml)|*.dgml|GraphML files (*.graphml)|*.graphml|DOT plain files (*.plain)|*.plain|Plainion.GraphViz files (*.pgv)|*.pgv";
            notification.FilterIndex      = 0;
            notification.DefaultExt       = ".dot";

            OpenFileRequest.Raise(notification,
                                  n =>
            {
                if (n.Confirmed)
                {
                    Open(n.FileName);
                }
            });
        }
예제 #5
0
        private void LoadMasks()
        {
            var notification = new OpenFileDialogNotification();

            notification.RestoreDirectory = true;
            notification.Filter           = "GraphViz filter files (*.bgf)|*.bgf";
            notification.FilterIndex      = 0;
            notification.DefaultExt       = ".bgf";

            OpenFileRequest.Raise(notification,
                                  n =>
            {
                if (n.Confirmed)
                {
                    var masks = myPersistanceService.Load(n.FileName);

                    var module        = myPresentation.GetModule <INodeMaskModule>();
                    var masksToRemove = module.Items.ToList();

                    // unfort. we have to add masks first and then remove the old ones because the system reacts on
                    // removal and in case of very huge graphs this causes performance issues because then the whole
                    // graph is picked instead of subset

                    // do reverse as we use push (stack)
                    foreach (var mask in masks.Reverse())
                    {
                        module.Push(mask);
                    }

                    foreach (var mask in masksToRemove)
                    {
                        module.Remove(mask);
                    }
                }
            });
        }