Esempio n. 1
0
        public DocumentationServer CreateDocServer(int timestampPos, int tm1ServerPos)
        {
            // hier Parameter setzen
            docServer = new DocumentationServer(docCube, timestampPos, tm1ServerPos);

            return(docServer);
        }
Esempio n. 2
0
        public DocumentationServer createDocServer(string path, string xmlFile, int timestampPos, int tm1ServerPos)
        {
            DocumentationServer docServer = CreateDocServer(timestampPos, tm1ServerPos);

            SaveServerToXML(docServer, path + xmlFile);
            return(docServer);
        }
Esempio n. 3
0
        private void SaveServerToXML(DocumentationServer docServer, string path)
        {
            XElement elements = ServerToXML(docServer);

            //elements.Save(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + @"\" + filename + ".xml");
            elements.Save(path + ".xml");
        }
Esempio n. 4
0
        /// <summary>
        /// Draws a TM1 Server in Visio
        /// </summary>
        /// <param name="server">The DocumentationServer instance to draw</param>
        /// <param name="withSystemCubes">true if you want system cubes to be drawn</param>
        /// <param name="withSystemDims">true if you want system dimensions to be drawn</param>
        /// <param name="templatePath">Path to the ADAPT template</param>
        /// <param name="savePath">Save Path</param>
        public static void Draw(DocumentationServer server, bool withSystemCubes, bool withSystemDims, string savePath)
        {
            try
            {
                cubeList = new List <Visio.Shape>();

                // start Visio
                application         = new Visio.Application();
                application.Visible = false;

                // load and set up the ADAPT template
                string filename = @"\Adapt.vst";
                doc         = application.Documents.Add(Environment.CurrentDirectory + filename);
                doc.Creator = @"gmc²";
                doc.Title   = @"Server: " + server.name;
                doc.SaveAs(savePath + server.name + ".vsdx");
                //doc.PaperSize = Visio.VisPaperSizes.visPaperSizeB4;

                // setting up the pages
                adaptPage          = doc.Pages[1];
                adaptPage.Name     = @"gmc² IBM Cognos Documentation Tool";
                adaptPage.AutoSize = true;

                // get the necessary shapes...
                visioCubeMaster = doc.Masters.get_ItemU(@"Cube");

                // ...and draw the cubes
                foreach (DocCube docCube in server.cubes)
                {
                    if (withSystemCubes || !docCube.name.StartsWith("}", StringComparison.OrdinalIgnoreCase))
                    {
                        DrawCube(docCube, withSystemDims);
                    }
                }

                posX = 1.25;
                posY = 1.75;

                foreach (DocCube docCube in server.cubes)
                {
                    if (docCube.nof_look > 0 && (withSystemCubes || !docCube.name.StartsWith("}", StringComparison.OrdinalIgnoreCase)))
                    {
                        DrawLooksConnections(docCube);
                    }

                    if (docCube.nof_fed > 0 && (withSystemCubes || !docCube.name.StartsWith("}", StringComparison.OrdinalIgnoreCase)))
                    {
                        DrawFeedsConnections(docCube);
                    }
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                kill();
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Creates the XML export File
 /// </summary>
 /// <param name="server">DocumentationServer to be exported</param>
 /// <returns></returns>
 private XElement ServerToXML(DocumentationServer server)
 {
     return(new XElement("server", new XAttribute("name", server.name),
                         new XElement("cubes", server.cubes.Select(x =>
                                                                   new XElement("cube", new XAttribute("name", x.name),
                                                                                new XElement("dimensions", x.dims.Select(y =>
                                                                                                                         new XElement("dimension", y.name))),
                                                                                new XElement("look_up_cubes", x.look_up_cubes.Select(l =>
                                                                                                                                     new XElement("look_up_cube", l.name))),
                                                                                new XElement("feeder_cubes", x.fed_cubes.Select(f =>
                                                                                                                                new XElement("feeder_cube", f.name))))))));
 }
Esempio n. 6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string savePath = System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"gmc2\");

            if (!System.IO.Directory.Exists(savePath))
            {
                System.IO.Directory.CreateDirectory(savePath);
            }

            DocumentationServer server = (this.checkboxXML.IsChecked.Value ?
                                          tool.createDocServer(savePath, this.xmlFileNameTextBox.Text, timestampsComboBox.SelectedIndex, tm1ServerComboBox.SelectedIndex) :
                                          tool.CreateDocServer(timestampsComboBox.SelectedIndex, tm1ServerComboBox.SelectedIndex));

            VisioDrawer.DocServerToADAPT.Draw(server, this.checkboxSysCubes.IsChecked.Value, this.checkboxSysDims.IsChecked.Value, savePath);

            string msg = "ADAPT Export " + (checkboxXML.IsChecked.Value ? "and XML File " : "") + "saved in " + savePath;

            MessageBox.Show(msg);
        }
Esempio n. 7
0
        public ServerToVisio(DocumentationServer server)
        {
            Visio.Document  doc;
            Visio.Page      adaptPage;
            Visio.Selection select;
            Visio.Shape     group;

            // start Visio
            Visio.Application application = new Visio.Application();
            application.Visible = true;

            // setting up paths
            string templatePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + @"\Benutzerdefinierte Office-Vorlagen\Visio Templates\Adapt.vst";
            string savePath     = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + @"\VS Saves\Adapt.vst";

            // load and set up the ADAPT template (with 2 pages)
            doc         = application.Documents.Add(templatePath);
            doc.Creator = @"gmc²";
            doc.Title   = @"Hier steht dann der Titel";
            doc.SaveAs(savePath);

            //doc.Pages.Add();

            // setting up the pages
            adaptPage      = doc.Pages[1];
            adaptPage.Name = @"ADAPT";
            Visio.Page legende = doc.Pages[2];
            legende.Name = @"Legende";

            // get the necessary shapes...

            //!!! ALT in Dictionary !!!
            Dictionary <string, Visio.Master> masters = new Dictionary <string, Visio.Master>();

            masters.Add(@"Cube", doc.Masters.get_ItemU(@"Cube"));

            Visio.Master visioCubeMaster       = doc.Masters.get_ItemU(@"Cube");
            Visio.Master visioDimensionMaster  = doc.Masters.get_ItemU(@"Dimension");
            Visio.Master visioHierarchytMaster = doc.Masters.get_ItemU(@"Hierarchy");
            Visio.Master visioAttributeMaster  = doc.Masters.get_ItemU(@"Attribute");
            Visio.Master visioUsedByMaster     = doc.Masters.get_ItemU(@"Used By");

            // ...and draw them
            List <Visio.Shape> cubeShapes = new List <Visio.Shape>();

            foreach (DocCube cube in server.cubes)
            {
                cubeShapes.Add(adaptPage.Drop(visioCubeMaster, 6, 5));
            }

            Visio.Shape visioCubeShape1 = adaptPage.Drop(visioCubeMaster, 4.25, 1.5);
            visioCubeShape1.Text = @"My 1st Cube";
            visioCubeShape1.Resize(Visio.VisResizeDirection.visResizeDirN, 2, Visio.VisUnitCodes.visCentimeters);
            visioCubeShape1.Resize(Visio.VisResizeDirection.visResizeDirE, 2, Visio.VisUnitCodes.visCentimeters);

            Visio.Shape visioDimensionShape1 = adaptPage.DropConnected(visioDimensionMaster, visioCubeShape1, Visio.VisAutoConnectDir.visAutoConnectDirNone, visioUsedByMaster);
            visioDimensionShape1.Text = @"My 1st Dimension";

            Visio.Shape visioDimensionShape2 = adaptPage.Drop(visioDimensionMaster, 6.25, 2.5);
            visioDimensionShape2.Text = @"My 2nd Dimension";

            //Visio.Shape visioUsedByShape1 = visioUsedByMaster.Shapes.;

            // Sample code for grouping...
            select = doc.Application.ActiveWindow.Selection;
            select.SelectAll();
            group = select.Group();

            visioDimensionShape2.AutoConnect(visioDimensionShape1, Visio.VisAutoConnectDir.visAutoConnectDirNone);

            //Visio.Connect visioUsedBy1 = adaptPage.Connects(visioUsedByMaster, 6.25, 2.5);
            //visioDimensionShape2.Text = @"My 2nd Dimension";



            //adaptPage.Drop(visioUsedByShape1, 5, 5);
            //Visio.Shape visioCubeShape2 = visioCubeMaster.;
        }