Exemplo n.º 1
0
        private void Btn_Signal_Click(object sender, RoutedEventArgs e)
        {
            Window_Signal window_Signal = new Window_Signal(_dataPath);     //Creates a new Window instance upon button click and passes the _dataPath into it

            if (window_Signal.ShowDialog() == true)                         //Waits till the window is closed
            {
                try
                {
                    _dataPath.Signals.Add(window_Signal.GetSignalModel);    //Gets the Signal model from the signal Menu and addds it to the _dataPath

                    GenerateDatapath(_dataPath);                            //Regenerates the Datapath Code using the new data from the signal menu (Port Mapping)

                    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

                    Canvas canvas = new Canvas();
                    canvas = this.DrawingCanvas;
                    DrawSignals(_dataPath, canvas, DataPoints);

                    #region Debug
                    //System.IO.File.WriteAllText(System.IO.Path.Combine(DebugPath, "SignalJSON.txt"), window_Signal.GetSignalJSON);
                    //var newDP_ResultJSON = JsonConvert.SerializeObject(_dataPath, Formatting.Indented);
                    //System.IO.File.WriteAllText(System.IO.Path.Combine(DebugPath, "newDatapathwsJSON.txt"), newDP_ResultJSON);
                    //File.WriteAllText(System.IO.Path.Combine(_newFolderPath, "DatapathJSON.txt"), newDP_ResultJSON);
                    #endregion
                }
                catch (Exception) { }
            }
        }
Exemplo n.º 2
0
        private void Btn_Signal_Click(object sender, RoutedEventArgs e)
        {
            Window_Signal window_Signal = new Window_Signal(DataPath);

            if (window_Signal.ShowDialog() == true)
            {
                try
                {
                    //signals.Add(JsonConvert.DeserializeObject<SignalModel>(window_Signal.GetSignalJSON));
                    signals.Add(window_Signal.GetSignalModel);
                    DataPath.Signals = signals;

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

                    LoadDataTree();
                    LoadFileTree();

                    //System.IO.File.WriteAllText(System.IO.Path.Combine(DebugPath, "SignalJSON.txt"), window_Signal.GetSignalJSON);
                    var newDP_ResultJSON = JsonConvert.SerializeObject(DataPath, Formatting.Indented);
                    //System.IO.File.WriteAllText(System.IO.Path.Combine(DebugPath, "newDatapathwsJSON.txt"), newDP_ResultJSON);
                    File.WriteAllText(System.IO.Path.Combine(NewFolderPath, "DatapathJSON.txt"), newDP_ResultJSON);
                }
                catch (Exception) { }
            }
        }