/// <summary>
        /// Загрузка новых параметров
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void Update(ControllerProgramSolution solution, DebuggerEngine engine)
        {
            //очистка значений
            //_AddedVars.Clear();
            //_RemovedVars[0].Clear();
            //_RemovedVars[1].Clear();
            //_RemovedVars[2].Clear();
            //_RemovedVars[3].Clear();
            //_solution = null;
            //_engine = null;
            //_vars.Clear();
            //this.Table.Rows.Clear();
            //RemoveNewVars();
            if (_EmptyProgect)
            {
                this.Table.Rows.Clear();
                _vars.Clear();
            }

            _engine = engine;
            if (solution != null /* && _solution != solution*/)
            {
                if (_solution != solution)
                {
                    _EmptyProgect = false;
                }
                _solution = solution;
            }
            else
            {
                RemoveNewVars();
                _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType);
            }
            if (_solution != null)
            {
                Kontel.Relkon.DebuggerParameters.VarDescription[] m_Vars = this._engine.Parameters.ReadingVars.ToArray();
                for (int i = 0; i < dgVars.Rows.Count;)
                {
                    this.dgVars_CellMouseClick(null, new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 2, 0, 0, 0)));
                    this.dgVars_DoubleClick(null, new EventArgs());
                }
                //Добавление в проект недостающийх переменных
                for (int j = 0; j < m_Vars.Length; j++)
                {
                    //Надо проверить на наличие такой переменнйо в проекте
                    if (_solution.Vars.GetVarByName(m_Vars[j].Name) == null || _solution.Vars.GetVarByName(m_Vars[j].Name).Address == 0)
                    {
                        if (_solution.Vars.GetSystemVar(m_Vars[j].Name) != null && _solution.Vars.GetSystemVar(m_Vars[j].Name).Address == 0)
                        {
                            _RemovedVars[0].Add(_solution.Vars.GetVarByName(m_Vars[j].Name));
                            _solution.Vars.SystemVars.Remove((Kontel.Relkon.Classes.ControllerSystemVar)_solution.Vars.GetVarByName(m_Vars[j].Name));
                        }
                        if (_solution.Vars.GetEmbeddedVar(m_Vars[j].Name) != null && _solution.Vars.GetEmbeddedVar(m_Vars[j].Name).Address == 0)
                        {
                            _RemovedVars[1].Add(_solution.Vars.GetVarByName(m_Vars[j].Name));
                            _solution.Vars.EmbeddedVars.Remove((Kontel.Relkon.Classes.ControllerEmbeddedVar)_solution.Vars.GetVarByName(m_Vars[j].Name));
                        }
                        if (_solution.Vars.GetIOVar(m_Vars[j].Name) != null && _solution.Vars.GetIOVar(m_Vars[j].Name).Address == 0)
                        {
                            _RemovedVars[2].Add(_solution.Vars.GetVarByName(m_Vars[j].Name));
                            _solution.Vars.IOVars.Remove((Kontel.Relkon.Classes.ControllerIOVar)_solution.Vars.GetVarByName(m_Vars[j].Name));
                        }
                        if (_solution.Vars.GetUserVar(m_Vars[j].Name) != null && _solution.Vars.GetUserVar(m_Vars[j].Name).Address == 0)
                        {
                            _RemovedVars[3].Add(_solution.Vars.GetVarByName(m_Vars[j].Name));
                            _solution.Vars.UserVars.Remove((Kontel.Relkon.Classes.ControllerUserVar)_solution.Vars.GetVarByName(m_Vars[j].Name));
                        }
                        switch (m_Vars[j].Type)
                        {
                        case 0:
                            Kontel.Relkon.Classes.ControllerSystemVar m_var1 = new Kontel.Relkon.Classes.ControllerSystemVar();
                            m_var1.Address = m_Vars[j].Address;
                            m_var1.HasSign = m_Vars[j].HasSign;
                            m_var1.Memory  = m_Vars[j].MemoryType;
                            m_var1.Name    = m_Vars[j].Name;
                            m_var1.Size    = m_Vars[j].Size;
                            _solution.Vars.SystemVars.Add(m_var1);
                            _AddedVars.Add((Kontel.Relkon.Classes.ControllerVar)m_var1);
                            break;

                        case 1:
                            Kontel.Relkon.Classes.ControllerEmbeddedVar m_var2 = new Kontel.Relkon.Classes.ControllerEmbeddedVar();
                            m_var2.Address = m_Vars[j].Address;
                            m_var2.HasSign = m_Vars[j].HasSign;
                            m_var2.Memory  = m_Vars[j].MemoryType;
                            m_var2.Name    = m_Vars[j].Name;
                            m_var2.Size    = m_Vars[j].Size;
                            _solution.Vars.EmbeddedVars.Add(m_var2);
                            _AddedVars.Add((Kontel.Relkon.Classes.ControllerVar)m_var2);
                            break;

                        case 2:
                            Kontel.Relkon.Classes.ControllerIOVar m_var3 = new Kontel.Relkon.Classes.ControllerIOVar();
                            m_var3.Address = m_Vars[j].Address;
                            m_var3.HasSign = m_Vars[j].HasSign;
                            m_var3.Memory  = m_Vars[j].MemoryType;
                            m_var3.Name    = m_Vars[j].Name;
                            m_var3.Size    = m_Vars[j].Size;
                            _solution.Vars.IOVars.Add(m_var3);
                            _AddedVars.Add((Kontel.Relkon.Classes.ControllerVar)m_var3);
                            break;

                        case 3:
                            Kontel.Relkon.Classes.ControllerUserVar m_var4 = new Kontel.Relkon.Classes.ControllerUserVar();
                            m_var4.Address = m_Vars[j].Address;
                            m_var4.HasSign = m_Vars[j].HasSign;
                            m_var4.Memory  = m_Vars[j].MemoryType;
                            m_var4.Name    = m_Vars[j].Name;
                            m_var4.Size    = m_Vars[j].Size;
                            _solution.Vars.UserVars.Add(m_var4);
                            _AddedVars.Add((Kontel.Relkon.Classes.ControllerVar)m_var4);
                            break;

                        default:
                            break;
                        }
                    }
                }
                RebuildTree();
                //Создание списка опрашиваемых переменных
                for (int j = 0; j < m_Vars.Length; j++)
                {
                    bool m_IsFined = false;
                    for (int k = 0; k < 4; k++)
                    {
                        for (int i = 0; i < this.tvVars.Nodes[k].Nodes.Count; i++)
                        {
                            if (this.tvVars.Nodes[k].Nodes[i].Text.CompareTo(m_Vars[j].Name) == 0)
                            {
                                try
                                {
                                    this.tvVars_NodeMouseDoubleClick(null, new TreeNodeMouseClickEventArgs(this.tvVars.Nodes[k].Nodes[i], MouseButtons.Left, 2, 0, 0));
                                    m_IsFined = true;
                                }
                                catch { }
                                break;
                            }
                        }
                        if (m_IsFined)
                        {
                            break;
                        }
                    }
                    _engine.Parameters.ReadingVars.Remove(m_Vars[j]);
                    for (int i = 0; i < _engine.Parameters.ReadingVars.Count; i++)
                    {
                        if (_engine.Parameters.ReadingVars[i].Name == m_Vars[j].Name)
                        {
                            m_Vars[j] = _engine.Parameters.ReadingVars[i];
                        }
                    }
                    if ((m_IsFined) && (!this._engine.Parameters.ReadingVars.Contains(m_Vars[j])))
                    {
                        this._engine.Parameters.ReadingVars.Add(m_Vars[j]);
                    }
                }
                _IsReading = true;
            }
        }