Exemple #1
0
 bool NextMvcFilePath(Document curDocument)
 {
     RelatedFilePath = "";
     if (curDocument.IsMvcUIPage())
     {
         RelatedFilePath = curDocument.GetMvcControllerOfUIPage();
         State           = PageOrModule.Page;
     }
     else if (curDocument.IsMvcWebController())
     {
         RelatedFilePath = curDocument.GetMvcPageOfWebController();
     }
     else if (curDocument.IsMvcWebView())
     {
         RelatedFilePath = curDocument.GetMvcPageOfWebView();
     }
     if (RelatedFilePath.Length > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
        bool NextModuleFilePath(Document curDocument)
        {
            RelatedFilePath = "";
            if (curDocument.IsModuleOfUI())
            {
                RelatedFilePath = curDocument.GetModuleOfUI();
                State           = PageOrModule.Module;
            }
            else if (curDocument.IsModuleOfWebCtrlModule())
            {
                RelatedFilePath = curDocument.GetModuleOfWebCtrlModule();
            }
            else if (curDocument.IsModuleOfWebCtrlPage())
            {
                RelatedFilePath = curDocument.GetModuleOfWebCtrlPage();
            }
            else if (curDocument.IsModuleOfWebVeiwModule())
            {
                RelatedFilePath = curDocument.GetModuleOfWebViewModule();
            }
            else if (curDocument.IsModuleOfWebViewPage())
            {
                RelatedFilePath = curDocument.GetModuleOfWebViewPage();
            }

            if (RelatedFilePath.Length > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        void OpenRelatedFileMenuItem_BeforeQueryStatus(object sender, EventArgs e)
        {
            var currentDocument = App.DTE.ActiveDocument;
            var cmd             = sender as OleMenuCommand;

            cmd.Visible = false;
            try
            {
                if (null != cmd)
                {
                    if (currentDocument.IsEntityFile())
                    {
                        if (NextEntityFilePath(currentDocument))
                        {
                            cmd.Visible = true;
                            cmd.Text    = "Go To Related Entity File";
                            State       = PageOrModule.None;
                        }
                    }
                    else if (currentDocument.IsComponentFile())
                    {
                        if (NextComponentFilePath(currentDocument))
                        {
                            cmd.Visible = true;
                            cmd.Text    = "Go To Related Component File";
                            State       = PageOrModule.None;
                        }
                    }
                    else if (State == PageOrModule.Page && currentDocument.IsModuleOfWebCtrlPage() && currentDocument.IsMvcWebController())
                    {
                        if (NextMvcFilePath(App.DTE.ActiveDocument))
                        {
                            cmd.Visible = true; cmd.Text = "Go To Related MVC Page";
                        }
                    }
                    else if (State == PageOrModule.Page && currentDocument.IsModuleOfWebViewPage() && currentDocument.IsMvcWebView())
                    {
                        if (NextMvcFilePath(App.DTE.ActiveDocument))
                        {
                            cmd.Visible = true; cmd.Text = "Go To Related MVC Page";
                        }
                    }
                    else if (currentDocument.IsModuleFile())
                    {
                        if (NextModuleFilePath(currentDocument))
                        {
                            cmd.Visible = true;
                            cmd.Text    = "Go To Related Module File";
                            State       = PageOrModule.None;
                        }
                    }
                    else if (currentDocument.IsMvcFile())
                    {
                        if (NextMvcFilePath(App.DTE.ActiveDocument))
                        {
                            cmd.Visible = true;
                            cmd.Text    = "Go To Related MVC Page";
                        }
                    }
                }
            }
            catch (Exception err)
            {
                StackTrace st = new StackTrace(err);
                Debug.WriteLine(st.ToString());
            }
        }