Beispiel #1
0
    /// <summary>
    ///
    /// </summary>
    public void OpenDesignNotes()
    {
        try
        {
            IDXPProject Project = DXP.GlobalVars.DXPWorkSpace.DM_FocusedProject();
            Dictionary <string, string> Params      = GetParams();
            IOptionsStorage             ProjOptions = Project.DM_OptionsStorage();
            if (Project == null)
            {
                MessageBox.Show("Project not found. Try again.");
                return;
            }

            string strProjPath = Util.ProjPath();

            if (strProjPath == "\\")
            {
                MessageBox.Show("Project not found. Try again.");
                return;
            }

            string DesignNotesPath = OneNotePath(strProjPath, "Open Notebook.onetoc2");
            string ProjAssy = "", ProjQual = "", PwbNum = "";


            for (int i = 0; i <= Project.DM_GetParameterCount() - 1; i++)
            {
                if (Project.DM_GetParameterName(i) == "SwRI_Pwb_Qual")
                {
                    ProjQual = Project.DM_GetParameterValue(i);
                }
                else if (Project.DM_GetParameterName(i) == "SwRI_Title_Assy")
                {
                    ProjAssy = Project.DM_GetParameterValue(i);
                }
                else if (Project.DM_GetParameterName(i) == "SwRI_Pwb_Number")
                {
                    PwbNum = Project.DM_GetParameterValue(i);
                }
            }

            if (ProjQual == null)
            {
                MessageBox.Show("SwRI_Pwb_Qual project parameter is blank. Please fill this parameter in and try again.");
                return;
            }
            if (ProjAssy == null)
            {
                MessageBox.Show("SwRI_Title_Assy project parameter is blank. Please fill this parameter in and try again.");
                return;
            }
            if (PwbNum == null)
            {
                MessageBox.Show("SwRI_Pwb_Number project parameter is blank. Please fill this parameter in and try again.");
                return;
            }
            if (PwbNum != "")
            {
                PwbNum = PwbNum.Substring(0, 5);
            }
            //SwRI_Pwb_Number
            System.IO.Directory.SetCurrentDirectory(Util.ProjPath());
            if (DesignNotesPath == "" && ProjQual != "" && ProjAssy != "")
            {
                CopyFile(Params["template"], ".\\" + PwbNum + "_" + ProjAssy + "_" + ProjQual + "_Notes");
                DesignNotesPath = Util.ProjPath() + PwbNum + "_" + ProjAssy + "_" + ProjQual + "_Notes\\Open Notebook.onetoc2";
            }
            //CopyFile(Params["template"], ".\\Design_Notes_" + ProjAssy + "_" + ProjQual);
            //DesignNotesPath = Util.ProjPath() + "Design_Notes_" + ProjAssy + "_" + ProjQual + "\\Open Notebook.onetoc2";

            else if (DesignNotesPath.Contains("Design_Notes\\Open Notebook.onetoc2"))
            {
                try
                {
                    Directory.Move(Path.GetDirectoryName(DesignNotesPath) + "\\", Util.ProjPath() + PwbNum + "_" + ProjAssy + "_" + ProjQual + "_Notes\\");
                    DesignNotesPath = Util.ProjPath() + PwbNum + "_" + ProjAssy + "_" + ProjQual + "_Notes\\Open Notebook.onetoc2";
                }
                catch //(IOException ex)
                {
                    //MessageBox.Show("")
                    //throw;
                }
            }
            else if (DesignNotesPath.Contains("Design_Notes_" + ProjAssy + "_" + ProjQual + "\\Open Notebook.onetoc2"))
            {
                try
                {
                    Directory.Move(Path.GetDirectoryName(DesignNotesPath) + "\\", Util.ProjPath() + PwbNum + "_" + ProjAssy + "_" + ProjQual + "_Notes\\");
                    DesignNotesPath = Util.ProjPath() + PwbNum + "_" + ProjAssy + "_" + ProjQual + "_Notes\\Open Notebook.onetoc2";
                }
                catch //(IOException ex)
                {
                    //MessageBox.Show("")
                    //throw;
                }
            }
            else if ((ProjQual == "" || ProjAssy == "") && DesignNotesPath == "")
            {
                CopyFile(Params["template"], ".\\" + Path.GetFileNameWithoutExtension(Project.DM_ProjectFileName()) + "_Notes");
                DesignNotesPath = Util.ProjPath() + Path.GetFileNameWithoutExtension(Project.DM_ProjectFileName()) + "_Notes" + "\\Open Notebook.onetoc2";
                //create folder using project name instead.
                //MessageBox.Show("Missing project Qual and Assembly parameters.");
                //return;
            }

            System.Diagnostics.Process proc = System.Diagnostics.Process.Start(DesignNotesPath);
            proc.Dispose();
        }
        catch (Exception ex)
        {
            ErrorMail.LogError("Error in " + System.Reflection.MethodBase.GetCurrentMethod().Name + ".", ex);
        }
    }
Beispiel #2
0
    public void frmBatchOutjob_Load(object sender, System.EventArgs e)
    {
        IDXPProject Project = DXP.GlobalVars.DXPWorkSpace.DM_FocusedProject();

        IProject project = DXP.GlobalVars.DXPWorkSpace.DM_FocusedProject() as IProject;

        //Load cboVariant with all variants in the active projet.
        if (project.DM_ProjectVariantCount() > 0)
        {
            cboVariant.Enabled = true;
            cboVariant.Items.Add("Original");
            cboVariant.Items.Add("[No Variations]");

            for (int i = 0; i < project.DM_ProjectVariantCount(); i++)
            {
                cboVariant.Items.Add(project.DM_ProjectVariants(i).DM_Description());
            }
            cboVariant.SelectedIndex = 0;
        }
        else
        {
            cboVariant.Enabled = false;
        }

        bool ODB = false;

        DXP.Utils.StatusBarSetState(2, "Collecting Outjobs");

        List <string> lstOutjobDocPaths = GetOutputJobPath();    //Get a list of all outjob docs in the project

        if (lstOutjobDocPaths == null)
        {
            return;
        }

        this.Text = Project.DM_ProjectFileName();


        //Open the outjob docs
        foreach (string strPath in lstOutjobDocPaths)
        {
            lstServerDocs.Add(tmpClient.OpenDocument("OUTPUTJOB", strPath));
        }

        DXP.Utils.PercentInit("Load Outjobs", lstServerDocs.Count);    //Progressbar init.
        List <TreeNode> lstTreeNode;

        //Get outjob mediums
        foreach (IServerDocument ServerDoc in lstServerDocs)
        {
            OutJobDoc = (IWSM_OutputJobDocument)ServerDoc;

            lstTreeNode = new List <TreeNode>();
            for (int i = 0; i < OutJobDoc.GetState_OutputMediumCount(); i++)
            {
                ODB = false;
                for (int j = 0; j < OutJobDoc.GetState_MediumOutputersCount(OutJobDoc.GetState_OutputMedium(i)); j++)
                {
                    //Check to see if outjob container is will generate ODB++ files. Flag it for hide refdes later.
                    if (OutJobDoc.GetState_MediumOutputer(OutJobDoc.GetState_OutputMedium(i), j).DM_GetDescription() == "ODB++ Files")
                    {
                        ODB = true;
                    }
                }
                //If outjob is not a Print then store the information and add to list.
                if (OutJobDoc.GetState_OutputMedium(i).GetState_TypeString() != "Print")
                {
                    dictOutputMedium.Add(System.IO.Path.GetFileName(ServerDoc.GetFileName()) + "-" + OutJobDoc.GetState_OutputMedium(i).GetState_Name(), new clsOutJob(OutJobDoc.GetState_OutputMedium(i), ServerDoc, ODB));
                    lstTreeNode.Add(new TreeNode(OutJobDoc.GetState_OutputMedium(i).GetState_Name()));    //Build list of nodes for form tree view
                }
                else
                {    //Dont remember why this is excluded.
                     //throw new  NotImplementedException("Batchoutjob \"print\" medium type");
                }
            }
            //Add collected outjob info to treeview.
            treeOutjobs.Nodes.Add(new TreeNode(System.IO.Path.GetFileName(ServerDoc.GetFileName()), lstTreeNode.ToArray()));     //Populate form treenodes
            DXP.Utils.PercentUpdate();
        }
        treeOutjobs.ExpandAll();

        DXP.Utils.PercentFinish();
        DXP.Utils.StatusBarSetState(2, "Select Outjobs to Run");
    }