private void CreateViewPointDocs(string systemname, string path, SPES_DocumentReferencer pReferencer) { using (Application app = new Application()) { Application subapplic = this._application; IntPtr appkey = new IntPtr(0); IntPtr helpappkey = new IntPtr(0); Application applic = null; foreach (var window in OpenWindowGetter.GetOpenWindows()) { if (window.Value.Contains("Visio Professional")) { OpenWindowGetter.SetForegroundWindow(window.Key); applic = NetOffice.VisioApi.Application.GetActiveInstance(); if (app == applic) { helpappkey = window.Key; } else if (applic == this._application) { appkey = window.Key; } ; } ; } OpenWindowGetter.SetForegroundWindow(helpappkey); CreateemptyModels(app, path, systemname, pReferencer); var doc = app.Documents.Add(""); CreateRvp(systemname, doc); doc.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP.vsdx")); doc.Close(); doc = app.Documents.Add(""); CreateFvp(systemname, doc); //app.Documents.OpenEx("SMT_FN_Funktionsnetz.vssx", 4); app.Documents.OpenEx("SMT_IA.vssx", 4); doc.SaveAs(System.IO.Path.Combine(path, systemname + "_FVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemname + "_FVP.vsdx", typeof(FunktionsnetzNetwork).Name); doc = app.Documents.Add(""); CreateLvp(systemname, doc); //app.Documents.OpenEx("SMT_Class.vssx", 4); doc.SaveAs(System.IO.Path.Combine(path, systemname + "_LVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemname + "_LVP.vsdx", typeof(LogicalViewpointNetwork).Name); doc = app.Documents.Add(""); CreateTvp(systemname, doc); //app.Documents.OpenEx("SMT_SM.vssx", 4); //app.Documents.OpenEx("SMT_IA.vssx", 4); doc.SaveAs(System.IO.Path.Combine(path, systemname + "_TVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemname + "_TVP.vsdx", typeof(TechnicalViewpointNetwork).Name); OpenWindowGetter.SetForegroundWindow(appkey); app.Quit(); } }
private void CreateSubSystemElements(IVPage p, IntPtr appkey, SPES_DocumentReferencer pReferencer) { using (Application app = new Application()) { Application subapplic = this._application; IntPtr helpappkey = new IntPtr(0); Application applic = null;; foreach (var window in OpenWindowGetter.GetOpenWindows()) { if (window.Value.Contains("Visio Professional")) { OpenWindowGetter.SetForegroundWindow(window.Key); applic = NetOffice.VisioApi.Application.GetActiveInstance(); if (app == applic) { helpappkey = window.Key; } ; } ; } OpenWindowGetter.SetForegroundWindow(helpappkey); CreateemptyModels(app, this._application.ActiveDocument.Path, p.Name, pReferencer); IVShape header, systemName, rvp, fvp, lvp, tvp, statusRvp, statusFvp, statusLvp, statusTvp; IVHyperlink rvphl, fvphl, lvphl, tvphl; header = p.DrawRectangle(1, 1, 8, 1.5); header.LineStyle = "none"; header.Text = "Artifacts of " + p.Name; header.SetCenter(4, (28 / 2.54)); header.CellsSRC(3, 0, 7).FormulaU = "24 pt"; header.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; systemName = p.DrawRectangle(1, 1, 8, 4); systemName.Text = p.Name; systemName.SetCenter(4, (23.2 / 2.54)); systemName.CellsSRC(1, 11, 4).Formula = "0"; systemName.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; rvp = p.DrawRectangle(1, 1, 2.5, 3); rvp.Text = "Requirements Engineering Viewpoint"; rvp.SetCenter(4.2 / 2.54, (22.8 / 2.54)); rvp.CellsSRC(1, 11, 4).Formula = "0"; rvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusRvp = p.DrawOval(1, 1, 1.16, 1.16); statusRvp.SetCenter(4.2 / 2.54, 23.5 / 2.54); statusRvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; fvp = p.DrawRectangle(1, 1, 2.5, 3); fvp.Text = "Functional Viewpoint"; fvp.SetCenter(8.2 / 2.54, (22.8 / 2.54)); fvp.CellsSRC(1, 11, 4).Formula = "0"; fvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusFvp = p.DrawOval(1, 1, 1.16, 1.16); statusFvp.SetCenter(8.2 / 2.54, 23.5 / 2.54); statusFvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; lvp = p.DrawRectangle(1, 1, 2.5, 3); lvp.Text = "Logical Viewpoint"; lvp.SetCenter(12.2 / 2.54, (22.8 / 2.54)); lvp.CellsSRC(1, 11, 4).Formula = "0"; lvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusLvp = p.DrawOval(1, 1, 1.16, 1.16); statusLvp.SetCenter(12.2 / 2.54, 23.5 / 2.54); statusLvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; tvp = p.DrawRectangle(1, 1, 2.5, 3); tvp.Text = "Technical Viewpoint"; tvp.SetCenter(16.2 / 2.54, (22.8 / 2.54)); tvp.CellsSRC(1, 11, 4).Formula = "0"; tvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusTvp = p.DrawOval(1, 1, 1.16, 1.16); statusTvp.SetCenter(16.2 / 2.54, 23.5 / 2.54); statusTvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; var doc = app.Documents.Add(""); CreateRvp(p.Name, doc); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_RVP.vsdx")); doc.Close(); rvphl = rvp.AddHyperlink(); rvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_RVP.vsdx")); doc = app.Documents.Add(""); CreateFvp(p.Name, doc); //todo: load shapes -> load modules //app.Documents.OpenEx("SMT_FN_Funktionsnetz.vssx", 4); //app.Documents.OpenEx("SMT_IA.vssx", 4); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_FVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemName.Text + "_FVP.vsdx", typeof(FunktionsnetzNetwork).Name); fvphl = fvp.AddHyperlink(); fvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_FVP.vsdx")); doc = app.Documents.Add(""); CreateLvp(p.Name, doc); //app.Documents.OpenEx("SMT_Class.vssx", 4); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_LVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemName.Text + "_LVP.vsdx", typeof(LogicalViewpointNetwork).Name); lvphl = lvp.AddHyperlink(); lvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_LVP.vsdx")); doc = app.Documents.Add(""); CreateTvp(p.Name, doc); //app.Documents.OpenEx("SMT_SM.vssx", 4); //app.Documents.OpenEx("SMT_IA.vssx", 4); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_TVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemName.Text + "_TVP.vsdx", typeof(TechnicalViewpointNetwork).Name); tvphl = tvp.AddHyperlink(); tvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_TVP.vsdx")); app.Quit(); OpenWindowGetter.SetForegroundWindow(appkey); } }
private void CreateemptyModels(Application subapp, string path, string systemname, SPES_DocumentReferencer pReferencer) { var doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_CoK.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_CoK.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_CoK.vsdx", typeof(WissenskontextNetwork).Name); doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_FuC.vssx", 4); subapp.ActivePage.Name = "funktional Perspective"; doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_foC.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_foC.vsdx", typeof(FunktionellerKontextNetwork).Name); doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_SoC.vssx", 4); subapp.ActivePage.Name = "static Perspective"; doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_soC.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_soC.vsdx", typeof(StrukturellerKontextNetwork).Name); //Dokumente für Loesungsneutrale Modelle doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_GRL.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_Goals.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_Goals.vsdx", typeof(ZielmodellNetwork).Name); doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_UCM.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_UCM.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_UCM.vsdx", typeof(SzenarioUseCasesNetwork).Name); doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_hMSC.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_MSC.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_MSC.vsdx", typeof(ScenarioNetwork).Name); //Dokumente für Loesungsbezogene Modelle doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_Class.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_stP.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_stP.vsdx", typeof(StrukturellePerspektiveNetwork).Name); doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_Activity.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_fuP.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_fuP.vsdx", typeof(FunktionellePerspektiveNetwork).Name); doct = subapp.Documents.Add(""); //subapp.Documents.OpenEx("SMT_SM.vssx", 4); doct.SaveAs(System.IO.Path.Combine(path, systemname + "_RVP_BP.vsdx")); doct.Close(); pReferencer.AddAssignment(systemname + "_RVP_BP.vsdx", typeof(VerhaltensperspektiveNetwork).Name); }