コード例 #1
0
ファイル: DWorkspace.cs プロジェクト: Wassili-Hense/Host.V04f
 public UIDocument Open(string path, string view = null) {
   string id;
   if(string.IsNullOrEmpty(path)) {
     id = null;
     path = null;
     view = null;
   } else {
     if(view != null) {
       id = path + "?view=" + view;
     } else {
       id = path;
     }
   }
   UIDocument ui;
   ui = _files.FirstOrDefault(z => z != null && z.ContentId == id);
   if(ui == null) {
     ui = new UI.UIDocument(path, view);
     _files.Add(ui);
   }
   ActiveDocument = ui;
   return ui;
 }
コード例 #2
0
ファイル: DWorkspace.cs プロジェクト: enviriot/EnviriotSW
        public BaseWindow Open(string path, string view = null)
        {
            string id;

            if (string.IsNullOrEmpty(path))
            {
                id   = null;
                path = null;
                view = null;
            }
            else
            {
                if (view != null)
                {
                    id = path + "?view=" + view;
                }
                else
                {
                    id = path;
                }
            }
            if (view == "wks")
            {
                var ui = Tools.FirstOrDefault(z => z != null && z.ContentId == id);
                if (ui == null)
                {
                    ui = new uiWorkspace();
                    Tools.Add(ui);
                }
                return(ui);
            }
            else if (view == "log")
            {
                var ui = Tools.FirstOrDefault(z => z != null && z.ContentId == id);
                if (ui == null)
                {
                    ui = new uiLog();
                    Tools.Add(ui);
                }
                return(ui);
            }
            else if (view == "catatlog")
            {
                var catalog = Files.OfType <UI.UiCatalog>().FirstOrDefault(z => z != null && z.ContentId == id);
                if (catalog == null)
                {
                    catalog = new UI.UiCatalog(path);
                    Files.Add(catalog);
                }
                ActiveDocument = catalog;
                return(catalog);
            }
            else
            {
                var doc = Files.OfType <UI.UIDocument>().FirstOrDefault(z => z != null && ((z.data != null && z.data.fullPath == path) || ContentIdEqual(z.ContentId, path, view)));
                if (doc == null)
                {
                    doc = new UI.UIDocument(path, view);
                    Files.Add(doc);
                }
                ActiveDocument = doc;
                return(doc);
            }
        }