예제 #1
0
        private void Btn_Component_Click(object sender, RoutedEventArgs e)
        {
            Window_Component window_Component = new Window_Component();
            ComponentModel   model            = new ComponentModel();

            if (window_Component.ShowDialog() == true)
            {
                try
                {
                    model    = window_Component.GetComponentModel;
                    model.ID = ID.ToString();
                    ID++;

                    components.Add(model);
                    DataPath.Components = components;

                    //Datapath File Generation
                    GenerateDatapath(DataPath);
                    //Component File Generation
                    GenerateComponents(DataPath);

                    LoadDataTree();
                    LoadFileTree();

                    //RenderComponent(DataPath);

                    var newDP_ResultJSON = JsonConvert.SerializeObject(DataPath, Formatting.Indented);
                    File.WriteAllText(System.IO.Path.Combine(NewFolderPath, "DatapathJSON.txt"), newDP_ResultJSON);
                }
                catch (Exception) { }
            }
        }
예제 #2
0
        private void Btn_Component_Click(object sender, RoutedEventArgs e)
        {
            Window_Component window_Component = new Window_Component(_dataPath);     //Creates new instance of component window
            ComponentModel   model            = new ComponentModel();
            List <PointData> datapoints       = new List <PointData>();

            if (window_Component.ShowDialog() == true)                      //Waits till the window is closed
            {
                try
                {
                    model    = window_Component.GetComponentModel;         //Gets the component model produced by the component menu
                    model.ID = _id.ToString();                             //Sets the component ID to an int _id
                    _id++;                                                 //Increments _id everytime a component is created
                    //models.Add(model);
                    _dataPath.Components.Add(model);                       //Adds the Model data to _dataPath

                    GenerateDatapath(_dataPath);                           //Regenerates Datapath Code File
                    GenerateComponents(_dataPath);                         //Generates Component Code File

                    LoadFileTree(_dataPath);                               //Loads text into the Project file tree view using info in _dataPath
                    LoadCodeTree(_dataPath);                               //Loads generated code file names into the tree view using the _newfolderPath
                    Btn_Signal.IsEnabled         = true;
                    Btn_Copy_Component.IsEnabled = true;

                    Canvas canvas = new Canvas();
                    canvas = this.DrawingCanvas;
                    //DrawComponents(_dataPath, canvas);

                    datapoints = DrawComponents(_dataPath, canvas);
                    foreach (PointData data in datapoints)
                    {
                        DataPoints.Add(data);
                    }

                    #region Debug
                    //var newDP_ResultJSON = JsonConvert.SerializeObject(_dataPath, Formatting.Indented);
                    //File.WriteAllText(System.IO.Path.Combine(_newFolderPath, "DatapathJSON.txt"), newDP_ResultJSON);
                    #endregion
                }
                catch (Exception) { }
            }
        }