Пример #1
0
 /// <summary>
 /// Handler for ContextMenu.Popup event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         // retrieve node which was clicked
         TreeNode node = GetNodeAt(PointToClient(Cursor.Position));
         if (node == null)
         {
             return;               // user might right click no valid node
         }
         SelectedNode = node;
         // clear previous items
         this.ContextMenuStrip.Items.Clear();
         // let the provider do his work
         NodeTag nodeTag = node.Tag as NodeTag;
         if (null != nodeTag)
         {
             QueryContextMenuItems(nodeTag, this.ContextMenuStrip);
         }
         // set Cancel to false.
         // it is optimized to true based on empty entry.
         e.Cancel = !(this.ContextMenuStrip.Items.Count > 0);
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Пример #2
0
 void AnalysisTreeView_DrawNode(object sender, System.Windows.Forms.DrawTreeNodeEventArgs e)
 {
     try
     {
         // get NodeTag
         NodeTag tag = e.Node.Tag as NodeTag;
         if (null == tag)
         {
             throw new Exception(string.Format("Node {0} has null tag", e.Node.Text));
         }
         Rectangle nodeBounds = e.Node.Bounds;
         if (null != tag.ItemProperties)
         {
             TextRenderer.DrawText(e.Graphics, tag.ItemProperties.Name, Font, nodeBounds, System.Drawing.Color.Black, Color.Transparent, TextFormatFlags.VerticalCenter | TextFormatFlags.NoClipping);
         }
         else
         {
             TextRenderer.DrawText(e.Graphics, e.Node.Text, Font, nodeBounds, System.Drawing.Color.Black, Color.Transparent, TextFormatFlags.VerticalCenter | TextFormatFlags.NoClipping);
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex.Message);
     }
 }
Пример #3
0
        internal TreeNode FindNode(TreeNode node, NodeTag nodeTag)
        {
            // check with node itself
            if (null != node)
            {
                NodeTag tag = node.Tag as NodeTag;
                if (null == tag)
                {
                    _log.Error(string.Format("Node {0} has no valid NodeTag", node.Text));
                    return(null);
                }
                if (tag.Equals(nodeTag))
                {
                    return(node);
                }
            }
            // check with child nodes
            TreeNodeCollection tnCollection = null == node ? Nodes : node.Nodes;

            foreach (TreeNode tn in tnCollection)
            {
                TreeNode tnResult = FindNode(tn, nodeTag);
                if (null != tnResult)
                {
                    return(tnResult);
                }
            }
            return(null);
        }
Пример #4
0
 private void onCreateNewPalletCorners(object sender, EventArgs e)
 {
     try
     {
         NodeTag tag = SelectedNode.Tag as NodeTag;
         ((DocumentSB)tag.Document).CreateNewPalletCornersUI();
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #5
0
 private void onCreateNewAnalysisCase(object sender, EventArgs e)
 {
     try
     {
         NodeTag tag = SelectedNode.Tag as NodeTag;
         ((DocumentSB)tag.Document).CreateNewBoxCasePalletOptimizationUI();
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #6
0
 private void OnDeleteBaseItem(object sender, EventArgs e)
 {
     try
     {
         NodeTag tag = SelectedNode.Tag as NodeTag;
         tag.Document.RemoveItem(tag.ItemProperties);
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #7
0
 private void OnCreateNewInterlayer(object sender, EventArgs e)
 {
     try
     {
         NodeTag tag = SelectedNode.Tag as NodeTag;
         ((DocumentSB)tag.Document).CreateNewInterlayerUI();
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #8
0
 private void OnCreateNewAnalysisPalletTruck(object sender, EventArgs e)
 {
     try
     {
         NodeTag tag = SelectedNode.Tag as NodeTag;
         ((DocumentSB)tag.Document).CreateNewAnalysisPalletTruckUI();
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #9
0
 private void OnAnalysisExportCollada(object sender, EventArgs e)
 {
     try
     {
         NodeTag tag = SelectedNode.Tag as NodeTag;
         SolutionColladaExportClicked(this, new AnalysisTreeViewEventArgs(tag));
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #10
0
 private void OnEditAnalysis(object sender, EventArgs e)
 {
     try
     {
         NodeTag    tag = SelectedNode.Tag as NodeTag;
         DocumentSB doc = tag.Document as DocumentSB;
         doc.EditAnalysis(tag.Analysis);
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #11
0
 private void OnDocumentClose(object sender, EventArgs e)
 {
     try
     {
         NodeTag         tag = SelectedNode.Tag as NodeTag;
         CancelEventArgs cea = new CancelEventArgs();
         FormMain.GetInstance().CloseDocument((DocumentSB)tag.Document, cea);
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Пример #12
0
        public override bool Equals(object obj)
        {
            NodeTag nodeTag = obj as NodeTag;

            if (null == nodeTag)
            {
                return(false);
            }
            return(_type == nodeTag._type &&
                   _document == nodeTag._document &&
                   _itemBase == nodeTag._itemBase);
        }
Пример #13
0
 void OnNodeLeftDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     try
     {
         SelectedNode = e.Node;
         // handle only left mouse button click
         if (e.Button != MouseButtons.Left)
         {
             return;
         }
         NodeTag          tag     = CurrentTag;
         NodeTag.NodeType tagType = tag.Type;
         if (null != AnalysisNodeClicked &&
             (tag.Type == NodeTag.NodeType.NT_ANALYSIS) ||
             (tag.Type == NodeTag.NodeType.NT_ECTANALYSIS) ||
             (tag.Type == NodeTag.NodeType.NT_BOX) ||
             (tag.Type == NodeTag.NodeType.NT_CASE) ||
             (tag.Type == NodeTag.NodeType.NT_PACK) ||
             (tag.Type == NodeTag.NodeType.NT_BUNDLE) ||
             (tag.Type == NodeTag.NodeType.NT_CYLINDER) ||
             (tag.Type == NodeTag.NodeType.NT_CASEOFBOXES) ||
             (tag.Type == NodeTag.NodeType.NT_PALLET) ||
             (tag.Type == NodeTag.NodeType.NT_INTERLAYER) ||
             (tag.Type == NodeTag.NodeType.NT_PALLETCORNERS) ||
             (tag.Type == NodeTag.NodeType.NT_PALLETCAP) ||
             (tag.Type == NodeTag.NodeType.NT_PALLETFILM) ||
             (tag.Type == NodeTag.NodeType.NT_TRUCK)
             )
         {
             AnalysisNodeClicked(this, new AnalysisTreeViewEventArgs(tag));
             e.Node.Expand();
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Пример #14
0
        private void QueryContextMenuItems(NodeTag nodeTag, ContextMenuStrip contextMenuStrip)
        {
            if (nodeTag.Type == NodeTag.NodeType.NT_DOCUMENT)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBOX, AnalysisTreeView.Box         , new EventHandler(onCreateNewBox)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASE, AnalysisTreeView.Case, new EventHandler(onCreateNewCase)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCYLINDER, AnalysisTreeView.Cylinder, new EventHandler(onCreateNewCylinder)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLET, AnalysisTreeView.Pallet      , new EventHandler(onCreateNewPallet)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWINTERLAYER, AnalysisTreeView.Interlayer, new EventHandler(onCreateNewInterlayer)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBUNDLE, AnalysisTreeView.Bundle      , new EventHandler(onCreateNewBundle)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCORNERS, AnalysisTreeView.PalletCorners, new EventHandler(onCreateNewPalletCorners)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCAP, AnalysisTreeView.PalletCap, new EventHandler(onCreateNewPalletCap)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETFILM, AnalysisTreeView.PalletFilm, new EventHandler(onCreateNewPalletFilm)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWTRUCK, AnalysisTreeView.Truck       , new EventHandler(onCreateNewTruck)));

                if (((DocumentSB)nodeTag.Document).CanCreateCasePalletAnalysis || ((DocumentSB)nodeTag.Document).CanCreateBundlePalletAnalysis || ((DocumentSB)nodeTag.Document).CanCreateBoxCasePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripSeparator());
                if (((DocumentSB)nodeTag.Document).CanCreateCasePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWANALYSIS, AnalysisTreeView.Analysis, new EventHandler(onCreateNewCasePalletAnalysis)));
                if (((DocumentSB)nodeTag.Document).CanCreatePackPalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPACKANALYSIS, AnalysisTreeView.PackAnalysis, new EventHandler(onCreateNewPackPalletAnalysis)));
                if (((DocumentSB)nodeTag.Document).CanCreateBundlePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBUNDLEANALYSIS, AnalysisTreeView.AnalysisBundle, new EventHandler(onCreateNewBundleAnalysis)));
                if (((DocumentSB)nodeTag.Document).CanCreateBoxCaseAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBOXCASEANALYSIS, AnalysisTreeView.BoxCaseAnalysis, new EventHandler(onCreateNewBoxCaseAnalysis)));
                if (((DocumentSB)nodeTag.Document).CanCreateBoxCasePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASEANALYSIS, AnalysisTreeView.CaseAnalysis, new EventHandler(onCreateNewCaseAnalysis)));
                contextMenuStrip.Items.Add(new ToolStripSeparator());
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_CLOSE, null, new EventHandler(onDocumentClose)));
            }
            if (nodeTag.Type == NodeTag.NodeType.NT_BOX
                || nodeTag.Type == NodeTag.NodeType.NT_CASE
                || nodeTag.Type == NodeTag.NodeType.NT_PACK
                || nodeTag.Type == NodeTag.NodeType.NT_CASEOFBOXES
                || nodeTag.Type == NodeTag.NodeType.NT_CYLINDER
                || nodeTag.Type == NodeTag.NodeType.NT_PALLET
                || nodeTag.Type == NodeTag.NodeType.NT_BUNDLE
                || nodeTag.Type == NodeTag.NodeType.NT_INTERLAYER
                || nodeTag.Type == NodeTag.NodeType.NT_TRUCK
                || nodeTag.Type == NodeTag.NodeType.NT_PALLETCORNERS
                || nodeTag.Type == NodeTag.NodeType.NT_PALLETCAP
                || nodeTag.Type == NodeTag.NodeType.NT_PALLETFILM
                )
            {
                string message = string.Format(Resources.ID_DELETE, nodeTag.ItemProperties.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(onDeleteBaseItem)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_CASEPALLETANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.CasePalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditCasePalletAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.CasePalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(onDeleteCasePalletAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_PACKPALLETANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.PackPalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditPackPalletAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.PackPalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(onDeletePackPalletAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_CYLINDERPALLETANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.CylinderPalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditCylinderPalletAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.CylinderPalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onDeleteCylinderPalletAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_HCYLINDERPALLETANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.HCylinderPalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditHCylinderPalletAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.HCylinderPalletAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onDeleteHCylinderPalletAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_BOXCASEANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.BoxCaseAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditBoxCaseAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.BoxCaseAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(onDeleteBoxCaseAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_TRUCKANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.TruckAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditTruckAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.TruckAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(onDeleteTruckAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_ECTANALYSIS)
            {
                string message = string.Format(Resources.ID_EDIT, nodeTag.ECTAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, null, new EventHandler(onEditECTAnalysis)));
                message = string.Format(Resources.ID_DELETE, nodeTag.ECTAnalysis.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(onDeleteECTAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTBOX)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBOX, AnalysisTreeView.Box, new EventHandler(onCreateNewBox)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTCASE)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASE, AnalysisTreeView.Case, new EventHandler(onCreateNewCase)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTCYLINDER)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCYLINDER, AnalysisTreeView.Cylinder, new EventHandler(onCreateNewCylinder)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLET)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLET, AnalysisTreeView.Pallet, new EventHandler(onCreateNewPallet)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTINTERLAYER)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWINTERLAYER, AnalysisTreeView.Interlayer, new EventHandler(onCreateNewInterlayer)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTBUNDLE)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBUNDLE, AnalysisTreeView.Bundle, new EventHandler(onCreateNewBundle)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTTRUCK)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWTRUCK, AnalysisTreeView.Truck, new EventHandler(onCreateNewTruck)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLETCORNERS)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCORNERS, AnalysisTreeView.PalletCorners, new EventHandler(onCreateNewPalletCorners)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLETCAP)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCAP, AnalysisTreeView.PalletCap, new EventHandler(onCreateNewPalletCap)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLETFILM)
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETFILM, AnalysisTreeView.PalletFilm, new EventHandler(onCreateNewPalletFilm)));
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTANALYSIS)
            {
                if (nodeTag.Document.CanCreateCasePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWANALYSIS, AnalysisTreeView.Analysis, new EventHandler(onCreateNewCasePalletAnalysis)));
                if (nodeTag.Document.CanCreateBundlePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBUNDLEANALYSIS, AnalysisTreeView.AnalysisBundle, new EventHandler(onCreateNewBundleAnalysis)));
                if (nodeTag.Document.CanCreatePackPalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPACKANALYSIS, AnalysisTreeView.PackAnalysis, new EventHandler(onCreateNewPackPalletAnalysis)));
                if (nodeTag.Document.CanCreateBoxCaseAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBOXCASEANALYSIS, AnalysisTreeView.BoxCaseAnalysis, new EventHandler(onCreateNewBoxCaseAnalysis)));
                if (nodeTag.Document.CanCreateBoxCasePalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASEANALYSIS, AnalysisTreeView.CaseAnalysis, new EventHandler(onCreateNewCaseAnalysis)));
                if (nodeTag.Document.CanCreateCylinderPalletAnalysis)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCYLINDERANALYSIS, AnalysisTreeView.CylinderPalletAnalysis, new EventHandler(onCreateNewCylinderPalletAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_CASEPALLETANALYSISSOLUTION)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_UNSELECTSOLUTION, nodeTag.SelSolution.Solution.Title), AnalysisTreeView.DELETE, new EventHandler(onUnselectCasePalletAnalysisSolution)));
                if (nodeTag.Document.Trucks.Count > 0 && !nodeTag.SelSolution.HasDependingAnalyses)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWTRUCKANALYSIS, AnalysisTreeView.TruckAnalysis, new EventHandler(onCreateNewTruckAnalysis)));
                if (!nodeTag.SelSolution.HasECTAnalyses)
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWECTANALYSIS, AnalysisTreeView.AnalysisStackingStrength, new EventHandler(onCreateNewECTAnalysis)));
                if (nodeTag.CasePalletAnalysis.IsBoxAnalysis)
                {
                    BoxProperties bProperties = nodeTag.CasePalletAnalysis.BProperties as BoxProperties;
                    if (bProperties.HasInsideDimensions) // BoxProperties must also have inside dimensions
                        contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_SENDTODATABASE, AnalysisTreeView.Database, new EventHandler(onSendSolutionToDatabase)));
                }
                string message = string.Format(Resources.ID_GENERATEREPORTHTML, nodeTag.SelSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.HTML, new EventHandler(onAnalysisReportHTML)));
                message = string.Format(Resources.ID_GENERATEREPORTMSWORD, nodeTag.SelSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.WORD, new EventHandler(onAnalysisReportMSWord)));
                message = string.Format(Resources.ID_GENERATEREPORTPDF, nodeTag.SelSolution.Name);
                if (nodeTag.CasePalletAnalysis.IsBoxAnalysis && Settings.Default.ShowLogConsole)
                {
                    message = string.Format(Resources.ID_GENERATECOLLADA, nodeTag.SelSolution.Name);
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.COLLADAWEBGL, new EventHandler(onAnalysisExportCollada)));
                }
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_PACKPALLETANALYSISSOLUTION)
            {
                string message = string.Format(Resources.ID_GENERATEREPORTHTML, nodeTag.SelPackPalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.HTML, new EventHandler(onAnalysisReportHTML)));
                message = string.Format(Resources.ID_GENERATEREPORTMSWORD, nodeTag.SelPackPalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.WORD, new EventHandler(onAnalysisReportMSWord)));
                message = string.Format(Resources.ID_GENERATEREPORTPDF, nodeTag.SelPackPalletSolution.Name);
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_CYLINDERPALLETANALYSISSOLUTION)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_UNSELECTSOLUTION, nodeTag.SelCylinderPalletSolution.Solution.Title)
                    , AnalysisTreeView.DELETE, new EventHandler(onUnselectCylinderPalletAnalysisSolution)));
                string message = string.Format(Resources.ID_GENERATEREPORTHTML, nodeTag.SelCylinderPalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.HTML, new EventHandler(onAnalysisReportHTML)));
                message = string.Format(Resources.ID_GENERATEREPORTMSWORD, nodeTag.SelCylinderPalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.WORD, new EventHandler(onAnalysisReportMSWord)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_HCYLINDERPALLETANALYSISSOLUTION)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_UNSELECTSOLUTION, nodeTag.SelHCylinderPalletSolution.Solution.Title)
                    , AnalysisTreeView.DELETE, new EventHandler(onUnselectHCylinderPalletAnalysisSolution)));
                string message = string.Format(Resources.ID_GENERATEREPORTHTML, nodeTag.SelHCylinderPalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.HTML, new EventHandler(onAnalysisReportHTML)));
                message = string.Format(Resources.ID_GENERATEREPORTMSWORD, nodeTag.SelHCylinderPalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.WORD, new EventHandler(onAnalysisReportMSWord)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_BOXCASEANALYSISSOLUTION)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_UNSELECTSOLUTION, nodeTag.SelBoxCaseSolution.Solution.Title), AnalysisTreeView.DELETE, new EventHandler(onUnselectBoxCaseAnalysisSolution)));
                string message = string.Format(Resources.ID_GENERATEREPORTHTML, nodeTag.SelBoxCaseSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.HTML, new EventHandler(onAnalysisReportHTML)));
                message = string.Format(Resources.ID_GENERATEREPORTMSWORD, nodeTag.SelBoxCaseSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.WORD, new EventHandler(onAnalysisReportMSWord)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_BOXCASEPALLETANALYSIS)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_EDIT, nodeTag.CaseAnalysis.Name), null, new EventHandler(onEditCaseAnalysis)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_DELETE, nodeTag.CaseAnalysis.Name), AnalysisTreeView.DELETE, new EventHandler(onDeleteCaseAnalysis)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_CASESOLUTION)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(string.Format(Resources.ID_UNSELECTSOLUTION, nodeTag.SelBoxCasePalletSolution.Solution.Title), AnalysisTreeView.DELETE, new EventHandler(onUnselectBoxCasePalletAnalysisSolution)));
                string message = string.Format(Resources.ID_GENERATEREPORTHTML, nodeTag.SelBoxCasePalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.HTML, new EventHandler(onAnalysisReportHTML)));
                message = string.Format(Resources.ID_GENERATEREPORTMSWORD, nodeTag.SelBoxCasePalletSolution.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.WORD, new EventHandler(onAnalysisReportMSWord)));
            }
        }
Пример #15
0
 internal TreeNode FindNode(TreeNode node, NodeTag nodeTag)
 {
     // check with node itself
     if (null != node)
     {
         NodeTag tag = node.Tag as NodeTag;
         if (null == tag)
         {
             _log.Error(string.Format("Node {0} has no valid NodeTag", node.Text));
             return null;
         }
         if (tag.Equals(nodeTag))
             return node;
     }
     // check with child nodes
     TreeNodeCollection tnCollection = null == node ? Nodes : node.Nodes;
     foreach (TreeNode tn in tnCollection)
     {
         TreeNode tnResult = FindNode(tn, nodeTag);
         if (null != tnResult)
             return tnResult;
     }
     return null;
 }
Пример #16
0
 /// <summary>
 /// Constructor takes the clicked node tag as argument
 /// </summary>
 /// <param name="nodeTag"></param>
 public AnalysisTreeViewEventArgs(NodeTag nodeTag)
 {
     _nodeTag = nodeTag;
 }
Пример #17
0
        private void QueryContextMenuItems(NodeTag nodeTag, ContextMenuStrip contextMenuStrip)
        {
            if (nodeTag.Type == NodeTag.NodeType.NT_DOCUMENT)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBOX, AnalysisTreeView.Box, new EventHandler(OnCreateNewBox)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASE, AnalysisTreeView.Case, new EventHandler(OnCreateNewCase)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCYLINDER, AnalysisTreeView.Cylinder, new EventHandler(OnCreateNewCylinder)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLET, AnalysisTreeView.Pallet, new EventHandler(OnCreateNewPallet)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWINTERLAYER, AnalysisTreeView.Interlayer, new EventHandler(OnCreateNewInterlayer)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBUNDLE, AnalysisTreeView.Bundle, new EventHandler(OnCreateNewBundle)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCORNERS, AnalysisTreeView.PalletCorners, new EventHandler(OnCreateNewPalletCorners)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCAP, AnalysisTreeView.PalletCap, new EventHandler(OnCreateNewPalletCap)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETFILM, AnalysisTreeView.PalletFilm, new EventHandler(OnCreateNewPalletFilm)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWTRUCK, AnalysisTreeView.Truck, new EventHandler(OnCreateNewTruck)));

                if (((DocumentSB)nodeTag.Document).CanCreateAnalysisCasePallet || ((DocumentSB)nodeTag.Document).CanCreateOptiCasePallet)
                {
                    contextMenuStrip.Items.Add(new ToolStripSeparator());
                }
                if (((DocumentSB)nodeTag.Document).CanCreateAnalysisCasePallet)
                {
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWANALYSIS, AnalysisTreeView.AnalysisCasePallet, new EventHandler(OnCreateNewAnalysisCasePallet)));
                }

                /*
                 * if (((DocumentSB)nodeTag.Document).CanCreateOptiCasePallet)
                 *  contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASEANALYSIS, AnalysisTreeView.AnalysisCase, new EventHandler(onCreateNewAnalysisCase)));
                 */
                contextMenuStrip.Items.Add(new ToolStripSeparator());
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_CLOSE, null, new EventHandler(OnDocumentClose)));
            }
            if (nodeTag.Type == NodeTag.NodeType.NT_BOX ||
                nodeTag.Type == NodeTag.NodeType.NT_CASE ||
                nodeTag.Type == NodeTag.NodeType.NT_PACK ||
                nodeTag.Type == NodeTag.NodeType.NT_CASEOFBOXES ||
                nodeTag.Type == NodeTag.NodeType.NT_CYLINDER ||
                nodeTag.Type == NodeTag.NodeType.NT_PALLET ||
                nodeTag.Type == NodeTag.NodeType.NT_BUNDLE ||
                nodeTag.Type == NodeTag.NodeType.NT_INTERLAYER ||
                nodeTag.Type == NodeTag.NodeType.NT_TRUCK ||
                nodeTag.Type == NodeTag.NodeType.NT_PALLETCORNERS ||
                nodeTag.Type == NodeTag.NodeType.NT_PALLETCAP ||
                nodeTag.Type == NodeTag.NodeType.NT_PALLETFILM
                )
            {
                string message = string.Format(Resources.ID_DELETEITEM, nodeTag.ItemProperties.Name);
                contextMenuStrip.Items.Add(new ToolStripMenuItem(message, AnalysisTreeView.DELETE, new EventHandler(OnDeleteBaseItem)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTBOX)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBOX, AnalysisTreeView.Box, new EventHandler(OnCreateNewBox)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTCASE)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCASE, AnalysisTreeView.Case, new EventHandler(OnCreateNewCase)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTCYLINDER)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCYLINDER, AnalysisTreeView.Cylinder, new EventHandler(OnCreateNewCylinder)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLET)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLET, AnalysisTreeView.Pallet, new EventHandler(OnCreateNewPallet)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTINTERLAYER)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWINTERLAYER, AnalysisTreeView.Interlayer, new EventHandler(OnCreateNewInterlayer)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTBUNDLE)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWBUNDLE, AnalysisTreeView.Bundle, new EventHandler(OnCreateNewBundle)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTTRUCK)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWTRUCK, AnalysisTreeView.Truck, new EventHandler(OnCreateNewTruck)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLETCORNERS)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCORNERS, AnalysisTreeView.PalletCorners, new EventHandler(OnCreateNewPalletCorners)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLETCAP)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETCAP, AnalysisTreeView.PalletCap, new EventHandler(OnCreateNewPalletCap)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTPALLETFILM)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWPALLETFILM, AnalysisTreeView.PalletFilm, new EventHandler(OnCreateNewPalletFilm)));
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_LISTANALYSIS)
            {
                if (nodeTag.Document.CanCreateAnalysisCasePallet)
                {
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWANALYSIS, AnalysisTreeView.AnalysisCasePallet, new EventHandler(OnCreateNewAnalysisCasePallet)));
                }
                if (nodeTag.Document.CanCreateAnalysisCylinderPallet)
                {
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWCYLINDERANALYSIS, AnalysisTreeView.AnalysisCylinderPallet, new EventHandler(OnCreateNewAnalysisCylinderPallet)));
                }
                if (nodeTag.Document.CanCreateAnalysisPalletTruck)
                {
                    contextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.ID_ADDNEWTRUCKANALYSIS, AnalysisTreeView.AnalysisTruck, new EventHandler(OnCreateNewAnalysisPalletTruck)));
                }
            }
            else if (nodeTag.Type == NodeTag.NodeType.NT_ANALYSIS)
            {
                contextMenuStrip.Items.Add(new ToolStripMenuItem(
                                               string.Format(Resources.ID_EDIT, nodeTag.Analysis.Name), null
                                               , new EventHandler(OnEditAnalysis)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(
                                               string.Format(Resources.ID_DELETEITEM, nodeTag.Analysis.Name), AnalysisTreeView.DELETE
                                               , new EventHandler(OnDeleteBaseItem)));
                contextMenuStrip.Items.Add(new ToolStripMenuItem(
                                               string.Format(Resources.ID_GENERATEREPORT, nodeTag.Analysis.Name), AnalysisTreeView.WORD
                                               , new EventHandler(OnAnalysisReport)));
            }
        }
Пример #18
0
 /// <summary>
 /// Constructor takes the clicked node tag as argument
 /// </summary>
 /// <param name="nodeTag"></param>
 public AnalysisTreeViewEventArgs(NodeTag nodeTag)
 {
     _nodeTag = nodeTag;
 }