Esempio n. 1
0
 private void tsiFileOpenFile_Click(object sender, EventArgs e)
 {
     if (openDocumentDialog.ShowDialog() == DialogResult.OK)
     {
         foreach (string file in openDocumentDialog.FileNames)
         {
             Document doc = mManager.OpenDocument(file);
             if (doc != null)
             {
                 ShowDocument(doc);
             }
         }
     }
 }
Esempio n. 2
0
        private IDockContent GetContentFromPersistString(string persistType, string persistString)
        {
            Type type = System.Type.GetType(persistType);

            // Look for a tool window
            if (typeof(ToolWindow).IsAssignableFrom(type))
            {
                foreach (ToolWindow window in mToolWindows)
                {
                    if (type == window.GetType())
                    {
                        window.ConfigureFromPersistString(persistString);
                        return(window);
                    }
                }
            }

            // Try as a document
            else if (typeof(DocumentView).IsAssignableFrom(type))
            {
                Document doc = Manager.OpenDocument(persistString);
                if (doc == null)
                {
                    return(null);
                }

                if (type == null)
                {
                    type = ChooseViewType(doc);
                }

                return(OpenDocument(doc, type, true));                  // Force one to open, because DockPanel doesn't like it when we re-use a window here
            }

            // Give up
            return(null);
        }