/// <summary> /// Создает проект Relkon на основе старых файлов /// </summary> private void CreateRelkonSolutionFromOldFiles() { this.SaveOldProjectFiles(); this.fileName = ""; if (this.pultFileNames.Count != 0) { File.Delete(this.tbProgramFileName.Text); } foreach (string FileName in this.pultFileNames) { try { ControllerProgramSolution sln = this.CreateSolution(this.backUpFolderName + "\\" + Path.GetFileName(this.tbProgramFileName.Text), FileName, this.lbPultFiles.Items.Count > 1); if (this.fileName == "") { this.fileName = sln.SolutionFileName; } if (this.lbPultFiles.Items.Count > 1) { File.Delete(FileName); } } catch (Exception ex) { Utils.ErrorMessage(ex.Message); } } }
private void cmiAddExistingPult_Click(object sender, EventArgs e) { ControllerProgramSolution solution = ((ControllerProgramSolutionTreeNode)this.tvSolutionExplorer.SelectedNode).Solution; this.openFileDialog1.Filter = "Файлы пультов (*.fpr, *.plt)|*.fpr;*.plt|Все файлы|*.*"; if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { string FileName = this.openFileDialog1.FileName.Replace(".fpr", "").Replace(".plt", "").Replace(".bak", "bak") + ".plt"; if (File.Exists(solution.DirectoryName + "\\" + Path.GetFileName(FileName)) && Path.GetDirectoryName(FileName) != solution.DirectoryName && Utils.QuestionMessage("Файл \"" + Path.GetFileName(FileName) + "\" уже существует в каталоге проекта. Перезаписать ?", "Relkon") != DialogResult.Yes) { return; } try { RelkonPultModel pult = RelkonPultModel.FromFile(this.openFileDialog1.FileName); pult.Save(FileName); this.AddFileToRelkonSolution((ControllerProgramSolutionTreeNode)this.tvSolutionExplorer.SelectedNode, FileName); } catch (Exception ex) { Utils.ErrorMessage(ex.Message); } } }
public PropertiesTreeNode(ControllerProgramSolution Solution) { this.ImageKey = "ProjectProperities.bmp"; this.SelectedImageKey = "ProjectProperities.bmp"; this.Text = "Настройки проекта"; this.solution = Solution; }
/// <summary> /// Конструктор /// </summary> /// <param name="solution"></param> public ViewStructursTabbedDocument(ControllerProgramSolution solution, DebuggerEngine engine) : base(solution, engine) { InitializeComponent(); _engine = engine; _solution = solution; }
/// <summary> /// Добавляет новый файл к указанному проекту Rekon /// </summary> public void AddFileToRelkonSolution(ControllerProgramSolution Solution, string FileName) { ControllerProgramSolutionTreeNode SolutionNode = null; if (this.tvSolutionExplorer.Nodes[0].GetType() == typeof(ControllerProgramSolutionTreeNode)) { SolutionNode = (ControllerProgramSolutionTreeNode)this.tvSolutionExplorer.Nodes[0]; if (SolutionNode.Solution != Solution) { return; } } else { foreach (TreeNode node in this.tvSolutionExplorer.Nodes[0].Nodes) { if (node.GetType() == typeof(ControllerProgramSolutionTreeNode) && ((ControllerProgramSolutionTreeNode)node).Solution == Solution) { SolutionNode = (ControllerProgramSolutionTreeNode)node; break; } } } this.AddFileToRelkonSolution(SolutionNode, FileName); }
/// <summary> /// Обновляет значения компонентов, задающих параметры связи с контроллером /// </summary> public void UpdateControlerParameters() { /////////// LoadValues(this.engine.Parameters); /////////// ProcessorType p = ProcessorType.STM32F107; this.DebuggerEngine.Parameters.ProcessorType = p; ControllerProgramSolution sln = ControllerProgramSolution.Create(p); //this.rbInverse.Checked = sln.ProcessorParams.InverseByteOrder; Program.Settings.DeBugger_SettingsProcessesorType = p.ToString(); this.RaiseProcessorChangedEvent(p); //this.ddlProcessorType.SelectedItem = this.engine.Parameters.ProcessorType; this.ddlPortName.SelectedItem = this.engine.Parameters.PortName; this.nudControllerAddress.Value = this.engine.Parameters.ControllerNumber; this.ddlBaudRate.SelectedItem = this.engine.Parameters.BaudRate.ToString(); this.ddlProtocol.SelectedItem = this.engine.Parameters.ProtocolType; //this.tbReadPassword.Text = this.engine.Parameters.ReadPassword; //this.tbWritePassword.Text = this.engine.Parameters.WritePassword; //this.nudPort.Value = this.engine.Parameters.PortNumber; this.tBIP.Text = this.engine.Parameters.PortIP; rbCom.Checked = this.engine.Parameters.ComConection; }
public int DispetcherPeriod; // период работы диспетчера public CodeGenerator(ControllerProgramSolution Solution) { this.solution = Solution; this.codeModel = Solution.codeModel; if (!String.IsNullOrEmpty(Solution.PultFileName)) { this.pultModel = RelkonPultModel.FromFile(Solution.PultFileName); } }
public ControllerProgramSolutionTreeNode(ControllerProgramSolution Solution) : base(Solution) { this.solution = Solution; this.Text = Solution.Name; this.ImageKey = "RelkonProject.bmp"; this.SelectedImageKey = "RelkonProject.bmp"; this.NodeFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold); this.CreateNodesTree(); }
private bool _IsReading = false; //Происходит ли опрос(видна ли вкладака) /// <summary> /// Конструктор /// </summary> /// <param name="solution"></param> public ViewSituationsTabbedDocument(ControllerProgramSolution solution, DebuggerEngine engine) : base(solution, engine) { InitializeComponent(); _engine = engine; _solution = solution; if (_solution == null) { _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); } }
/// <summary> /// Обновляет содержимое документа на основании нового движка и проекта /// </summary> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { if (solution == null) { this.solutionFromEngine = null; this.Solution = solution; } this.debuggerEngine = engine; this.Solution = solution; this.FillVarsComboBoxes(); this.SetRequestedVarsToComboBoxes(); }
public UploadMgr(ControllerProgramSolution solution) : base() { this.solution = solution; this.deviceSearcher = new SerialPortDeviceSearcher(null, null); this.deviceSearcher.ProgressChanged += new ProgressChangedEventHandler(deviceSearcher_ProgressChanged); this.deviceSearcher.DeviceSearchCompleted += new DeviceSearchCompletedEventHandler(deviceSearcher_DeviceSearchCompleted); this.onCompletedDelegate = new SendOrPostCallback(this.RaiseUploadingCompletedEvent); this.onProgressReportDelegate = new SendOrPostCallback(this.RaiseProgressChangeEvent); }
private void cmiAddExistingItem_DropDownOpening(object sender, EventArgs e) { if (this.tvSolutionExplorer.SelectedNode is ControllerProgramSolutionTreeNode) { ControllerProgramSolution sln = ((ControllerProgramSolutionTreeNode)this.tvSolutionExplorer.SelectedNode).Solution; //if (sln is AT89C51ED2Solution && this.cmiAddExistingItem.DropDown.Items.Contains(this.cmiAddLCDPanelProject)) // this.cmiAddExistingItem.DropDown.Items.Remove(this.cmiAddLCDPanelProject); if (sln is STM32F107Solution && !this.cmiAddExistingItem.DropDown.Items.Contains(this.cmiAddLCDPanelProject)) { this.cmiAddExistingItem.DropDown.Items.Add(this.cmiAddLCDPanelProject); } } }
private string[] printingLines; // массив строк для печати public EditorTabbedDocument(ControllerProgramSolution Solution, string FileName, SetPositionStringDelegate SetPositionFunction) : base(Solution, FileName) { InitializeComponent(); this.editor.Source.UndoOptions = QWhale.Editor.UndoOptions.AllowUndo; this.editor.UseDefaultMenu = false; this.ReloadFont(); this.setPositionFunction = SetPositionFunction; if (string.IsNullOrEmpty(FileName)) { return; } this.LoadFromFile(FileName); this.initialized = true; }
/// <param name="FileName">Имя файла, который отображает узел (с путем доступа)</param> /// <param name="Solution">Проект, к которому относится файл</param> public FileTreeNode(string FileName, ControllerProgramSolution Solution) { string ImageKey = this.GetImageKey(FileName); if (!File.Exists(FileName)) { ImageKey = "Unavailable" + ImageKey; } this.ImageKey = ImageKey; this.SelectedImageKey = ImageKey; this.Text = Path.GetFileName(FileName); this.ToolTipText = FileName; this.fileName = Path.GetFileName(FileName); this.solution = Solution; }
private void cmiAddNewPult_Click(object sender, EventArgs e) { ControllerProgramSolution solution = ((ControllerProgramSolutionTreeNode)this.tvSolutionExplorer.SelectedNode).Solution; string FileName = solution.DirectoryName + "\\NewPult1.plt"; for (int i = 2; solution.Files.Contains(FileName) || File.Exists(FileName); i++) { FileName = FileName = solution.DirectoryName + "\\NewPult" + i + ".plt"; } RelkonPultModel pult = new RelkonPultModel(solution.PultParams.DefaultPultType); pult.Save(FileName); this.AddFileToRelkonSolution(solution, FileName); MainForm.MainFormInstance.LoadFile(FileName); }
/// <summary> /// Добавляет проект к списку проектов /// </summary> public void AddSolutionNode(ControllerProgramSolution Solution) { TreeNode node = null; if (Solution is ControllerProgramSolution) { node = new ControllerProgramSolutionTreeNode((ControllerProgramSolution)Solution); } else { throw new Exception("Проекты типа " + Solution.GetType().ToString() + " не поддерживаются"); } this.tvSolutionExplorer.Nodes.Add(node); node.Text = Solution.Name; node.Expand(); }
/// <summary> /// Загрузка новых параметров /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { try { _engine = engine; this._Address = _engine.Parameters.ViewMemoryAddress; this._Size = _engine.Parameters.ReadingSize; this.SetValues(); switch (engine.Parameters.ProcessorType) { case ProcessorType.MB90F347: this.ddlMemoryType.Items[5] = "SD Card"; break; case ProcessorType.AT89C51ED2: this.ddlMemoryType.Items[5] = "Flash"; break; default: break; } switch (_engine.Parameters.ViewMemoryType) { case MemoryType.Clock: this.ddlMemoryType.Text = "Clock"; break; case MemoryType.RAM: this.ddlMemoryType.Text = "RAM"; break; case MemoryType.EEPROM: this.ddlMemoryType.Text = "Eprom"; break; case MemoryType.FRAM: this.ddlMemoryType.Text = "FRAM"; break; case MemoryType.XRAM: this.ddlMemoryType.Text = "XRAM"; break; case MemoryType.Flash: this.ddlMemoryType.Text = "FLash"; break; default: this.ddlMemoryType.Text = "SD Card"; break; } this.StartAddress_Leave(null, null); this.ReadingSize_Leave(null, null); } catch (Exception ex) { Utils.ErrorMessage("Update:" + ex.Message); return; } }
/// <summary> /// Заполняет таблицу данными проекта /// </summary> private void FillTable(List <string> SolutionFilesNames) { foreach (string FileName in SolutionFilesNames) { ControllerProgramSolution sln = null; try { sln = ControllerProgramSolution.FromFile(FileName); } catch { continue; } this.dgSolutions.Rows.Add(); this.dgSolutions[0, this.dgSolutions.RowCount - 1].Value = sln.Name; this.dgSolutions[1, this.dgSolutions.RowCount - 1].Value = FileName; } }
private void cmiSetAsActivePult_Click(object sender, EventArgs e) { ControllerProgramSolution solution = ((ControllerProgramSolutionTreeNode)this.tvSolutionExplorer.SelectedNode.Parent).Solution; FileTreeNode cn = (FileTreeNode)this.tvSolutionExplorer.SelectedNode; foreach (TreeNode node in this.tvSolutionExplorer.SelectedNode.Parent.Nodes) { if (node is FileTreeNode && ((FileTreeNode)node).FileName == solution.PultFileName) { node.NodeFont = new Font(this.Font, FontStyle.Regular); break; } } solution.PultFileName = cn.FileName; string s = cn.Text; cn.NodeFont = new Font(this.Font, FontStyle.Bold); cn.Text = s; MainForm.MainFormInstance.ReloadSolutionPropertiesDocument(solution); }
/// <summary> /// Загрузка новых параметров /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { _engine = engine; if (solution != null) { _solution = solution; } //Оснатовка чтения this.RemoveReadItems(); //Удаление строк из таблицы this.dgProcess.Rows.Clear(); //Добавление процессов из проекта в таблицу foreach (ProjectProcess ps in _solution.Processes) { this.dgProcess.Rows.Add(ps.Name, "***"); } //Сортировка записий в таблице this.dgProcess.Sort(this.dgProcess.Columns[0], ListSortDirection.Ascending); //Запуск чтения this.AddedReadItems(); }
/// <summary> /// Конструктор /// </summary> /// <param name="solution"></param> public ViewVarsTabbedDocument(ControllerProgramSolution solution, DebuggerEngine engine) : base(solution, engine) { InitializeComponent(); _engine = engine; _solution = solution; if (_solution == null) { _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); _EmptyProgect = true; } else { _EmptyProgect = false; } for (int i = 0; i < _RemovedVars.Length; i++) { _RemovedVars[i] = new List <ControllerVar>(); } RebuildTree(); this.dgVars.Columns[1].ReadOnly = false; }
public ViewGraphicsTabbedDocument(ControllerProgramSolution solution, DebuggerEngine Engine) : base(solution, Engine) { InitializeComponent(); // Инициализация ComboBox'ов this.VarsComboBoxes = new List <ComboBox>() { this.cbVar_0, this.cbVar_1, this.cbVar_2, this.cbVar_3, this.cbVar_4, this.cbVar_5 }; this.timeStamps = new long[this.VarsComboBoxes.Count]; for (int i = 0; i < this.VarsComboBoxes.Count; i++) { this.VarsComboBoxes[i].Leave += new EventHandler(VarComboBox_Leave); this.VarsComboBoxes[i].SelectedIndexChanged += new EventHandler(VarComboBox_Leave); this.VarsComboBoxes[i].KeyDown += new KeyEventHandler(VarComboBox_KeyDown); this.timeStamps[i] = 0; } this.FillVarsComboBoxes(); // Инициализация графиков this.InitGraphControl(); this.Update(solution, Engine); }
/// <summary> /// Загружает настройки проекта из указанного файла пультов /// </summary> //private void LoadParamsToSolutionFromPult(ControllerProgramSolution solution, string FileName) //{ // PultFileVersion version = RelkonPultModel.GetPultFileVersion(FileName); // switch (version) // { // case PultFileVersion.v37: // this.LoadParamsToSolutionFromPlt37(solution, FileName); // break; // } // solution.ComputeMultibyteEmbeddedVarsValues(); //} /// <summary> /// Загружает настройки в проект из fpr-файла /// </summary> //private void LoadParamsToSolutionFromFpr(AT89C51ED2Solution solution, string FileName) //{ // solution.Vars.EmbeddedVars.Clear(); // solution.Vars.EmbeddedVars.AddRange(RelkonPultModel.GetEmbeddedVarsFromFpr(FileName)); // using (StreamReader reader = new StreamReader(FileName, Encoding.Default)) // { // solution.BaudRate = int.Parse(reader.ReadLine()); //считывание скорости // solution.Protocol = reader.ReadLine() == "1" ? ProtocolType.RC51BIN : ProtocolType.RC51ASCII; // solution.ReadPassword = reader.ReadLine(); //пароль на чтение // solution.WritePassword = reader.ReadLine(); //пароль на запись // } //} /// <summary> /// Загружает настройки в проект из plt-файла версии 3.7 /// </summary> //private void LoadParamsToSolutionFromPlt37(ControllerProgramSolution solution, string FileName) //{ // solution.Vars.EmbeddedVars.Clear(); // solution.Vars.EmbeddedVars.AddRange(RelkonPultModel.GetEmbeddedVarsFromPlt37(FileName)); // if (File.ReadAllText(FileName).Contains("Fujitsu")) // this.LoadParamsToMB90F347SolutionFromPlt37((MB90F347Solution)solution, FileName); // else // this.LoadParamsToAT89C51ED2SolutionFromPlt37((AT89C51ED2Solution)solution, FileName); //} /// <summary> /// Загружает настройки в проект AT89C51ED2 из plt-файла версии 3.7 /// </summary> //private void LoadParamsToAT89C51ED2SolutionFromPlt37(AT89C51ED2Solution solution, string FileName) //{ // XPathDocument xpDoc = new XPathDocument(FileName); // XPathNavigator xpNav = ((IXPathNavigable)xpDoc).CreateNavigator(); // XPathNodeIterator xpList = xpNav.Select("/fpultProject"); // xpList.MoveNext(); // solution.ControllerAddress = int.Parse(xpList.Current.GetAttribute("number", "")); // solution.Protocol = (xpList.Current.GetAttribute("protocol", "") == "RC51BIN") ? ProtocolType.RC51BIN : ProtocolType.RC51ASCII; // solution.ReadPassword = xpList.Current.GetAttribute("readPass", ""); // solution.WritePassword = xpList.Current.GetAttribute("writePass", ""); // solution.BaudRate = int.Parse(xpList.Current.GetAttribute("speed", "")); //} /// <summary> /// Загружает настройки в проект MB90F347 из plt-файла версии 3.7 /// </summary> //private void LoadParamsToMB90F347SolutionFromPlt37(MB90F347Solution solution, string FileName) //{ // XPathDocument xpDoc = new XPathDocument(FileName); // XPathNavigator xpNav = ((IXPathNavigable)xpDoc).CreateNavigator(); // XPathNodeIterator xpList = xpNav.Select("/fpultProject"); // xpList.MoveNext(); // solution.ControllerAddress = int.Parse(xpList.Current.GetAttribute("number", "")); // XPathNodeIterator xpPortOptions = xpNav.Select("/fpultProject/portOptions"); // int index = 0; // while (xpPortOptions.MoveNext()) // { // if (int.Parse(xpPortOptions.Current.GetAttribute("index", "")) == 1) // continue; // solution.Uarts[index].ReadPassword = xpPortOptions.Current.GetAttribute("readPassword", ""); // solution.Uarts[index].WritePassword = xpPortOptions.Current.GetAttribute("writePassword", ""); // solution.Uarts[index].ParseParametersByte(byte.Parse(xpPortOptions.Current.GetAttribute("parameters", ""))); // int start = int.Parse(xpPortOptions.Current.GetAttribute("rxStart", "")); // int end = int.Parse(xpPortOptions.Current.GetAttribute("rxEnd", "")); // solution.Uarts[index].BufferSize = end - start + 1; // start = int.Parse(xpPortOptions.Current.GetAttribute("txStart", "")); // end = int.Parse(xpPortOptions.Current.GetAttribute("txEnd", "")); // solution.Uarts[index].BufferSize = end - start + 1; // index++; // } // XPathNodeIterator xpConnectionSettings = xpNav.Select("/fpultProject/connectionSettings"); // while (xpConnectionSettings.MoveNext()) // { // solution.SearchedControllerAddress = int.Parse(xpConnectionSettings.Current.GetAttribute("searchingControllerAddress", "")); // solution.DispatcherPhone1 = xpConnectionSettings.Current.GetAttribute("modemPhone1", ""); // solution.DispatcherPhone1 = xpConnectionSettings.Current.GetAttribute("modemPhone2", ""); // solution.DispatcherPhone1 = xpConnectionSettings.Current.GetAttribute("modemPhone3", ""); // solution.SmsPhone1 = xpConnectionSettings.Current.GetAttribute("smsPhone1", ""); // solution.SmsPhone1 = xpConnectionSettings.Current.GetAttribute("smsPhone2", ""); // solution.SmsPhone1 = xpConnectionSettings.Current.GetAttribute("smsPhone3", ""); // solution.ModemInitializationString = xpConnectionSettings.Current.GetAttribute("modemInitString", ""); // solution.DenyProgrammingThrowProtocol = bool.Parse(xpConnectionSettings.Current.GetAttribute("denyProgramming", "")); // } //} /// <summary> /// На основании указаных файла программы и файла пультов создает новый проект /// </summary> /// <param name="ProgramFileName">Имя файла программы</param> /// <param name="PultFileName">Имя файла пультов</param> /// <param name="DirectoryName">Имя каталога, в котором должен быть создан проект</param> /// <param name="CreateDirectoryForSolution"> /// Если true, то в каталоге DirectoryName будет создан каталог для проекта, /// причем имя каталога будет именем файла пультов /// </param> private ControllerProgramSolution CreateSolution(string ProgramFileName, string PultFileName, bool CreateDirectoryForSolution) { ControllerProgramSolution res = File.ReadAllText(ProgramFileName).Contains("f347") ? ControllerProgramSolution.Create(ProcessorType.MB90F347) : ControllerProgramSolution.Create(ProcessorType.AT89C51ED2); RelkonPultModel pult = RelkonPultModel.FromFile(PultFileName); if (Array.IndexOf(res.PultParams.AvailablePultTypes, pult.Type) == -1) { throw new Exception("Тип пульта файла " + Path.GetFileName(PultFileName) + " не совместим с типом процессора программы " + Path.GetFileName(ProgramFileName)); } string SolutionDirectoryName = Path.GetDirectoryName(this.tbProgramFileName.Text) + (CreateDirectoryForSolution ? "\\" + Path.GetFileNameWithoutExtension(PultFileName) : ""); if (CreateDirectoryForSolution && !Directory.Exists(SolutionDirectoryName)) { Directory.CreateDirectory(SolutionDirectoryName); } //this.LoadParamsToSolutionFromPult(res, PultFileName); string SolutionProgramFileName = SolutionDirectoryName + "\\" + Path.GetFileNameWithoutExtension(ProgramFileName) + ".kon"; string SolutionPultFileName = SolutionDirectoryName + "\\" + Path.GetFileNameWithoutExtension(PultFileName) + ".plt"; File.Copy(ProgramFileName, SolutionProgramFileName); // Удаление из файла строки с типом процессора string[] s = File.ReadAllLines(SolutionProgramFileName, Encoding.Default); if (s.Length > 1 && (s[1].Contains("f347") || s[1].ToLower().Contains("тип контроллера"))) { s[1] = ""; } File.WriteAllLines(SolutionProgramFileName, s, Encoding.Default); /////////////////////////////////////////////// pult.Save(SolutionPultFileName); res.ProgramFileName = SolutionProgramFileName; res.PultFileName = SolutionPultFileName; res.Files.Add(SolutionProgramFileName); res.Files.Add(SolutionPultFileName); res.OpenedFiles.Add(SolutionProgramFileName); res.OpenedFiles.Add(SolutionPultFileName); res.SaveAs(SolutionDirectoryName + "\\" + Path.GetFileNameWithoutExtension(ProgramFileName) + ".rp6"); return(res); }
/// <summary> /// Вычисляет значения двух- и четырехбайтных переменных заводских установок на основе /// значений однобайтных переменных для указанного проекта /// </summary> private void ComputeMultibyteEmbeddedVarsValues(ControllerProgramSolution solution) { for (int count = 2; count < 5; count += 2) { string s = (count == 2) ? "i" : "l"; for (char c = 'W'; c <= 'Z'; c++) { for (int i = 0; i < 16; i += count) { byte[] bytes = new byte[count]; for (int j = 0; j < count; j++) { bytes[j] = (byte)solution.Vars.GetEmbeddedVar(c.ToString() + (i + j)).Value; } if (solution.ProcessorParams.InverseByteOrder) { bytes = Utils.ReflectArray <byte>(bytes); } solution.Vars.GetEmbeddedVar(c.ToString() + i + s).Value = AppliedMath.BytesToLong(bytes); } } for (int i = 0; i < 64; i += count) { byte[] bytes = new byte[count]; for (int j = 0; j < count; j++) { bytes[j] = (byte)solution.Vars.GetEmbeddedVar("EE" + (i + j)).Value; } if (solution.ProcessorParams.InverseByteOrder) { bytes = Utils.ReflectArray <byte>(bytes); } solution.Vars.GetEmbeddedVar("EE" + i + s).Value = AppliedMath.BytesToLong(bytes); } } }
public DebuggerTabbedDocument(ControllerProgramSolution solution, DebuggerEngine Engine) : base(solution) { this.codingType = MainForm.MainFormInstance.Hex ? 16 : 10; this.debuggerEngine = Engine; }
protected DebuggerEngine debuggerEngine = null; // движок отладчика, который обслуживает компонент /// <summary> /// Обновляет данные, отображаемые документом на основани передаваемого проекта /// </summary> public virtual void Update(ControllerProgramSolution solution, DebuggerEngine engine) { //throw new Exception("Метод DebuggerTabbedDocument.Update() надо перегрузить в потомке"); }
/// <summary> /// Загрузка новых параметров /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { _engine = engine; if (solution != null) { _solution = solution; } else { _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); } //Очистка значений переменных this.StructsTable.Rows.Clear(); this.VarsTable.Rows.Clear(); this.DisplayVarsTable.Rows.Clear(); this._freeStructs = new List <ControllerStructVar>(); this.clb_structurs.Items.Clear(); FillStuctursTables(); //Добваление структур, которых нет в проекте ControllerStructVar m_struct; ControllerUserVar m_var; foreach (DebuggerParameters.StructDescription sd in _engine.Parameters.ReadingStructs) { bool m_fined = false; foreach (DataRow dr in this.StructsTable.Rows) { if (dr[0].ToString() == sd.Name) { m_fined = true; break; } } if (m_fined) { continue; } m_struct = new ControllerStructVar(); m_struct.Address = sd.Address; m_struct.HasSign = sd.HasSign; m_struct.Memory = sd.MemoryType; m_struct.Name = sd.Name; m_struct.Size = sd.Size; foreach (DebuggerParameters.VarDescription vd in sd.Vars) { m_var = new ControllerUserVar(); m_var.Address = vd.Address; m_var.HasSign = vd.HasSign; m_var.Array = false; m_var.Memory = vd.MemoryType; m_var.Name = vd.Name; m_var.Size = vd.Size; m_struct.Vars.Add(m_var); } AddStructurToTable(m_struct); } FillCheckedList(); //Выбор структур для опроса List <DebuggerParameters.StructDescription> readStructs = new List <DebuggerParameters.StructDescription>(_engine.Parameters.ReadingStructs); _engine.Parameters.ReadingStructs = new List <DebuggerParameters.StructDescription>(); for (int i = 0; i < this.clb_structurs.Items.Count; i++) { foreach (DebuggerParameters.StructDescription sd in readStructs) { if (this.clb_structurs.Items[i].ToString() == sd.Name) { //this.clb_structurs_ItemCheck(this.clb_structurs, new ItemCheckEventArgs(i, System.Windows.Forms.CheckState.Checked, System.Windows.Forms.CheckState.Unchecked)); this.clb_structurs.SetItemCheckState(i, CheckState.Checked); } } } }
protected ControllerProgramSolution solution; // отображаемый узлом проект public SolutionTreeNode(ControllerProgramSolution Solution) { this.solution = Solution; this.ToolTipText = Solution.SolutionFileName; }
/// <summary> /// Загрузка новых параметров, загрузка меток из параметров отладчика /// </summary> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { _engine = engine; if (solution != null) { _solution = solution; } else { _solution = Kontel.Relkon.Solutions.ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); } CreateComponents(); this.pSettings.Visible = true; if (_solution != null) { //Загрузка меток дискретных датчиков this.digitalIO.ClearLabels(); Match m; Relkon.DebuggerParameters.DigitalSensorDescription[] m_sensors = _engine.Parameters.DINSensors.ToArray(); for (int i = 0; i < m_sensors.Length; i++) { Relkon.DebuggerParameters.SensorLabels[] m_labelse = m_sensors[i].Labels.ToArray(); m = Regex.Match(m_sensors[i].Name, "DIN(\\d+)"); for (int j = 0; j < m_labelse.Length; j++) { try { this.digitalIO.ChangeLabel(true, Convert.ToInt32(m.Groups[1].Value), m_labelse[j].Number, m_labelse[j].Caption); } catch {} } } m_sensors = _engine.Parameters.DOUTSensors.ToArray(); for (int i = 0; i < m_sensors.Length; i++) { Relkon.DebuggerParameters.SensorLabels[] m_labelse = m_sensors[i].Labels.ToArray(); m = Regex.Match(m_sensors[i].Name, "DOUT(\\d+)"); for (int j = 0; j < m_labelse.Length; j++) { try { this.digitalIO.ChangeLabel(false, Convert.ToInt32(m.Groups[1].Value), m_labelse[j].Number, m_labelse[j].Caption); } catch {} } } //Загрузка меток аналоговых датчиков IList <int> m_key = this._inVarsAnalog.Keys; for (int i = 0; i < this._inVarsAnalog.Count; i++) { for (int j = 0; j < _engine.Parameters.ADCSensors.Count; j++) { if (_engine.Parameters.ADCSensors[j].Name == this.ascInputs[i].SensorName) { this.ascInputs[i].SensorLabel = _engine.Parameters.ADCSensors[j].Caption; this.ascInputs[i].SigleByte = _engine.Parameters.ADCSensors[j].DisplayOneByte; break; } } } m_key = this._outVarsAnalog.Keys; for (int i = 0; i < this._outVarsAnalog.Count; i++) { for (int j = 0; j < _engine.Parameters.DACSensors.Count; j++) { if (_engine.Parameters.DACSensors[j].Name == this.ascOutputs[i].SensorName) { this.ascOutputs[i].SensorLabel = _engine.Parameters.DACSensors[j].Caption; this.ascOutputs[i].SigleByte = _engine.Parameters.DACSensors[j].DisplayOneByte; break; } } } } //Установка доступности полей в зависимости от состояния отладчика DebuggerParametersList_ChangeStatusEngine(null, new Debugger.DebuggerEngineStatusChangedEventArgs(_engine.EngineStatus, null)); //Установка невидемыми встроенных датчиков if (this.cbDefault.Checked != _engine.Parameters.DisplayDefault || _engine.Parameters.ProcessorType == ProcessorType.AT89C51ED2) { this.cbDefault.Checked = _engine.Parameters.ProcessorType == ProcessorType.STM32F107 ? _engine.Parameters.DisplayDefault : true; checkBox1_CheckedChanged(this.cbDefault, null); } if (this.tabControl1.TabPages.Count > 1) { this.tabControl1.SelectedIndex = 1; } #region модули //Закрытие всех вкладок foreach (TD.SandDock.TabPage tp in this.tpBloks.Values) { tp.Dispose(); } this.tpBloks = new SortedList <int, TD.SandDock.TabPage>(); if (_engine.Parameters.ProcessorType == ProcessorType.STM32F107) { //Создание всех вкалдок из параметров отладчика foreach (Kontel.Relkon.DebuggerParameters.Block b in _engine.Parameters.ModulBlocks) { this.CreateTabPage(b.Number, b.Caption, false); } //Обновление всех вкладок foreach (TD.SandDock.TabPage tp in this.tpBloks.Values) { ((DisplayBlock)tp.Controls.Find("displayBlock", true)[0]).Update_presentation(solution, engine); } } #endregion if (this.tabControl1.TabPages.Count > 1) { this.tabControl1.SelectedIndex = 0; } }
protected bool initialized = false; // показывает, закончилась ли инициализация докуменита public RelkonTabbedDocument(ControllerProgramSolution solution) { this.solution = solution; }