コード例 #1
0
        internal void SetEvaluation(VariableViewModel wrapper)
        {
            VsAppShell.Current.AssertIsOnMainThread();

            // Is the variable gone?
            if (wrapper.TypeName == null)
            {
                SetError(string.Format(CultureInfo.InvariantCulture, Package.Resources.VariableGrid_Missing, wrapper.Expression));
                _evaluation = null;
                return;
            }

            ClearError();

            // Does it have the same size and shape? If so, can update in-place (without losing scrolling etc).
            if (_evaluation?.Dimensions.SequenceEqual(wrapper.Dimensions) == true)
            {
                VariableGrid.Refresh();
                return;
            }

            // Otherwise, need to refresh the whole thing from scratch.
            VariableGrid.Initialize(new GridDataProvider(wrapper));
            _evaluation = wrapper;
        }
コード例 #2
0
 private void advancedDataGridView_main_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex == -1)
         {
         }
         else
         {
             selectedIndex = e.RowIndex;
             string str1 = (string)this.advancedDataGridView_main.Rows[e.RowIndex].Cells[0].Value;
             str1 = str1.ToLower();
             foreach (VariableGrid variablegrid in tempList)
             {
                 if (variablegrid.VarName.ToLower() == str1)
                 {
                     Selectedvariablegrid = variablegrid;
                     MainForm.Instance().m_propertyGrid.SelectedObject = Selectedvariablegrid;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #3
0
        //AlarmObject selectedalarmobject;
        // List<AlarmObject> AlarmObjectList = new List<AlarmObject>();
        // public AlarmFrm(MainForm _mainewsform, tblVariable _tblvariable)
        //{
        //   mainewsform = _mainewsform;
        //    tblvariable = _tblvariable;
        //    InitializeComponent();
        //}

        public AlarmForm(VariableGrid _variablegrid)
        {
            // mainewsform = null;
            Refvariablegrid = _variablegrid;
            variablegrid    = new VariableGrid(_variablegrid);
            InitializeComponent();
        }
コード例 #4
0
        internal void SetEvaluation(IRSessionDataObject dataObject)
        {
            _services.MainThread().Assert();

            // Is the variable gone?
            if (dataObject.TypeName == null)
            {
                SetError(string.Format(CultureInfo.InvariantCulture, Package.Resources.VariableGrid_Missing, dataObject.Expression));
                _evaluation = null;
                return;
            }

            ClearError();

            // Does it have the same size and shape? If so, can update in-place (without losing scrolling etc).
            if (_evaluation?.Dimensions.SequenceEqual(dataObject.Dimensions) == true)
            {
                VariableGrid.Refresh();
                return;
            }

            // Otherwise, need to refresh the whole thing from scratch.
            var session = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate().RSession;

            VariableGrid.Initialize(new GridDataProvider(session, dataObject));
            _evaluation = dataObject;
        }
コード例 #5
0
        public override bool LoadTabPage()
        {
            bool ret = false;

            try
            {
                VariableGrid  variablegrid;
                tblController tblcontroller = tblSolution.m_tblSolution().GetControllerFromID(ID);
                foreach (tblPou tblpou in tblcontroller.m_tblPouCollection)
                {
                    foreach (tblVariable tblvariable in tblpou.m_tblVariableCollection)
                    {
                        if ((!Common.IsFunctionType(tblvariable.Type)) && (tblvariable.Class & (int)VarClass.FunctionInstanse) == 0)
                        {
                            switch ((VarType)tblvariable.Type)
                            {
                            case VarType.BOOL:
                                variablegrid = new BoolVariableGrid(tblvariable);
                                break;

                            case VarType.REAL:
                                variablegrid = new RealVariableGrid(tblvariable);
                                break;

                            default:
                                variablegrid = new VariableGrid(tblvariable);
                                break;
                            }
                            tempList.Add(variablegrid);
                        }
                    }
                }
                foreach (VariableGrid _variablegrid in tempList)
                {
                    object[] newrow = new object[] { _variablegrid.VarName,
                                                     _variablegrid.Description,
                                                     _variablegrid.pouName,
                                                     _variablegrid.TypeName,
                                                     _variablegrid.InitialVal,
                                                     _variablegrid.PlantStructureName };
                    _dataTable.Rows.Add(newrow);
                }
                advancedDataGridView_main.ClearSelection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(ret);
        }
コード例 #6
0
        private void SubscribeAction(DebugEvaluationResult evaluation)
        {
            VsAppShell.Current.DispatchOnUIThread(
                () => {
                if (evaluation is DebugErrorEvaluationResult)
                {
                    // evaluation error, this could happen if R object is removed
                    var error = (DebugErrorEvaluationResult)evaluation;
                    SetError(error.ErrorText);
                    return;
                }

                var wrapper = new EvaluationWrapper(evaluation);

                if (wrapper.TypeName == "NULL" && wrapper.Value == "NULL")
                {
                    // the variable should have been removed
                    SetError(
                        string.Format(
                            CultureInfo.InvariantCulture,
                            Package.Resources.VariableGrid_Missing,
                            evaluation.Expression));
                }
                else if (wrapper.Dimensions.Count != 2)
                {
                    // the same evaluation changed to non-matrix
                    SetError(
                        string.Format(
                            CultureInfo.InvariantCulture,
                            Package.Resources.VariableGrid_NotTwoDimension,
                            evaluation.Expression));
                }
                else if (wrapper.Dimensions[0] != _evaluation.Dimensions[0] ||
                         wrapper.Dimensions[1] != _evaluation.Dimensions[1])
                {
                    ClearError();

                    // matrix size changed. Reset the evaluation
                    SetEvaluation(wrapper);
                }
                else
                {
                    ClearError();

                    // size stays same. Refresh
                    VariableGrid.Refresh();
                }
            });
        }
コード例 #7
0
        internal void SetEvaluation(EvaluationWrapper evaluation)
        {
            ClearError();

            VariableGrid.Initialize(new GridDataProvider(evaluation));

            _evaluation = evaluation;

            if (_subscription != null)
            {
                _variableProvider.Unsubscribe(_subscription);
                _subscription = null;
            }

            _subscription = _variableProvider.Subscribe(
                evaluation.FrameIndex,
                evaluation.Expression,
                SubscribeAction);
        }
コード例 #8
0
ファイル: VariableGridHost.xaml.cs プロジェクト: nomada2/RTVS
        internal void SetEvaluation(EvaluationWrapper wrapper)
        {
            if (wrapper.TypeName == "NULL" && wrapper.Value == "NULL")
            {
                // the variable should have been removed
                SetError(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Package.Resources.VariableGrid_Missing,
                        wrapper.Expression));
            }
            else if (wrapper.Dimensions.Count != 2)
            {
                // the same evaluation changed to non-matrix
                SetError(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Package.Resources.VariableGrid_NotTwoDimension,
                        wrapper.Expression));
            }
            else if (_evaluation == null ||
                     (wrapper.Dimensions[0] != _evaluation.Dimensions[0] || wrapper.Dimensions[1] != _evaluation.Dimensions[1]))
            {
                // matrix size changed. Reset the evaluation
                ClearError();

                VariableGrid.Initialize(new GridDataProvider(wrapper));

                _evaluation = wrapper;
            }
            else
            {
                ClearError();

                // size stays same. Refresh
                VariableGrid.Refresh();
            }
        }
コード例 #9
0
        internal void SetEvaluation(VariableViewModel wrapper)
        {
            VsAppShell.Current.AssertIsOnMainThread();

            if (wrapper.TypeName == "NULL" && wrapper.Value == "NULL")
            {
                // the variable should have been removed
                SetError(string.Format(CultureInfo.InvariantCulture, Package.Resources.VariableGrid_Missing, wrapper.Expression));
            }
            else if (_evaluation == null ||
                     (wrapper.Dimensions.Count == 2 && (wrapper.Dimensions[0] != _evaluation.Dimensions[0] || wrapper.Dimensions[1] != _evaluation.Dimensions[1])))
            {
                // matrix size changed. Reset the evaluation
                ClearError();
                VariableGrid.Initialize(new GridDataProvider(wrapper));
                _evaluation = wrapper;
            }
            else
            {
                ClearError();
                // size stays same. Refresh
                VariableGrid.Refresh();
            }
        }