Exemplo n.º 1
0
        void DocumentTreeView_SolutionColladaExportClicked(object sender, AnalysisTreeViewEventArgs eventArg)
        {
            try
            {
                DocumentSB doc = eventArg.Document as DocumentSB;
                string htmlFilePath = Path.ChangeExtension(doc.FilePath, "html");

                // get file path
                saveFileDialogWebGL.InitialDirectory = Path.GetDirectoryName(htmlFilePath);
                saveFileDialogWebGL.FileName = htmlFilePath;
                if (DialogResult.OK != saveFileDialogWebGL.ShowDialog())
                    return;
                htmlFilePath = saveFileDialogWebGL.FileName;

                // export collada file
                string colladaFilePath = Path.ChangeExtension(htmlFilePath, "dae");
                try
                {
                    Exporter exporter = new ColladaExporter.Exporter(eventArg.SelSolution.Solution);
                    exporter.Export(colladaFilePath);
                }
                catch (Exception ex)
                {
                    _log.Error(ex.ToString()); Program.SendCrashReport(ex);
                    return;
                }

                // browse with google chrome
                if (ColladaExporter.Exporter.ChromeInstalled)
                    ColladaExporter.Exporter.BrowseWithGoogleChrome(colladaFilePath);
                else
                    MessageBox.Show(Resources.ID_CHROMEISNOTINSTALLED, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString()); Program.SendCrashReport(ex);
            }
        }
Exemplo n.º 2
0
 void DocumentTreeView_MenuEditCylinderAnalysis(object sender, AnalysisTreeViewEventArgs eventArg)
 {
     try
     {
         DocumentSB doc = eventArg.Document as DocumentSB;
         if ((null != doc) && (null != eventArg.CylinderAnalysis))
             doc.EditCylinderPalletAnalysis(eventArg.CylinderAnalysis);
         CreateOrActivateViewCylinderPalletAnalysis(eventArg.CylinderAnalysis);
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString()); Program.SendCrashReport(ex);
     }
 }
Exemplo n.º 3
0
        void DocumentTreeView_TruckAnalysisNodeClicked(object sender, AnalysisTreeViewEventArgs eventArg)
        {
            try
            {
                if ((null == eventArg.ItemBase) && (null != eventArg.Analysis) && (null != eventArg.SelSolution) && (null != eventArg.TruckAnalysis))
                { 

                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());  Program.SendCrashReport(ex);
            }
        }
Exemplo n.º 4
0
 private void DocumentTreeView_SolutionReportHtmlClicked(object sender, AnalysisTreeViewEventArgs eventArg)
 {
     try
     {
         // build output file path
         string outputFilePath = Path.ChangeExtension(Path.GetTempFileName(), "html");
         // getting current culture
         string cultAbbrev = System.Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName;
         // build report
         ReportData reportObject = new ReportData(
                 eventArg.Analysis, eventArg.SelSolution
                 , eventArg.CylinderAnalysis, eventArg.SelCylinderPalletSolution
                 , eventArg.HCylinderAnalysis, eventArg.SelHCylinderPalletSolution
                 , eventArg.BoxCaseAnalysis, eventArg.SelBoxCaseSolution
                 , eventArg.BoxCasePalletAnalysis, eventArg.SelBoxCasePalletSolution
                 , eventArg.PackPalletAnalysis, eventArg.SelPackPalletSolution
                 );
         Reporter.CompanyLogo = Properties.Settings.Default.CompanyLogoPath;
         Reporter.ImageSizeSetting = (Reporter.eImageSize)Properties.Settings.Default.ReporterImageSize;
         ReporterHtml reporter = new ReporterHtml(
             reportObject
             , Settings.Default.ReportTemplatePath
             , outputFilePath);
         // logging
         _log.Debug(string.Format("Saved report to {0}", outputFilePath));
         // open resulting report
         DocumentSB parentDocument = eventArg.Document as DocumentSB;
         DockContentReport dockContent = CreateOrActivateHtmlReport(reportObject, outputFilePath);
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Exemplo n.º 5
0
 public void DocumentTreeView_SolutionReportPDFNodeClicked(object sender, AnalysisTreeViewEventArgs eventArg)
 {
 }
Exemplo n.º 6
0
 private void DocumentTreeView_SolutionReportNodeClicked(object sender, AnalysisTreeViewEventArgs eventArg)
 {
     try
     {
         // build analysis name
         string analysisName = string.Empty;
         if (null != eventArg.Analysis) analysisName = eventArg.Analysis.Name;
         else if (null != eventArg.PackPalletAnalysis) analysisName = eventArg.PackPalletAnalysis.Name;
         else if (null != eventArg.BoxCaseAnalysis) analysisName = eventArg.BoxCaseAnalysis.Name;
         else if (null != eventArg.BoxCasePalletAnalysis) analysisName = eventArg.BoxCasePalletAnalysis.Name;
         else if (null != eventArg.CylinderAnalysis) analysisName = eventArg.CylinderAnalysis.Name;
         else if (null != eventArg.HCylinderAnalysis) analysisName = eventArg.HCylinderAnalysis.Name;
         else
         {
             _log.Error("Unsupported analysis type ?");
             return;
         }
         // save file dialog
         SaveFileDialog dlg = new SaveFileDialog();
         dlg.InitialDirectory = Properties.Settings.Default.ReportInitialDirectory;
         dlg.FileName = Path.ChangeExtension(CleanString(analysisName), "doc");
         dlg.Filter = Resources.ID_FILTER_MSWORD;
         dlg.DefaultExt = "doc";
         dlg.ValidateNames = true;
         if (DialogResult.OK == dlg.ShowDialog())
         {
             // build output file path
             string outputFilePath = dlg.FileName;
             string htmlFilePath = Path.ChangeExtension(outputFilePath, "html");
             // save directory
             Properties.Settings.Default.ReportInitialDirectory = Path.GetDirectoryName(dlg.FileName);
             // getting current culture
             string cultAbbrev = System.Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName;
             // build report
             ReportData reportObject = new ReportData(
                     eventArg.Analysis, eventArg.SelSolution
                     , eventArg.CylinderAnalysis, eventArg.SelCylinderPalletSolution
                     , eventArg.HCylinderAnalysis, eventArg.SelHCylinderPalletSolution
                     , eventArg.BoxCaseAnalysis, eventArg.SelBoxCaseSolution
                     , eventArg.BoxCasePalletAnalysis, eventArg.SelBoxCasePalletSolution
                     , eventArg.PackPalletAnalysis, eventArg.SelPackPalletSolution
                     );
             Reporter.CompanyLogo = Properties.Settings.Default.CompanyLogoPath;
             Reporter.ImageSizeSetting = (Reporter.eImageSize)Properties.Settings.Default.ReporterImageSize;
             ReporterMSWord reporter = new ReporterMSWord(
                 reportObject
                 , Settings.Default.ReportTemplatePath
                 , dlg.FileName
                 , new Margins());
         }
     }
     catch (System.Runtime.InteropServices.COMException ex)
     {
         _log.Error("MS Word not installed? : "+ ex.Message);
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Exemplo n.º 7
0
        // ### AnalysisNodeClicked
        void DocumentTreeView_NodeClicked(object sender, AnalysisTreeViewEventArgs eventArg)
        {
            if ((null == eventArg.ItemBase) && (null != eventArg.Analysis)
                && (null == eventArg.TruckAnalysis) && (null == eventArg.ECTAnalysis))
            {
                CaseOfBoxesProperties caseOfBoxes = eventArg.Analysis.BProperties as CaseOfBoxesProperties;
                if (null != caseOfBoxes)
                    CreateOrActivateViewPalletAnalysisWithBox(eventArg.Analysis);
                else
                    CreateOrActivateViewCasePalletAnalysis(eventArg.Analysis);
            }
            else if ((null == eventArg.ItemBase) && (null == eventArg.Analysis) && (null != eventArg.PackPalletAnalysis)
                && (null == eventArg.CylinderAnalysis) && (null == eventArg.HCylinderAnalysis)
                && (null == eventArg.TruckAnalysis) && (null == eventArg.ECTAnalysis))
            {
                CreateOrActivateViewPackPalletAnalysis(eventArg.PackPalletAnalysis);
            }
            else if ((null == eventArg.ItemBase) && (null == eventArg.Analysis)
                && (null != eventArg.CylinderAnalysis) && (null == eventArg.HCylinderAnalysis)
                && (null == eventArg.TruckAnalysis) && (null == eventArg.ECTAnalysis))
            {
                CreateOrActivateViewCylinderPalletAnalysis(eventArg.CylinderAnalysis);
            }
            else if ((null == eventArg.ItemBase) && (null == eventArg.Analysis)
                && (null == eventArg.CylinderAnalysis) && (null != eventArg.HCylinderAnalysis)
                && (null == eventArg.TruckAnalysis) && (null == eventArg.ECTAnalysis))
            {
                CreateOrActivateViewHCylinderPalletAnalysis(eventArg.HCylinderAnalysis);
            }
            else if (null != eventArg.ItemBase)
            {
                ItemBase itemProp = eventArg.ItemBase;
                if (itemProp.GetType() == typeof(BoxProperties))
                {
                    BoxProperties box = itemProp as BoxProperties;
                    FormNewBox form = new FormNewBox(eventArg.Document, eventArg.ItemBase as BoxProperties);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(box)) return;
                        box.Name = form.BoxName;
                        box.Description = form.Description;
                        box.Length = form.BoxLength;
                        box.Width = form.BoxWidth;
                        box.Height = form.BoxHeight;
                        box.Weight = form.Weight;
                        box.NetWeight = form.NetWeight;
                        box.InsideLength = form.InsideLength;
                        box.InsideWidth = form.InsideWidth;
                        box.InsideHeight = form.InsideHeight;
                        box.SetAllColors(form.Colors);
                        box.TextureList = form.TextureList;
                        box.ShowTape = form.ShowTape;
                        box.TapeWidth = form.TapeWidth;
                        box.TapeColor = form.TapeColor;
                        box.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(PackProperties))
                {
                    PackProperties pack = itemProp as PackProperties;
                    FormNewPack form = new FormNewPack(eventArg.Document, eventArg.ItemBase as PackProperties);
                    form.Boxes = eventArg.Document.Boxes;

                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(pack)) return;
                        pack.Name = form.ItemName;
                        pack.Description = form.ItemDescription;
                        pack.Box = form.SelectedBox;
                        pack.BoxOrientation = form.BoxOrientation;
                        pack.Arrangement = form.Arrangement;
                        pack.Wrap = form.Wrapper;
                        if (form.HasForcedOuterDimensions)
                            pack.ForceOuterDimensions(form.OuterDimensions);
                        pack.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(CylinderProperties))
                {
                    CylinderProperties cylinderProperties = itemProp as CylinderProperties;
                    FormNewCylinder form = new FormNewCylinder(eventArg.Document, cylinderProperties);
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (!UserAcknowledgeDependancies(cylinderProperties)) return;
                        cylinderProperties.Name = form.CylinderName;
                        cylinderProperties.Description = form.Description;
                        cylinderProperties.RadiusOuter = form.RadiusOuter;
                        cylinderProperties.RadiusInner = form.RadiusInner;
                        cylinderProperties.Height = form.CylinderHeight;
                        cylinderProperties.Weight = form.Weight;
                        cylinderProperties.ColorTop = form.ColorTop;
                        cylinderProperties.ColorWallOuter = form.ColorWallOuter;
                        cylinderProperties.ColorWallInner = form.ColorWallInner;
                        cylinderProperties.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(CaseOfBoxesProperties))
                {
                    CaseOfBoxesProperties caseOfBoxes = itemProp as CaseOfBoxesProperties;
                    FormNewCaseOfBoxes form = new FormNewCaseOfBoxes(eventArg.Document, caseOfBoxes);
                    form.CaseName = itemProp.Name;
                    form.CaseDescription = itemProp.Description;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (!UserAcknowledgeDependancies(caseOfBoxes)) return;
                        caseOfBoxes.Name = form.CaseName;
                        caseOfBoxes.Description = form.CaseDescription;
                        caseOfBoxes.SetAllColors(form.Colors);
                        caseOfBoxes.TextureList = form.TextureList;
                        caseOfBoxes.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(BundleProperties))
                {
                    BundleProperties bundle = itemProp as BundleProperties;
                    FormNewBundle form = new FormNewBundle(eventArg.Document, bundle);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(bundle)) return;
                        bundle.Name = form.BundleName;
                        bundle.Description = form.Description;
                        bundle.Length = form.BundleLength;
                        bundle.Width = form.BundleWidth;
                        bundle.UnitThickness = form.UnitThickness;
                        bundle.UnitWeight = form.UnitWeight;
                        bundle.NoFlats = form.NoFlats;
                        bundle.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(InterlayerProperties))
                {
                    InterlayerProperties interlayer = itemProp as InterlayerProperties;
                    FormNewInterlayer form = new FormNewInterlayer(eventArg.Document, interlayer);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(interlayer)) return;
                        interlayer.Name = form.InterlayerName;
                        interlayer.Description = form.Description;
                        interlayer.Length = form.InterlayerLength;
                        interlayer.Width = form.InterlayerWidth;
                        interlayer.Thickness = form.Thickness;
                        interlayer.Weight = form.Weight;
                        interlayer.Color = form.Color;
                        interlayer.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(PalletProperties))
                {
                    PalletProperties pallet = itemProp as PalletProperties;
                    FormNewPallet form = new FormNewPallet(eventArg.Document, pallet);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(pallet)) return;
                        pallet.Name = form.PalletName;
                        pallet.Description = form.Description;
                        pallet.Length = form.PalletLength;
                        pallet.Width = form.PalletWidth;
                        pallet.Height = form.PalletHeight;
                        pallet.Weight = form.Weight;
                        pallet.TypeName = form.PalletTypeName;
                        pallet.Color = form.PalletColor;
                        pallet.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(TruckProperties))
                {
                    TruckProperties truck = itemProp as TruckProperties;
                    FormNewTruck form = new FormNewTruck(eventArg.Document, truck);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(truck)) return;
                        truck.Name = form.TruckName;
                        truck.Description = form.Description;
                        truck.Length = form.TruckLength;
                        truck.Width = form.TruckWidth;
                        truck.Height = form.TruckHeight;
                        truck.AdmissibleLoadWeight = form.TruckAdmissibleLoadWeight;
                        truck.Color = form.TruckColor;
                        truck.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(PalletCornerProperties))
                {
                    PalletCornerProperties corner = itemProp as PalletCornerProperties;
                    FormNewPalletCorners form = new FormNewPalletCorners(eventArg.Document, corner);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(corner)) return;
                        corner.Name = form.ItemName;
                        corner.Description = form.ItemDescription;
                        corner.Length = form.CornerLength;
                        corner.Width = form.CornerWidth;
                        corner.Thickness = form.CornerThickness;
                        corner.Color = form.CornerColor;
                        corner.EndUpdate();                    
                    }
                }
                else if (itemProp.GetType() == typeof(PalletCapProperties))
                {
                    PalletCapProperties cap = itemProp as PalletCapProperties;
                    FormNewPalletCap form = new FormNewPalletCap(eventArg.Document, cap);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        if (!UserAcknowledgeDependancies(cap)) return;
                        cap.Name = form.ItemName;
                        cap.Description = form.ItemDescription;
                        cap.Color = form.CapColor;
                        cap.Length = form.CapLength;
                        cap.Width = form.CapWidth;
                        cap.Height = form.CapHeight;
                        cap.InsideLength = form.CapInnerLength;
                        cap.InsideWidth = form.CapInnerWidth;
                        cap.InsideHeight = form.CapInnerHeight;
                        cap.EndUpdate();
                    }
                }
                else if (itemProp.GetType() == typeof(PalletFilmProperties))
                {
                    PalletFilmProperties film = itemProp as PalletFilmProperties;
                    FormNewPalletFilm form = new FormNewPalletFilm(eventArg.Document, film);
                    if (DialogResult.OK == form.ShowDialog())
                    {
                        film.Name = form.ItemName;
                        film.Description = form.ItemDescription;
                        film.UseTransparency = form.UseTransparency;
                        film.UseHatching = form.UseHatching;
                        film.HatchSpacing = form.HatchSpacing;
                        film.HatchAngle = form.HatchAngle;
                        film.Color = form.FilmColor;
                        film.EndUpdate();
                    }
                }
                else
                    Debug.Assert(false);
            }
            else if ((null == eventArg.ItemBase) && (null != eventArg.BoxCasePalletAnalysis))
            {
                BoxCasePalletAnalysis caseAnalysis = eventArg.BoxCasePalletAnalysis;
                if (null != caseAnalysis)
                    CreateOrActivateViewCaseAnalysis(caseAnalysis);
            }
            else if (null != eventArg.BoxCaseAnalysis)
            {
                BoxCaseAnalysis boxCaseAnalysis = eventArg.BoxCaseAnalysis;
                if (null != boxCaseAnalysis)
                    CreateOrActivateViewBoxCaseAnalysis(boxCaseAnalysis);
            }
            else if (null != eventArg.TruckAnalysis)
            {
                TruckAnalysis truckAnalysis = eventArg.TruckAnalysis;
                if (null != truckAnalysis)
                    CreateOrActivateViewTruckAnalysis(truckAnalysis);
            }
            else if (null != eventArg.ECTAnalysis)
            {
                ECTAnalysis ectAnalysis = eventArg.ECTAnalysis;
                if (null != ectAnalysis)
                    CreateOrActivateViewECTAnalysis(ectAnalysis);
            }
        }