public void AddFormulaData(object sender, EventArgs e)
        {
            string formulaName = m_View.GetFormulaName();

            if (formulaName == "")
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_EmptyName, LanguageHelper.TrendViewer_Msg_EmptyName_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (!FormulaNameValid(formulaName))  //means has duplicate names
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DuplicateName, LanguageHelper.TrendViewer_Msg_DuplicateName_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            NotifyManager.GetInstance().Send(DataNotificaitonConst.AddFormula, m_View.ViewID, m_View.GetNewFormula());
            m_View.DestroyView();
        }
Ejemplo n.º 2
0
        public void TestGetInstance01()
        {
            //test Procedure call
            NotifyManager notifyManager = NotifyManager.GetInstance();

            //Post check
            Assert.IsNotNull(notifyManager);
        }
        /// <summary>
        /// EventHandler when user click "OK" on EditChartTitle form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ModifyTitles(object sender, EventArgs e)
        {
            string[] titles = m_View.GetTitles();
            m_titles[0] = titles[0];
            m_titles[1] = titles[1];
            m_titles[2] = titles[2];

            NotifyManager.GetInstance().Send(DataNotificaitonConst.ModifyTitles, m_View.ViewID, m_titles);
            m_View.DestroyView();
        }
Ejemplo n.º 4
0
        public void SaveFormulaToGrpName(object sender, EventArgs e)
        {
            string grpName = m_View.GetConfigName();

            if (grpName == "")
            {
                m_View.ShowErrMsgNoCfgName();
                return;
            }
            NotifyManager.GetInstance().Send(DataNotificaitonConst.SaveFormulaToGroup, m_View.ViewID, grpName);
            m_View.DestroyView();
        }
Ejemplo n.º 5
0
        public void LoadFormulaByGrpName(object sender, EventArgs e)  //todo: should we save the selected name in this controller?
        {
            string grpName = m_View.GetConfigName();

            if (grpName == "")
            {
                m_View.ShowErrMsgNoCfgName();
                return;
            }

            NotifyManager.GetInstance().Send(DataNotificaitonConst.SelectFormulaGroupToLoad, m_View.ViewID, grpName);
            m_View.DestroyView();
        }
        public void SaveDataPointToGrpName(object sender, EventArgs e)
        {
            string grpName = m_View.GetConfigName();

            if (grpName == "")
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_NoConfigToSave, LanguageHelper.TrendViewer_Msg_NoConfigToSave_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            m_View.DestroyView();
            NotifyManager.GetInstance().Send(DataNotificaitonConst.SaveDataPointToGroup, m_View.ViewID, grpName);
        }
Ejemplo n.º 7
0
        public void ModifyHistDataPoint(object sender, EventArgs e)
        {
            string Function_Name = "ModifyHistDataPoint";

            if (m_View.GetStartDate() > m_View.GetEndDate())
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_StartDateMoreThenEnd, LanguageHelper.TrendViewer_Msg_StartDateMoreThenEnd_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_WarningTitle, LanguageHelper.TrendViewer_Msg_WarningTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Warning
                    );
                return;
            }

            string dpName = m_View.GetHistDataPointName();

            if (dpName == "")
            {
                return;
            }

            if (!HistDataPointNameValid(dpName))  //means has duplicate names
            {
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DuplicateName, LanguageHelper.TrendViewer_Msg_DuplicateName_EN),
                                      StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            EtyHistDataPoint histDP = m_View.GetNewHistDataPoint();

            try
            {
                histDP.EntityKey = m_Model.GetEntityKeyByName(histDP.DPName);  //update the entityKey
            }
            catch (DatabaseConnectionException ex)
            {
//                 MessageBoxDialog.Show(
//                     StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_NoDB, LanguageHelper.TrendViewer_Msg_NoDB_EN),
//                     StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
//                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                STEE.ISCS.Log.LogHelper.Error(CLASS_NAME, Function_Name, "Can't get entitykey for historical datapoint - " + histDP.DPName + ", due to DB error.");
            }

            KeyValuePair <string, EtyHistDataPoint> pair = new KeyValuePair <string, EtyHistDataPoint>(m_originalName, histDP);

            NotifyManager.GetInstance().Send(DataNotificaitonConst.ModifyHistDataPoint, m_View.ViewID, pair);
            m_View.DestroyView();
        }
        public void LoadDataPointByGrpName(object sender, EventArgs e)  //todo: should we save the selected name in this controller?
        {
            string grpName = m_View.GetConfigName();

            if (grpName == "")
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_NoConfigToLoad, LanguageHelper.TrendViewer_Msg_NoConfigToLoad_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            m_View.DestroyView();
            NotifyManager.GetInstance().Send(DataNotificaitonConst.SelectDPGroupToLoad, m_View.ViewID, grpName);
        }
        public void ModifyMarker(object sender, EventArgs e)
        {
            string markerName = m_View.GetMarkerName();

            if (markerName == "")
            {
                return;
            }

            if (!MarkerNameValid(markerName))  //means has duplicate names
            {
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DuplicateName, LanguageHelper.TrendViewer_Msg_DuplicateName_EN),
                                      "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            KeyValuePair <string, EtyMarker> pair = new KeyValuePair <string, EtyMarker>(m_marker.MarkerName, m_View.GetNewMarker());

            NotifyManager.GetInstance().Send(DataNotificaitonConst.ModifyMarker, m_View.ViewID, pair);
            m_View.DestroyView();
        }
        public void opcItemDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string Function_Name = "opcItemDataGridView_CellDoubleClick";

            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                EtyEntity dp = m_View.getDPInGridView(e.RowIndex);
                NotifyManager.GetInstance().Send(DataNotificaitonConst.DPSelected, m_View.ViewID, dp);

                m_View.Close();
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// when user click "OK" on "Add Datapoint" form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void AddDataPointData(object sender, EventArgs e)
        {
            string dpName = m_View.GetDataPointName();

            if (dpName == "")
            {
                return;
            }

            if (!DataPointNameValid(dpName))  //means has duplicate names
            {
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DuplicateName, LanguageHelper.TrendViewer_Msg_DuplicateName_EN)
                                      , "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }

            NotifyManager.GetInstance().Send(DataNotificaitonConst.AddDataPoint, m_View.ViewID, m_View.GetNewDataPoint());

            m_View.DestroyView();
        }
Ejemplo n.º 12
0
        public void TestDeattach01()
        {
            //Initial setup
            IController controller = new ControllerTest();

//             view = new ViewTest();
//             view.ViewType = ViewTest.ViewTestType;
//             model = new ModelTest();
//             controller.Attach(model, view);

            //test call
            controller.Deattach();

            //post Condition check
            Accessor controllerAccessor = ReflectionAccessor.Wrap(controller);

            Assert.IsNull(controllerAccessor.GetField("m_View"));
            Assert.IsNull(controllerAccessor.GetField("m_Model"));

            Accessor notifyManagerAccessor = ReflectionAccessor.Wrap(NotifyManager.GetInstance());
            Dictionary <IObserver, IObserver> observerMap = (Dictionary <IObserver, IObserver>)notifyManagerAccessor.GetField("m_ObserverMap");

            Assert.IsFalse(observerMap.ContainsKey(controller));
        }
        public void FormClose(object sender, EventArgs e)
        {
            KeyValuePair <string, List <EtyFormula> > pair = new KeyValuePair <string, List <EtyFormula> >(m_grpName, ConvertDataTableToList());

            NotifyManager.GetInstance().Send(DataNotificaitonConst.FormulaListClosed, m_View.ViewID, pair);
        }
Ejemplo n.º 14
0
        public static NotifyManager CreateNotifyManager01()
        {
            NotifyManager notifyManager = NotifyManager.GetInstance();

            return(notifyManager);
        }