Пример #1
0
        /// <summary>
        /// XML Export
        /// </summary>
        /// <returns></returns>
        public ERR_RESULT XML_ExportStart(WorkSpaceClass workSpaceObj)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                if (workSpaceObj != null)
                {
                    m_WorkSpaceObj = workSpaceObj;
                }

                //Project 노드 생성
                result = inner_SelfCreateNode <ProjectClass>(m_WorkSpaceObj.p_Solutions[0].p_Projects);

                //파일생성
                m_xDoc.Save(m_CurrLocal);

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Пример #2
0
        /*
         * *method
         */
        /// <summary>
        /// Root 노드 생성
        /// </summary>
        /// <param name="rootName">루트네임</param>
        /// <returns>ERR_RESULT</returns>
        public ERR_RESULT XML_ExportInit(WorkSpaceClass workspaceobj)
        {
            ERR_RESULT result = new ERR_RESULT();

            m_WorkSpaceObj = workspaceobj;

            try
            {
                if (m_xDoc == null)
                {
                    m_xDoc = new XDocument();
                }

                m_Xroot = new XElement(m_WorkSpaceObj.p_Solutions[0].p_Name);
                m_xDoc.Add(m_Xroot);

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Пример #3
0
        private void SaveWorkspace()
        {
            string       wsPath = "";
            StreamWriter sw     = null;

            try
            {
                SaveFileDialog dialog = new SaveFileDialog
                {
                    InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    DefaultExt       = ".xml",
                    Filter           = "xml Files (*.xml)|*.xml"
                };

                // Get the selected file name and display in a TextBox
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    wsPath = dialog.FileName;

                    WorkSpaceClass sol = m_WorkspaceDoc;
                    sw = new StreamWriter(wsPath);
                    XmlSerializer x = new XmlSerializer(sol.GetType());
                    x.Serialize(sw, sol);
                    sw.Close();

                    MessageBox.Show("Save Complete");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
        private void CreateNewSolution()
        {
            //Workspace
            m_WorkspaceDoc          = new WorkSpaceClass();
            MAINTREE_UI.ItemsSource = m_WorkspaceDoc.p_Solutions;

            ProjectClass prj = new ProjectClass
            {
                p_Name     = "Project1",
                p_Pareants = m_WorkspaceDoc.p_Solutions[0]
            };

            TaskClass tsk = new TaskClass
            {
                p_Name     = "Task1",
                p_Pareants = prj
            };

            ToolClass tl = new ToolClass
            {
                p_Name     = "Tool1",
                p_Pareants = tsk
            };

            m_WorkspaceDoc.p_Solutions[0].p_Projects.Add(prj);
            prj.p_Tasks.Add(tsk);
            tsk.p_Tools.Add(tl);

            m_convTreeviewItem = new ConvTreeViewItem();
        }
        public int CraftsModeSetWorkSpaceInstance()
        {
            WorkSpaceInstance = new WorkSpaceClass();

            //Import new model
            string TargetPath_Node = System.AppDomain.CurrentDomain.BaseDirectory + @"\CalDatas\NLIST_new.lis";
            string TargetPath_Elem = System.AppDomain.CurrentDomain.BaseDirectory + @"\CalDatas\ELIST_new.lis";

            WorkSpaceInstance.TowerModelInstance.ImportModel(TargetPath_Node,
                                                             TargetPath_Elem,
                                                             paras);

            //Import HeatDoubler
            string HeatDoublerFilePath = System.AppDomain.CurrentDomain.BaseDirectory + @"\CalDatas\CokeThermocouple_new.csv";

            WorkSpaceInstance.HeatDoublerInstances.HeatDoublerBuilder(HeatDoublerFilePath);

            return(1);
        }
Пример #6
0
        private void LoadWorkspace()
        {
            WorkSpaceClass temp = new WorkSpaceClass();

            OpenFileDialog dialog = new OpenFileDialog
            {
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                DefaultExt       = ".xml",
                Filter           = "xml Files (*.xml)|*.xml"
            };

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                CreateNewSolution();
                StreamReader  sr = new StreamReader(dialog.FileName);
                XmlSerializer x  = new XmlSerializer(m_WorkspaceDoc.GetType());

                temp = x.Deserialize(sr) as WorkSpaceClass;

                if (temp == null)
                {
                    return;
                }

                m_WorkspaceDoc = temp;

                MAINTREE_UI.ItemsSource = null;
                MAINTREE_UI.ItemsSource = m_WorkspaceDoc.p_Solutions;

                //LostFocuse때 SaveDoc을 하기위함.
                IMG_LSTVIEW_UI.Focusable = true;
                IMG_LSTVIEW_UI.Focus();

                inner_BottomSelTreeView();

                IMG_LSTVIEW_UI.SelectedIndex = 0;

                MessageBox.Show("Load Complete");
            }
        }