示例#1
0
        private void ReadXMLFile_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                RootObject rootObject = new RootObject();
                rootObject = XmlProcessor.GetXmlRootObject(@"" + XmlSelector.GetSelectedXmlPath());
                //rootObject = XmlProcessor.GetXmlRootObject(@"C:\Projects\BeerPack.xml");

                SetUpBitmapDimensions(int.Parse(rootObject.OriginalDocumentWidth), int.Parse(rootObject.OriginalDocumentHeight));

                AttachedPanelsItem rootAttached = new AttachedPanelsItem()
                {
                    PanelName           = rootObject.Panels.PanelsItem.PanelName,
                    PanelWidth          = rootObject.Panels.PanelsItem.PanelWidth,
                    PanelHeight         = rootObject.Panels.PanelsItem.PanelHeight,
                    AttachedPanelsItems = rootObject.Panels.PanelsItem.AttachedPanelsItems
                };

                CreateCustomPanelList(rootAttached, null);

                customPanelsAfterTransformation = PanelTransformation.RotatePanels(customPanels);
                customPanelsAfterXYCoordinates  = PanelCoordinateCalculation.ChangeReferencePointOfRoot(customPanels, rootObject);

                UserMessage.Content     = "File info: Xml file was successfully read!";
                CreatePreview.IsEnabled = true;
                SavePreview.IsEnabled   = true;
            }
            catch (Exception ex)
            {
                UserMessage.Content = "File error: " + ex.Message + "!";
            }
        }