コード例 #1
0
ファイル: SEGraphViewModel.cs プロジェクト: young36832/seviz
        private void LoadGraphFromTemp()
        {
            var result = MessageBox.Show("New SEViz graph is available. Do you want to load it?", "SEViz notification", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                var dialogFactory = ViewerWindowCommand.Instance.ServiceProvider.GetService(typeof(SVsThreadedWaitDialogFactory)) as IVsThreadedWaitDialogFactory;

                IVsThreadedWaitDialog2 dialog = null;
                if (dialogFactory != null)
                {
                    dialogFactory.CreateInstance(out dialog);
                }
                if (dialog != null)
                {
                    bw = new BackgroundWorker();
                    bw.WorkerSupportsCancellation = true;
                    bw.DoWork += (p1, p2) =>
                    {
                        dialog.StartWaitDialog("SEViz", "SEViz is loading", "Please wait while SEViz loads the graph...", null, "Waiting status bar text", 0, false, true);
                        while (true)
                        {
                            if (!bw.CancellationPending)
                            {
                                Thread.Sleep(500);
                            }
                            else
                            {
                                break;
                            }
                        }
                    };
                    bw.RunWorkerCompleted += (p1, p2) =>
                    {
                        int isCanceled = -1;
                        dialog.EndWaitDialog(out isCanceled);
                    };
                    bw.RunWorkerAsync();

                    // Loading the graph
                    LoadGraph(SEGraph.Deserialize(Path.GetTempPath() + "SEViz/" + "temp.graphml"));

                    // Setting the caption of the tool window
                    ViewerWindowCommand.Instance.FindToolWindow().Caption = Graph.Vertices.Where(v => !v.SourceCodeMappingString.Equals("")).FirstOrDefault().MethodName + " - SEViz";

                    // Showing the tool window
                    ViewerWindowCommand.Instance.ShowToolWindow(null, null);
                }
            }

            fsw.EnableRaisingEvents = true;
        }
コード例 #2
0
ファイル: SEGraphViewModel.cs プロジェクト: young36832/seviz
        public void LoadGraphFromUri(string fileUri)
        {
            // Loading the graph
            LoadGraph(SEGraph.Deserialize(fileUri));

            // Setting the caption of the tool window (making sure with the loop that the node has a method)
            for (int i = 0; i < 10; i++)
            {
                var methodName = Graph.Vertices.Where(v => v.Id == i).FirstOrDefault().MethodName;
                if (methodName != "")
                {
                    ViewerWindowCommand.Instance.FindToolWindow().Caption = methodName + " - SEViz";
                    break;
                }
            }
        }