示例#1
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "otherName";

            formulaListController.NotifyObserver(obj);

            obj.Name = TestConst.TEST_VIEW_ID;
            obj.Type = DataNotificaitonConst.SelectFormulaGroupToLoad;
            obj.Body = TestConst.FORMULA_GROUP_NAME;
            formulaListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.SaveFormulaToGroup;
            obj.Body = TestConst.FORMULA_GROUP_NAME;
            formulaListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.AddFormula;
            obj.Body = new EtyFormula();
            formulaListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.ModifyFormula;
            KeyValuePair <string, EtyFormula> pair = new KeyValuePair <string, EtyFormula>("", new EtyFormula());

            obj.Body = pair;
            formulaListController.NotifyObserver(obj);
        }
示例#2
0
 public ContactEdit(NotifyObject no, tbl_Contact i)
 {
     InitializeComponent();
     notifyObj = no;
     item = i;
     grMain.DataContext = item;
 }
示例#3
0
 public AccountEdit(NotifyObject no, tbl_Account item)
 {
     InitializeComponent();
     notifyObj = no;
     account = item;
     grMain.DataContext = account;
 }
示例#4
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "Another_ViewID";
            markerListController.NotifyObserver(obj);

            obj.Name = TestConst.TEST_VIEW_ID;
            obj.Type = DataNotificaitonConst.SelectMarkGroupToLoad;
            obj.Body = TestConst.MARK_GROUP_NAME;
            markerListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.SaveMarkerToGroup;
            markerListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.AddMarker;
            EtyMarker ety = new EtyMarker();

            ety.MarkerName = "tempMarker";
            obj.Body       = ety;
            markerListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.ModifyMarker;
            KeyValuePair <string, EtyMarker> pair = new KeyValuePair <string, EtyMarker>("tempName", ety);

            obj.Body = pair;
            markerListController.NotifyObserver(obj);

            markerListController.DeleteByMarkerName("tempMarker");
        }
示例#5
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "aa";
            changeTrendTitleController.NotifyObserver(obj);
        }
        public override void NotifyObserver(NotifyObject notifyObj)
        {
            //throw new Exception("The method or operation is not implemented.");
            //  notifyObj.Name = can be a view id
            //  notifyObj.Type==Notify data type which is defined in the DataNotificationCost.cs file

            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.
            if (notifyObj.Type == DataNotificaitonConst.SelectFormulaGroupToLoad)
            {
                SetFormulaTable(m_Model.GetFormulaListByGrp((string)(notifyObj.Body)));
                m_grpName = (string)(notifyObj.Body);
                m_View.PopulateDataPointListDataGridView(1);
            }
            if (notifyObj.Type == DataNotificaitonConst.SaveFormulaToGroup)
            {
                m_grpName = (string)(notifyObj.Body);
                SaveFormulaListToGroup((string)(notifyObj.Body));
            }
            if (notifyObj.Type == DataNotificaitonConst.AddFormula)
            {
                AddFormulaToList((EtyFormula)(notifyObj.Body));
            }
            if (notifyObj.Type == DataNotificaitonConst.ModifyFormula)
            {
                KeyValuePair <string, EtyFormula> pair = (KeyValuePair <string, EtyFormula>)(notifyObj.Body);
                ModifyFormula(pair.Key, pair.Value);
            }
        }
示例#7
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "b";
            dataPointListController.NotifyObserver(obj);

            obj.Name = TestConst.TEST_VIEW_ID;
            obj.Type = DataNotificaitonConst.SelectDPGroupToLoad;
            obj.Body = TestConst.GROUP_NAME;
            dataPointListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.SaveDataPointToGroup;
            dataPointListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.AddDataPoint;
            obj.Body = new EtyDataPoint();
            dataPointListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.ModifyDataPoint;
            KeyValuePair <string, EtyDataPoint> pa = new KeyValuePair <string, EtyDataPoint>("dpName", new EtyDataPoint());

            obj.Body = pa;
            dataPointListController.NotifyObserver(obj);
        }
        public override void NotifyObserver(NotifyObject notifyObj)
        {
            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.
        }
示例#9
0
        private void Item_Click(object sender, RoutedEventArgs e)
        {
            Hyperlink    obj          = (Hyperlink)sender;
            NotifyObject notifyObject = (NotifyObject)obj.Tag;

            if (notifyObject.ClickEvent != null)
            {
                notifyObject.ClickEvent(notifyObject.Tag);
            }
        }
        /// <summary>
        /// Create Notification Object
        /// </summary>
        /// <param name="genStoreDAO"></param>
        /// <returns></returns>
        private NotifyObject GetNotifyObject(Interface.Alarm.AlarmObject alarmObject, GenStoreInfo genStoreInfo, NotifyMobiles notifyMobiles)
        {
            string            toPhoneNumber     = string.Empty;
            string            toName            = string.Empty;
            string            message           = string.Empty;
            NotificationStyle notificationStyle = new NotificationStyle();


            //*Initialize NotifyObject*//
            NotifyObject notifyObject = new NotifyObject();

            //*Mobile Number*//
            toPhoneNumber = notifyMobiles.MobileNumber;

            //*Mobile name*//
            toName = notifyMobiles.Name;

            //* Message *//
            message = alarmObject.Value.ToString();

            //if message length is greater than zero, get the format string for the message//
            if (message.Length > 0)
            {
                message = notificationStyle.GetFormatString(alarmObject, 1, "MessageBoard");
            }

            //replace line breaks with spaces
            message = message.Replace("\\n", " ");

            //substitute actual values for the format strings using the alarm object
            message = notificationStyle.SubstituteFormatString(message, alarmObject);

            ///*Assigning values to notification object*/
            notifyObject.NotificationType = "SMS";

            ///*Assign values to Notification settings*/
            Hashtable notificationSettings = new Hashtable();

            notificationSettings.Add("COMPort", genStoreInfo.MobileCOMPort);
            notificationSettings.Add("COMSettings", genStoreInfo.MobileCOMSettings);
            notificationSettings.Add("PIN1", genStoreInfo.PIN1);
            notificationSettings.Add("PIN2", genStoreInfo.PIN2);
            notificationSettings.Add("ServiceCenterNumber", genStoreInfo.SMSProviderServiceCenter);
            notificationSettings.Add("ToPhoneNumber", toPhoneNumber);
            notificationSettings.Add("FrqBand", genStoreInfo.FrequencyBand);
            notificationSettings.Add("ToName", toName);
            notificationSettings.Add("NotificationID", alarmObject.NotificationID);
            notificationSettings.Add("AttemptCount", "0");
            notifyObject.NotifierSettings = notificationSettings;
            ///* Notification Data */
            notifyObject.NotificationData = message;

            return(notifyObject);
        }
示例#11
0
        /// <summary>
        /// method to compose notify object to be used in NotifyCom
        /// </summary>
        /// <param name="alarmObject"></param>
        /// <returns></returns>
        public INotifyObject[] Compose(AlarmObject alarmObject)
        {
            List <INotifyObject> notifyObjectList = null;

            try
            {
                //if the dynamic notification is already cleared , no need to send to Notify objects list to notify engine
                if (alarmObject.IsSwitchNotificationClearProcessStarted == true)
                {
                    return(new List <INotifyObject>().ToArray());
                }
                //if IsDynamicNotificationCleared is true we need to set the below flag in order skip notifications
                //received from any escalations while the clear process is going on
                if (alarmObject.IsDynamicNotificationCleared)
                {
                    alarmObject.IsSwitchNotificationClearProcessStarted = true;
                }

                notifyObjectList = new List <INotifyObject>();

                //Get Switch notifyID using NotifyProfileID
                int switchNotifyID = GetSwitchNotifyID(alarmObject.NotifyProfileID, alarmObject.NotificationID);

                //Get relay switch configuration object
                RelaySwitchConfig relaySwitchConfig = GetRelaySwitchConfig(switchNotifyID);

                //Populate the relaySwitch config settings into notification settings, for use in Switch Notify Com
                NotifyObject notifyObject = new NotifyObject();

                //assign the bit mask value set in the escalation profiles and sensor attributes
                notifyObject.NotificationData = alarmObject.SwitchBitmask;

                //set the notification type
                notifyObject.NotificationType = "RELAYSWITCH";

                //assign the switch configurations to notified settings
                Hashtable ht = GetNotificationSettings(relaySwitchConfig);
                ht["IsDynamicNotificationCleared"] = alarmObject.IsDynamicNotificationCleared;
                ht["SensorAlarmID"]  = alarmObject.SensorAlarmID;
                ht["FactoryID"]      = alarmObject.FactoryID;
                ht["NotificationID"] = alarmObject.NotificationID;

                notifyObject.NotifierSettings = ht;

                //add notify object to list
                notifyObjectList.Add(notifyObject);
            }
            catch (Exception ex)
            {
                LogBook.Write(ex, "CooperAtkins.NotificationClient.NotificationComposer.SwitchNotificationComposer");
            }
            //return the notify objects to Notify Com
            return(notifyObjectList.ToArray());
        }
示例#12
0
        /// <summary>
        /// 匿名クラスのインスタンスを渡します。
        /// </summary>
        /// <remarks>
        /// NotifyObjectはオブジェクト内にプロパティを辞書としてもっているため、
        /// このクラスでは直接その辞書を使って文字列のフォーマットを行います。
        /// </remarks>
        public static string NamedFormat(string format, NotifyObject obj)
        {
            if (string.IsNullOrEmpty(format) || obj == null)
            {
                return(string.Format(format, obj));
            }

            // プロパティ名とプロパティ値をセットにした辞書を使い、
            // それを使って文字列埋め込みを行います。
            return(NamedFormat(format, obj.GetPropertyData()));
        }
示例#13
0
        /// <summary>
        /// Get notification object
        /// </summary>
        /// <param name="alarmObject"></param>
        /// <returns></returns>
        private NotifyObject GetNotifyObject(AlarmObject alarmObject)
        {
            string       scriptArgs   = GetScriptArguments(alarmObject);
            string       errorMsg     = string.Empty;
            string       scriptName   = ConfigurationManager.AppSettings.Get("ScriptPath").ToStr();
            NotifyObject notifyObject = new NotifyObject();

            NotificationStyle notificationStyle = new NotificationStyle();

            /*Set Notification Type*/
            notifyObject.NotificationType = "Switch";

            /*Notification Data*/
            notifyObject.NotificationData = "";

            Hashtable notificationSettings = new Hashtable();

            /*Script Arguments*/
            notificationSettings.Add("ScriptArgs", scriptArgs);

            /*Script Name*/
            notificationSettings.Add("ScriptName", scriptName);

            /*Notification ID*/
            notificationSettings.Add("NotificationID", alarmObject.NotificationID);

            /*Notification Settings*/
            notifyObject.NotifierSettings = notificationSettings;

            if (scriptName == string.Empty)
            {
                errorMsg = string.Format(ErrorMessages.ScriptComposer_InvalidScriptFileName, scriptName);

                /*If the script file name is empty record notification.*/
                notificationStyle.RecordNotification(errorMsg, alarmObject.NotificationID, 0, NotifyStatus.FAIL, NotifyTypes.SCRIPT);

                /*Log error*/
                LogBook.Write(_logContent + " *** Skipping custom alert script - no script found");
            }
            else if (!File.Exists(scriptName)) /*Check weather the script file exist or not*/
            {
                errorMsg = string.Format(ErrorMessages.ScriptComposer_ScriptFileNotFound, scriptName);

                /*If file doesn't exist in the specified path record notification*/
                notificationStyle.RecordNotification(errorMsg, alarmObject.NotificationID, 0, NotifyStatus.FAIL, NotifyTypes.SCRIPT);

                /*Log if script file not found*/
                LogBook.Write(_logContent + " *** Skipping custom alert script - file not found: ");
            }

            return(notifyObject);
        }
示例#14
0
        public void TestNotifyObserver()
        {
            NotifyObject notifyObj = new NotifyObject();

            notifyObj.Name = "anotherName";
            trendViewController.NotifyObserver(notifyObj);

            notifyObj.Name = TestConst.TEST_VIEW_ID;
            notifyObj.Type = DataNotificaitonConst.DPListClosed;
            List <EtyDataPoint> list1 = new List <EtyDataPoint>();
            KeyValuePair <string, List <EtyDataPoint> > pair1 = new KeyValuePair <string, List <EtyDataPoint> >("Test Group Name", list1);
            EtyDataPoint dp = new EtyDataPoint();

            dp.ConfigName = "Test Group Name";
            list1.Add(dp);
            notifyObj.Body = pair1;
            trendViewController.NotifyObserver(notifyObj);

            notifyObj.Type = DataNotificaitonConst.HistDPListClosed;
            List <EtyHistDataPoint> histList = new List <EtyHistDataPoint>();
            KeyValuePair <string, List <EtyHistDataPoint> > pair2 = new KeyValuePair <string, List <EtyHistDataPoint> >("Hist Test Group Name", histList);

            histList.Add(new EtyHistDataPoint());
            notifyObj.Body = pair2;
            trendViewController.NotifyObserver(notifyObj);

            notifyObj.Type = DataNotificaitonConst.MarkListClosed;
            List <EtyMarker> markerList = new List <EtyMarker>();
            KeyValuePair <string, List <EtyMarker> > pair3 = new KeyValuePair <string, List <EtyMarker> >("Marker Test Group Name", markerList);

            markerList.Add(new EtyMarker());
            notifyObj.Body = pair3;
            trendViewController.NotifyObserver(notifyObj);


            notifyObj.Type = DataNotificaitonConst.FormulaListClosed;
            List <EtyFormula> formulaList = new List <EtyFormula>();
            KeyValuePair <string, List <EtyFormula> > pair4 = new KeyValuePair <string, List <EtyFormula> >("Formula Test Group Name", formulaList);

            formulaList.Add(new EtyFormula());
            notifyObj.Body = pair4;
            trendViewController.NotifyObserver(notifyObj);

            notifyObj.Type = DataNotificaitonConst.ModifyTitles;
            string[] titles = new string[3];
            titles[0]      = "a";
            titles[1]      = "b";
            titles[2]      = "c";
            notifyObj.Body = titles;
            trendViewController.NotifyObserver(notifyObj);
        }
        public INotifyObject PrepareNotifyObject(object data)
        {
            if (data is string || data is XmlReader)
            {
            }
            else
            {
                throw new ArgumentNullException("data parameter must be string or XmlReader type.");
            }

            INotifyObject notifyObject = NotifyObject.Create(data);

            return(notifyObject);
        }
示例#16
0
        public void TestNotifyObjectConstructor01()
        {
            NotifyObject notifyObject = new NotifyObject();

            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)notifyObject.Name);
            recorder.Record((string)notifyObject.Type);
            recorder.FinishRecording();
            #endregion
            #region Assertions
            Assert.IsNull((string)notifyObject.Name);
            Assert.IsNull((string)notifyObject.Type);
            #endregion
        }
示例#17
0
        public void TestNotifyObserver()
        {
            NotifyObject notifyObj = new NotifyObject();

            notifyObj.Name = "dldl";
            dataPointDataController.NotifyObserver(notifyObj);

            notifyObj.Name = TestConst.TEST_VIEW_ID;
            notifyObj.Type = DataNotificaitonConst.DPSelected;
            EtyEntity ety = new EtyEntity();

            ety.Name       = "bb";
            notifyObj.Body = ety;
            dataPointDataController.NotifyObserver(notifyObj);
        }
示例#18
0
        public void TestBodyGetter01()
        {
            NotifyObject notifyObject = NotifyObjectFactory.CreateNotifyObject01();
            object       body         = notifyObject.Body;

            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)notifyObject.Name);
            recorder.Record((string)notifyObject.Type);
            recorder.FinishRecording();
            #endregion
            #region Assertions
            Assert.IsNull((string)notifyObject.Name);
            Assert.IsNull((string)notifyObject.Type);
            #endregion
        }
示例#19
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "AnotherViewID";

            histDataPointDataController.NotifyObserver(obj);

            obj.Name = TestConst.TEST_VIEW_ID;
            obj.Type = DataNotificaitonConst.DPSelected;
            EtyEntity ety = new EtyEntity();

            ety.Name = "dpName";
            obj.Body = ety;
            histDataPointDataController.NotifyObserver(obj);
        }
示例#20
0
        public void TestCreateNotifyObject01()
        {
            NotifyObject notifyObject = CreateNotifyObject01();

            Assert.IsNotNull(notifyObject);
            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)notifyObject.Name);
            recorder.Record((string)notifyObject.Type);
            recorder.FinishRecording();
            #endregion
            #region Assertions
            Assert.IsNull((string)notifyObject.Name);
            Assert.IsNull((string)notifyObject.Type);
            #endregion
        }
示例#21
0
        /// <summary>
        /// Create Notification Object
        /// </summary>
        /// <param name="genStoreDAO"></param>
        /// <returns></returns>
        private NotifyObject GetNotifyObject(Interface.Alarm.AlarmObject alarmObject, GenStoreInfo genStoreInfo)
        {
            string PhoneNumber = string.Empty;
            string Name        = string.Empty;
            string CallerID    = string.Empty;

            NotificationStyle notificationStyle = new NotificationStyle();


            //*Initialize NotifyObject*//
            NotifyObject notifyObject = new NotifyObject();


            PhoneNumber = alarmObject.IVRPhoneNumber;
            Name        = alarmObject.PersonName;
            CallerID    = genStoreInfo.ToPhoneNumber;



            ///*Assigning values to notification object*/
            notifyObject.NotificationType = "Voice";

            ///*Assign values to Notification settings*/
            Hashtable notificationSettings = new Hashtable();

            notificationSettings.Add("PhoneNumber", PhoneNumber);

            notificationSettings.Add("PersonName", Name);
            notificationSettings.Add("NotificationID", alarmObject.NotificationID);
            notificationSettings.Add("TransactionID", alarmObject.TransID);
            notificationSettings.Add("TimeOutOfRange", alarmObject.TimeOutOfRange);
            notificationSettings.Add("Value", alarmObject.Value);
            notificationSettings.Add("DeviceName", alarmObject.ProbeName);
            notificationSettings.Add("isMissComm", alarmObject.IsMissCommNotification);
            notificationSettings.Add("GroupName", alarmObject.GroupName);
            notificationSettings.Add("AlarmTime", alarmObject.AlarmTime);
            notificationSettings.Add("Probe", alarmObject.Probe);
            notificationSettings.Add("FromNumber", CallerID);
            notificationSettings.Add("AlarmID", alarmObject.AlarmID);


            notifyObject.NotifierSettings = notificationSettings;


            return(notifyObject);
        }
示例#22
0
        public void TestTypeSetter01()
        {
            NotifyObject notifyObject = NotifyObjectFactory.CreateNotifyObject01();
            string       type         = string.Empty;

            notifyObject.Type = type;
            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)notifyObject.Name);
            recorder.Record((string)notifyObject.Type);
            recorder.FinishRecording();
            #endregion
            #region Assertions
            Assert.IsNull((string)notifyObject.Name);
            Assert.AreEqual("", (string)notifyObject.Type);
            #endregion
        }
        public override void NotifyObserver(NotifyObject notifyObj)
        {
            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.
            if (notifyObj.Type == DataNotificaitonConst.DPListClosed)
            {
                m_trendCache.m_dataPointList.Clear();
                KeyValuePair <string, List <EtyDataPoint> > pair = (KeyValuePair <string, List <EtyDataPoint> >)(notifyObj.Body);
                m_trendCache.m_datapointGrpName = pair.Key;
                m_trendCache.m_dataPointList    = pair.Value;
            }
            if (notifyObj.Type == DataNotificaitonConst.HistDPListClosed)
            {
                m_trendCache.m_histDataPointList.Clear();
                KeyValuePair <string, List <EtyHistDataPoint> > pair = (KeyValuePair <string, List <EtyHistDataPoint> >)(notifyObj.Body);
                m_trendCache.m_histDatapointGrpName = pair.Key;
                m_trendCache.m_histDataPointList    = pair.Value;
            }
            if (notifyObj.Type == DataNotificaitonConst.MarkListClosed)
            {
                m_trendCache.m_markerList.Clear();
                KeyValuePair <string, List <EtyMarker> > pair = (KeyValuePair <string, List <EtyMarker> >)(notifyObj.Body);
                m_trendCache.m_markerGrpName = pair.Key;
                m_trendCache.m_markerList    = pair.Value;
            }
            if (notifyObj.Type == DataNotificaitonConst.FormulaListClosed)
            {
                m_trendCache.m_formulaList.Clear();

                KeyValuePair <string, List <EtyFormula> > pair = (KeyValuePair <string, List <EtyFormula> >)(notifyObj.Body);
                m_trendCache.m_formulaGrpName = pair.Key;
                m_trendCache.m_formulaList    = pair.Value;
            }

            if (notifyObj.Type == DataNotificaitonConst.ModifyTitles)
            {
                string[] titles = (string[])(notifyObj.Body);
                m_View.UpdateTitles(titles);
            }
        }
示例#24
0
 /// <summary>
 /// ViewModel.Selectionと、特定のNotifyObjectのnameをOneWayでBindする。
 /// ViewModel.SelectionTypeIsBool == true ならNotifyObjectのnameをbool型とみなす。falseならint型とみなす。
 ///
 /// 注意)
 /// ViewModel.SelectionOffsetの値が利いてくるので注意。
 /// Bind()を呼び出す前に、ViewModel.SelectionOffsetを適切な値に設定すること。
 /// </summary>
 /// <param name="notify"></param>
 /// <param name="name"></param>
 public void Bind(NotifyObject notify, string name)
 {
     if (ViewModel.SelectionTypeIsBool)
     {
         ViewModel.AddPropertyChangedHandler("Selection", (args) =>
         {
             notify.SetValueAndRaisePropertyChanged(name, ((int)args.value + ViewModel.SelectionOffset) != 0);
         });
         ViewModel.Selection = (notify.GetValue <bool>(name) ? 1 : 0) - ViewModel.SelectionOffset; // いま即座に値を反映させておく。
     }
     else
     {
         ViewModel.AddPropertyChangedHandler("Selection", (args) =>
         {
             notify.SetValueAndRaisePropertyChanged(name, (int)args.value + ViewModel.SelectionOffset);
         });
         ViewModel.Selection = notify.GetValue <int>(name) - ViewModel.SelectionOffset; // いま即座に値を反映させておく。
     }
 }
        public ObservableBindBox(IConfigurationChangeNotifyable changeNotifyable,
                                 IConfiguration configuration,
                                 BindSettings bindSettings,
                                 ConfigBindMode mode,
                                 Action <Action> updater)
            : base(changeNotifyable, bindSettings, mode, updater)
        {
            Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            NotifyObject  = bindSettings.Value as INotifyPropertyChanged;
            if (NotifyObject is null)
            {
                throw new InvalidCastException($"Can't case {changeNotifyable.GetType().FullName} to {typeof(INotifyPropertyChanged).FullName}");
            }
            notifyPropertyMap = NotifyObject.GetType().GetProperties()
                                .ToDictionary(x => x.Name, x => new PropertyBindBox(x));

            propertyConfigMap = new Dictionary <string, PropertyBindBox>();
            propertyVisitor   = CompilePropertyVisitor.Instance;
        }
示例#26
0
        public void TestNotifyObserver01()
        {
            //using (OPCDataSelectorController oPCDataSelectorController = OPCDataSelectorControllerFactory.CreateOPCDataSelectorController01())
            //{
            NotifyObject notifyObj = NotifyObjectFactory.CreateNotifyObject01();

            oPCDataSelectorController.NotifyObserver(notifyObj);
            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record <string>(delegate { return((string)notifyObj.Name); });
            recorder.Record <string>(delegate { return((string)notifyObj.Type); });
            recorder.FinishRecording();
            #endregion
            #region Assertions
            Assert.IsNull((string)notifyObj.Name);
            Assert.IsNull((string)notifyObj.Type);
            #endregion
            // }
        }
示例#27
0
        public override void NotifyObserver(NotifyObject notifyObj)
        {
            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.

            if (notifyObj.Type == DataNotificaitonConst.DPSelected)
            {
                EtyEntity dp = (EtyEntity)(notifyObj.Body);
                m_dp.EntityKey = dp.Pkey;  //sometimes it maybe doesn't have pkey(when the dp is not selected from the select page)
                m_dp.DPName    = dp.Name;
                if (dp.Name.CompareTo("") != 0)
                {
                    m_dp.DPLblName = dp.Name.Length > 50 ? (dp.Name).Substring(0, 50) : dp.Name;
                }
                m_View.UpdateHistDPNameAndLabel(m_dp);
            }
        }
示例#28
0
        public override void NotifyObserver(NotifyObject notifyObj)
        {
            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.

            if (notifyObj.Type == DataNotificaitonConst.DPSelected)
            {
                EtyEntity dp = (EtyEntity)(notifyObj.Body);
                m_dp.PKey   = dp.Pkey;
                m_dp.DPName = dp.Name;
                if (dp.Name.CompareTo("") != 0)
                {
                    m_dp.DPLblName = dp.Name.Length > 50 ? (dp.Name).Substring(0, 50) : dp.Name;
                }
                m_View.UpdateDPNameAndLabel(m_dp);
            }
        }
示例#29
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "AnotherViewID";
            histDataPointListController.NotifyObserver(obj);

            obj.Name = TestConst.TEST_VIEW_ID;
            obj.Type = DataNotificaitonConst.SelectHistDPGroupToLoad;
            obj.Body = TestConst.HIST_GROUP_NAME;
            histDataPointListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.SaveHistDataPointToGroup;
            histDataPointListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.AddHistDataPoint;
            obj.Body = new EtyHistDataPoint();
            histDataPointListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.ModifyHistDataPoint;
            obj.Body = new KeyValuePair <string, EtyHistDataPoint>(TestConst.HIST_DP_NAME, new EtyHistDataPoint());
            histDataPointListController.NotifyObserver(obj);
        }
示例#30
0
        public void TestNotifyObserver01()
        {
            NotifyObject notifyObj = new NotifyObject();

            oPCSampleGrpConfigStartController.NotifyObserver(notifyObj);
        }
示例#31
0
 public override void NotifyObserver(NotifyObject notifyObj)
 {
 }
示例#32
0
        public static NotifyObject CreateNotifyObject01()
        {
            NotifyObject notifyObject = new NotifyObject();

            return(notifyObject);
        }