Ejemplo n.º 1
0
        private void OpenCodeFile(CodeFile cf)
        {
            if (cf.FilePath != null)
            {
                for (int i = 0; i < TC.Items.Count; i++)
                {
                    var tmpCF = (((TabItem)TC.Items[i]).Content as CodeTab).CodeFile;

                    if (tmpCF.FilePath != null && tmpCF.FilePath.Equals(cf.FilePath))
                    {
                        TC.SelectedIndex = i;
                        break;
                    }
                }
            }

            var ct = new CodeTab(cf);

            ct.OnEditorCaretChanged += EditorSB.UpdateEditorCaretPositions;
            ct.OnRequestSaveNewFile += SaveNewFile;
            ct.OnRequestTabClose    += TabCloseRequest;
            ct.OnErrorListUpdated   += WErrorList.UpdateErrorList;
            ct.OnErrorListUpdated   += EditorSB.UpdateErrorsCount;

            var ti = new TabItem {
                Header  = cf.FileName,
                Content = ct
            };

            ti.GotFocus += (sender, e) => (ti.Content as CodeTab).Focus();

            TC.Items.Add(ti);

            TC.SelectedIndex = TC.Items.Count - 1;
        }
Ejemplo n.º 2
0
        public void NavigatePanelTo(NodeModel node, bool supressHistory)
        {
            if (!supressHistory)
            {
                // remove anything after current node, add this node to top
                while (Current != null && Current.Next != null)
                {
                    History.RemoveLast();
                }

                Current = History.AddLast(node);
            }

            if (node.ObjType == XObjType.Method)
            {
                CodeTab.NavigateTo(node);
                ShowDetailsPanel(CodeTab);
            }

            else if (node.ObjType == XObjType.Class ||
                     node.ObjType == XObjType.Field)
            {
                InstanceTab.NavigateTo(node);
                ShowDetailsPanel(InstanceTab);
            }

            else
            {
                NamespaceTab.NavigateTo(node);
                ShowDetailsPanel(NamespaceTab);
            }
        }
Ejemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            Model = new ViewModel(this, new BrightColorProfile());

            InitRenderers();
            SetRenderer(typeof(GdiRenderer));

            Model.SetRoot(Model.CurrentRoot); // init first node in history


            RedrawTimer.Interval = 1000 / XRay.TargetFps;
            RedrawTimer.Enabled  = true;

            RevalueTimer.Interval = 1000;
            RevalueTimer.Enabled  = true;

            InstanceTab.Init(this);
            DisplayTab.Init(this);
            ConsoleTab.Init(this);
            CodeTab.Init(this);
            NamespaceTab.Init(this);
            SettingsTab.Init(this);

            CodeTab.Visible      = false;
            InstanceTab.Visible  = false;
            NamespaceTab.Visible = false;

            //var x = Assembly.GetEntryAssembly();
            //Text = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location) + " Code Perspective";
            //Text = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName) + " Code Perspective";

            Text = "Code Perspective";

            if (XRay.Remote != null && XRay.Remote.RemoteDatHash != null)
            {
                Text = "Remote " + Text;
            }

            if (Pro.Verified)
            {
                Text += " Pro";
            }

            Show();
            WindowState = FormWindowState.Normal;
            BringToFront();
        }