/// <summary>
        /// constructor
        /// </summary>
        public DockContentECTAnalysis(DocumentSB document, ECTAnalysis ectAnalysis)
        {
            _document = document;
            _ectAnalysis = ectAnalysis;
            _ectAnalysis.AddListener(this);

            InitializeComponent();
            // set unit labels
            UnitsManager.AdaptUnitLabels(this);
        }
        public ECTAnalysis CreateNewECTAnalysis(string name, string description)
        {
            ECTAnalysis ectAnalysis = new ECTAnalysis(this.ParentDocument, _analysis, this);

            _ectAnalyses.Add(ectAnalysis);
            AddDependancy(ectAnalysis);
            ParentDocument.NotifyOnNewECTAnalysisCreated(_analysis, this, ectAnalysis);
            ParentDocument.Modify();

            return(ectAnalysis);
        }
 internal void NotifyOnNewECTAnalysisCreated(CasePalletAnalysis analysis, SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis)
 {
     foreach (IDocumentListener listener in _listeners)
         listener.OnNewECTAnalysisCreated(this, analysis, selSolution, ectAnalysis);
 }
 internal void NotifyOnECTAnalysisRemoved(SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis)
 {
     foreach (IDocumentListener listener in _listeners)
         listener.OnECTAnalysisRemoved(this, selSolution.Analysis, selSolution, ectAnalysis);
 }
 public void Save(ECTAnalysis ectAnalysis, bool unique, XmlElement ectAnalysesElt, XmlDocument xmlDoc)
 {
     XmlElement ectAnalysisElt = xmlDoc.CreateElement("EctAnalysis");
     ectAnalysesElt.AppendChild(ectAnalysisElt);
     // name
     XmlAttribute nameAttribute = xmlDoc.CreateAttribute("Name");
     nameAttribute.Value = ectAnalysis.Name;
     ectAnalysisElt.Attributes.Append(nameAttribute);
     // description
     XmlAttribute descriptionAttribute = xmlDoc.CreateAttribute("Description");
     descriptionAttribute.Value = ectAnalysis.Description;
     ectAnalysisElt.Attributes.Append(descriptionAttribute);
     // cardboard
     XmlElement cardboardElt = xmlDoc.CreateElement("Cardboard");
     ectAnalysesElt.AppendChild(cardboardElt);
     // - name
     XmlAttribute nameCardboardAttribute = xmlDoc.CreateAttribute("Name");
     nameCardboardAttribute.Value = ectAnalysis.Cardboard.Name;
     cardboardElt.Attributes.Append(nameCardboardAttribute);
     // - thickness
     XmlAttribute thicknessAttribute = xmlDoc.CreateAttribute("Thickness");
     thicknessAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", ectAnalysis.Cardboard.Thickness);
     cardboardElt.Attributes.Append(thicknessAttribute);
      // - ect
     XmlAttribute ectAttribute = xmlDoc.CreateAttribute("ECT");
     ectAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", ectAnalysis.Cardboard.ECT);
     cardboardElt.Attributes.Append(ectAttribute);
     // - stiffnessX
     XmlAttribute stiffnessAttributeX = xmlDoc.CreateAttribute("StiffnessX");
     stiffnessAttributeX.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", ectAnalysis.Cardboard.RigidityDX);
     cardboardElt.Attributes.Append(stiffnessAttributeX);
     // - stiffnessY
     XmlAttribute stiffnessAttributeY = xmlDoc.CreateAttribute("StiffnessY");
     stiffnessAttributeY.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", ectAnalysis.Cardboard.RigidityDY);
     cardboardElt.Attributes.Append(stiffnessAttributeY);
     // case type
     XmlAttribute caseTypeAttribute = xmlDoc.CreateAttribute("CaseType");
     caseTypeAttribute.Value = ectAnalysis.CaseType;
     ectAnalysisElt.Attributes.Append(caseTypeAttribute);
     // print surface
     XmlAttribute printSurfaceAttribute = xmlDoc.CreateAttribute("PrintSurface");
     printSurfaceAttribute.Value = ectAnalysis.PrintSurface;
     ectAnalysesElt.Attributes.Append(printSurfaceAttribute);
     // mc kee formula mode
     XmlAttribute mcKeeFormulaAttribute = xmlDoc.CreateAttribute("McKeeFormulaMode");
     mcKeeFormulaAttribute.Value = ectAnalysis.McKeeFormulaText;
     ectAnalysisElt.Attributes.Append(mcKeeFormulaAttribute);
 }
 /// <summary>
 /// handles new ECT analysis created
 /// </summary>
 public void OnNewECTAnalysisCreated(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis)
 {
     // get parent node
     TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_CASEPALLETANALYSISSOLUTION, doc, analysis, selSolution));
     // insert truckAnalysis node
     TreeNode nodeECTAnalysis = new TreeNode(ectAnalysis.Name, 19, 19);
     nodeECTAnalysis.Tag = new NodeTag(NodeTag.NodeType.NT_ECTANALYSIS, doc, analysis, selSolution, ectAnalysis);
     parentNode.Nodes.Add(nodeECTAnalysis);
     // expand parent tree node
     parentNode.Expand();
 }
 /// <summary>
 /// handles ECT analysis removal
 /// </summary>
 public void OnECTAnalysisRemoved(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis)
 {
     // get node
     TreeNode ectAnalysisNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_ECTANALYSIS, doc, analysis, selSolution, ectAnalysis));
     // test
     if (null == ectAnalysisNode)
     {
         _log.Warn(string.Format("Failed to find a valid tree node for truck analysis {0}", ectAnalysis.Name));
     }
     // remove node
     Nodes.Remove(ectAnalysisNode);
 }
 public NodeTag(NodeType type, Document document, CasePalletAnalysis analysis, SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis)
 {
     _type = type;
     _document = document;
     _itemProperties = null;
     _casePalletAnalysis = analysis;
     _selSolution = selSolution;
     _ectAnalysis = ectAnalysis;
 }
 /// <summary>
 /// Removes an ect analysis
 /// </summary>
 /// <param name="ectAnalysis"></param>
 public void RemoveECTAnalysis(ECTAnalysis ectAnalysis)
 {
     ParentDocument.RemoveItem(ectAnalysis);
     _ectAnalyses.Remove(ectAnalysis);
 }
        public ECTAnalysis CreateNewECTAnalysis(string name, string description)
        {
            ECTAnalysis ectAnalysis = new ECTAnalysis(this.ParentDocument, _analysis, this);
            _ectAnalyses.Add(ectAnalysis);
            AddDependancy(ectAnalysis);
            ParentDocument.NotifyOnNewECTAnalysisCreated(_analysis, this, ectAnalysis);
            ParentDocument.Modify();

            return ectAnalysis;
        }
Exemple #11
0
 public void OnECTAnalysisRemoved(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selectedSolution, ECTAnalysis ectAnalysis)
 {
 }
 /// <summary>
 /// Edit given ECT analysis
 /// </summary>
 /// <param name="ectAnalysis"></param>
 public void EditECTAnalysis(ECTAnalysis ectAnalysis)
 {
     // uses FormMain.CreateOrActivateViewECTAnalysis
 }
 /// <summary>
 /// creates a new DockContentECTAnalysis view
 /// </summary>
 public DockContentECTAnalysis CreateECTAnalysisView(ECTAnalysis analysis)
 {
     DockContentECTAnalysis form = new DockContentECTAnalysis(this, analysis);
     AddView(form);
     return form;
 }
Exemple #14
0
 /// <summary>
 /// Removes an ect analysis
 /// </summary>
 /// <param name="ectAnalysis"></param>
 public void RemoveECTAnalysis(ECTAnalysis ectAnalysis)
 {
     ParentDocument.RemoveItem(ectAnalysis);
     _ectAnalyses.Remove(ectAnalysis);
 }
 public void OnNewECTAnalysisCreated(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis)
 {
 }
 /// <summary>
 /// ECT analysis view
 /// </summary>
 public void CreateOrActivateViewECTAnalysis(ECTAnalysis analysis)
 {
     // search among existing views
     foreach (IDocument doc in Documents)
         foreach (IView view in doc.Views)
         {
             DockContentECTAnalysis form = view as DockContentECTAnalysis;
             if (null == form) continue;
             if (analysis == form.ECTAnalysis)
             {
                 form.Activate();
                 return;
             }
         }
     // ---> not found
     // ---> create new form
     // get document
     DocumentSB parentDocument = analysis.ParentDocument as DocumentSB;
     // instantiate form
     DockContentECTAnalysis formECTAnalysis = parentDocument.CreateECTAnalysisView(analysis);
     // show docked
     formECTAnalysis.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
 }