Esempio n. 1
0
        private void CreateNotificationsInfo(NotifyCommand command)
        {
            foreach (NotificationDto notificationDto in command.Notifications)
            {
                NotificationInfo notification = new NotificationInfo();

                notification.CaId          = command.CaId;
                notification.CaTypeId      = command.CaTypeId;
                notification.VolManCho     = command.VolManCho;
                notification.AccountNumber = notificationDto.AccountNumber;
                notification.Recipient     = notificationDto.Recipient;
                notification.FieldDisplay  = notificationDto.Recipient + " (" + notificationDto.AccountNumber + ")";

                if (notificationDto.IsSent)
                {
                    notification.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Notification, command.CaId, command.EventDate);
                    notification.IsSent        = true;
                    notification.ProcessedDate = command.EventDate;
                }
                else
                {
                    notification.ProcessedDateCategory = ProcessedDateCategory.Missing;
                    notification.IsSent        = false;
                    notification.ProcessedDate = null;
                }
                _context.NotificationsInfo.Add(notification);
            }
            _context.SaveChanges();
        }
Esempio n. 2
0
 private void RaiseNotifyEvent(NotifyCommand Command, object oState)
 {
     if (this.Notify != null)
     {
         Notify(Command, oState);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Updates the taskbar icons with data provided by a given
        /// <see cref="NotifyIconData"/> instance.
        /// </summary>
        /// <param name="data">Configuration settings for the NotifyIcon.</param>
        /// <param name="command">Operation on the icon (e.g. delete the icon).</param>
        /// <param name="flags">Defines which members of the <paramref name="data"/>
        /// structure are set.</param>
        /// <returns>True if the data was successfully written.</returns>
        /// <remarks>See Shell_NotifyIcon documentation on MSDN for details.</remarks>
        public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
        {
            //do nothing if in design mode
            if (IsDesignMode)
            {
                return(true);
            }

            data.ValidMembers = flags;
            var status      = false;
            var failedTries = 0;

            while (!status && failedTries < 5)
            {
                lock (SyncRoot)
                {
                    status = WinApi.Shell_NotifyIcon(command, ref data);
                    if (status)
                    {
                        return(status);
                    }
                }

                // handle low powered machines during startup:
                // http://msdn.microsoft.com/en-us/library/bb762159(VS.85).aspx
                failedTries += 1;

                System.Threading.Thread.Sleep(100); // ms
            }

            System.Console.WriteLine("failed to write icon data");
            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectTemplatesViewModel"/> class.
        /// </summary>
        public ProjectTemplatesViewModel()
        {
            ProjectTemplates = ProjectTemplate.GetList();

            EditProjectTemplateCommand   = new NotifyCommand(o => EditProjectTemplate((ProjectTemplate)o));
            DeleteProjectTemplateCommand = new NotifyCommand(o => DeleteProjectTemplate((ProjectTemplate)o));
        }
Esempio n. 5
0
 private void OnEAnlyseData(NotifyCommand command, string mesgs) //收到数据触发报文解析事件
 {
     if (EAnlyseData != null)
     {
         EAnlyseData(command, mesgs);
     }
 }
Esempio n. 6
0
        private void OSrmSocket_Notify(NotifyCommand Command, object msg)//信息处理
        {
            //log.WriteLog("********************************************");
            //log.WriteLog("SCS->WCS:" + msg.ToString());
            //log.WriteLog("********************************************");
            msg = (object)msg.ToString().Replace("\0", "").Trim();
            switch (Command)
            {
            case NotifyCommand.Break:
                this.DisConnect();
                OnEAnlyseData(NotifyCommand.Break, m_strSRMNo + msg.ToString());
                break;

            case NotifyCommand.Connect:
                OnEAnlyseData(NotifyCommand.Connect, m_strSRMNo + msg.ToString());
                break;

            case NotifyCommand.RecvData:
                m_MessageRecv = msg.ToString();
                AnalyseMessage(m_MessageRecv);
                break;

            case NotifyCommand.SendData:
                OnEAnlyseData(NotifyCommand.SendData, msg.ToString());
                break;

            default:
                break;
            }
        }
	IEnumerator ShowNotification(NotifyCommand notificationData){
		//Construct prefab and cache uiItemCanvas
		var uiItem = Instantiate (NotificationItemPrefab) as GameObject;

		//var uiItemCanvas = uiItem.GetComponent<CanvasGroup>();

		//Set text to message
		uiItem.GetComponentInChildren<Text>().text = notificationData.Message;
		
		//Parent object to the Container
		uiItem.transform.SetParent(UIContainer);

		uiItem.transform.localScale = Vector3.zero;

		uiItem.SetActive(false);

		//yield return new WaitForSeconds(1);

		//uiItem.transform.DOScale(Vector3.one, 2f).SetEase(Ease.InOutBack);
		uiItem.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.InOutBack).OnStart(() => uiItem.SetActive(true));

		yield return new WaitForSeconds(2);

		uiItem.transform.DOScale(Vector3.zero, 0.5f).SetEase(Ease.InOutBack).OnComplete(() => Destroy(uiItem));


	}
Esempio n. 8
0
        private void UpdateNotificationsInfo(NotifyCommand command)
        {
            foreach (NotificationDto notificationDto in command.Notifications)
            {
                NotificationInfo notification = _context.NotificationsInfo.FirstOrDefault(notif => notif.CaId == command.CaId && notif.AccountNumber == notificationDto.AccountNumber && notif.Recipient == notificationDto.Recipient);

                if (notification == null)
                {
                    continue;
                }

                if (notificationDto.IsSent)
                {
                    notification.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Notification, command.CaId, command.EventDate);
                    notification.IsSent        = true;
                    notification.ProcessedDate = command.EventDate;
                }
                else
                {
                    notification.ProcessedDateCategory = ProcessedDateCategory.Missing;
                    notification.IsSent        = false;
                    notification.ProcessedDate = null;
                }
            }

            _context.SaveChanges();
        }
Esempio n. 9
0
 /// <summary>
 /// Updates the taskbar icons with data provided by a given
 /// <see cref="NotifyIconData"/> instance.
 /// </summary>
 /// <param name="data">Configuration settings for the NotifyIcon.</param>
 /// <param name="command">Operation on the icon (e.g. delete the icon).</param>
 /// <param name="flags">Defines which members of the <paramref name="data"/>
 /// structure are set.</param>
 /// <returns>True if the data was successfully written.</returns>
 /// <remarks>See Shell_NotifyIcon documentation on MSDN for details.</remarks>
 private bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
 {
     data.ValidMembers |= flags;
     lock (lockObject)
     {
         return(WinApi.Shell_NotifyIcon(command, ref data));
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Updates the taskbar icons with data provided by a given
 /// <see cref="NotifyIconData"/> instance.
 /// </summary>
 /// <param name="data">Configuration settings for the NotifyIcon.</param>
 /// <param name="command">Operation on the icon (e.g. delete the icon).</param>
 /// <param name="flags">Defines which members of the <paramref name="data"/>
 /// structure are set.</param>
 /// <returns>True if the data was successfully written.</returns>
 /// <remarks>See Shell_NotifyIcon documentation on MSDN for details.</remarks>
 public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
 {
     data.ValidMembers = flags;
     lock (SyncRoot)
     {
         return(WinApi.Shell_NotifyIcon(command, ref data));
     }
 }
Esempio n. 11
0
 public NewGameViewModel(IPlayerViewModelFactory playerViewModelFactory)
 {
     _playerViewModelFactory     = playerViewModelFactory;
     GiveFigureToPlayer1Command  = new NotifyCommand(GiveFigureToPlayer1CommandHandler);
     GiveFigureToPlayer2Command  = new NotifyCommand(GiveFigureToPlayer2CommandHandler);
     GiveDefaultFigureSetCommand = new NotifyCommand(GiveDefaultFigureSetCommandHandler);
     OkCommand = new NotifyCommand(o => OkCommandHandler((IWindow)o), o => CanOkCommandHandler());
 }
Esempio n. 12
0
 /// <summary>
 ///     Updates the taskbar icons with data provided by a given
 ///     <see cref="NotifyIconData" /> instance.
 /// </summary>
 /// <param name="data">Configuration settings for the NotifyIcon.</param>
 /// <param name="command">Operation on the icon (e.g. delete the icon).</param>
 /// <param name="flags">
 ///     Defines which members of the <paramref name="data" />
 ///     structure are set.
 /// </param>
 /// <returns>True if the data was successfully written.</returns>
 /// <remarks>See Shell_NotifyIcon documentation on MSDN for details.</remarks>
 public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
 {
     //do nothing if in design mode
     if (IsDesignMode)
     {
         return(true);
     }
     data.ValidMembers = flags;
     lock (SyncRoot) {
         return(WinApi.Shell_NotifyIcon(command, ref data));
     }
 }
Esempio n. 13
0
        public static bool smethod_2(ref NotifyIconData notifyIconData_0, NotifyCommand notifyCommand_0, IconDataMembers iconDataMembers_0)
        {
            if (Boolean_0)
            {
                return(true);
            }
            notifyIconData_0.ValidMembers = iconDataMembers_0;
            object obj2 = object_0;

            lock (obj2)
            {
                return(Class5.Shell_NotifyIcon(notifyCommand_0, ref notifyIconData_0));
            }
        }
        /// <summary>
        /// Updates the taskbar icons with data provided by a given
        /// <see cref="NotifyIconData"/> instance.
        /// </summary>
        /// <param name="data">Configuration settings for the NotifyIcon.</param>
        /// <param name="command">Operation on the icon (e.g. delete the icon).</param>
        /// <param name="flags">Defines which members of the <paramref name="data"/>
        /// structure are set.</param>
        /// <returns>True if the data was successfully written.</returns>
        /// <remarks>See Shell_NotifyIcon documentation on MSDN for details.</remarks>
        public bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
        {
            //do nothing if in design mode
            if (IsDesignMode)
            {
                return(true);
            }

            data.ValidMembers = flags;
            lock (lockObject)
            {
                return(Interop.Shell_NotifyIcon(command, ref data));
            }
        }
Esempio n. 15
0
        public IHttpActionResult PostNotifications([FromBody] NotifyCommand command)
        {
            List <NotificationInfo> notifications = _context.NotificationsInfo.Where(view => view.CaId == command.CaId).ToList();

            if (notifications.Count == 0)
            {
                CreateNotificationsInfo(command);
            }
            else
            {
                UpdateNotificationsInfo(command);
            }

            return(Ok());
        }
Esempio n. 16
0
        public MovesViewModel(IViewManager viewManager, IBoardViewModel board)
        {
            _viewManager = viewManager;
            _board       = board;

            NewGameCommand = new NotifyCommand(NewGameCommandHandler);

            //var newGame = new NewGameViewModel(new PlayerViewModelFactory());
            //newGame.Initialize();
            //newGame.GiveDefaultFigureSetCommand.Execute();
            //Player1 = newGame.Player1;
            //Player2 = newGame.Player2;

            // ActivePlayer = Player1;
        }
Esempio n. 17
0
        public void SendNotificationInputData(NotifyCommand command)
        {
            CaProcessViewModel viewModel = _apiService.Execute(command);

            IHubContext notifHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>();

            if (viewModel != null)
            {
                notifHub.Clients.All.updateProcess(viewModel);
            }

            SummaryModel summaryModel = GetSummaryModel();

            if (summaryModel != null)
            {
                notifHub.Clients.All.updateSummaryModel(summaryModel);
            }
        }
Esempio n. 18
0
        private async Task NotifySubscriber(Message msg, Connection conn)
        {
            try
            {
                var notifier = new Notifier.NotifierClient(conn.GrpcChannel);
                var command  = new NotifyCommand {
                    Sensor = msg.Sensor, Data = msg.Data, ExecutorType = conn.ExecutorType
                };
                await notifier.NotifyAsync(command);
            }
            catch (RpcException e)
            {
                Console.WriteLine($"Could not send to {conn.Address} | {e.Message}");

                if (e.StatusCode == StatusCode.Internal)
                {
                    _connectionService.RemoveConnection(conn.Address);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Could not send to {conn.Address} | {e.Message}");
            }
        }
Esempio n. 19
0
 public static extern System.Int32 Shell_NotifyIcon(NotifyCommand cmd,
                                                    ref NotifyIconData data);
Esempio n. 20
0
        public static void SendNotifyCommand(Command command)
        {
            NotifyCommand notifyCommand = (NotifyCommand)command;

            POST(JsonConvert.SerializeObject(notifyCommand), "SendNotificationInputData");
        }
Esempio n. 21
0
        private void OSRM_AnalyseMessageEvent(NotifyCommand command, string msg)
        {
            CRNObject findcob = CRNOBList.Find(
                delegate(CRNObject info)
            {
                //return (info.ScNo == m_strSRMNo && info.Port == int.Parse(m_strport) && info.zone == m_zone);
                return(info.ScNo == m_strSRMNo && info.Port == int.Parse(m_strport) && info.zone == m_zone);
                //"CRN00" + msg.Substring(41, 1)
            }
                );

            try
            {
                string alarmMsg = "";
                if (command == NotifyCommand.Connect)
                {
                    CheckConnectTimer.Stop();
                    findcob.connectstatus = 1;
                    alarmMsg = crc.UpdateSCStatus(m_strSRMNo, "Connect", m_strSRMNo.Substring(5, 1), m_zone);
                    ShowText("C", msg);
                }
                else if (command == NotifyCommand.RecvData)
                {
                    string mesgs = msg;
                    //if (mesgs.Substring(1, 2) == "LA")
                    //{
                    //    //GetSCStatusTimer.Start();//建立连接结束,开始心跳检测
                    //    mesgs.Substring(0, mesgs.Length);
                    //}
                    //string num = "CRN00" + (int.Parse(msg.Substring(41, 1))+2);//m_strSRMNo;
                    string num = m_strSRMNo;
                    if (mesgs.Substring(1, 2) == "LD")
                    {
                        OSRM.ReturnLDMsg(mesgs.Substring(3, 13));
                    }
                    if (m_strSRMNo == "CRN006")
                    {
                        num = "CRN00" + mesgs.Substring(mesgs.Length - 2, 1);
                    }
                    alarmMsg = crc.UpdateSCStatus(num, mesgs, m_strSRMNo.Substring(5, 1), m_zone);

                    if (!string.IsNullOrEmpty(alarmMsg))
                    {
                        ShowText("", alarmMsg);
                        if (mesgs.Substring(1, 2) != "LA")
                        {
                            log.WriteLog(alarmMsg);
                        }
                    }
                }
                else if (command == NotifyCommand.SendData)
                {
                    //ShowText("", msg);
                }
                else if (command == NotifyCommand.Break)
                {
                    CheckConnectTimer.Start();
                    alarmMsg = crc.UpdateSCStatus(m_strSRMNo, "Break", m_strSRMNo.Substring(5, 1), m_zone);
                    findcob.connectstatus = 0;
                    if (!string.IsNullOrEmpty(alarmMsg))
                    {
                        ShowText("", alarmMsg);
                    }
                }
                if (ENotifyTypeEventHandler != null)
                {
                    ENotifyTypeEventHandler(m_strSRMNo, m_strport, "", msg);
                }
            }
            catch (Exception ex)
            {
                //log.WriteLog("********************************************");
                //log.WriteLog("错误信息:" + ex.Message);
                //log.WriteLog("********************************************");
            }
        }
Esempio n. 22
0
 public static extern System.Int32 Shell_NotifyIcon(NotifyCommand cmd, ref NotifyIconData data);
Esempio n. 23
0
 public static extern int Shell_NotifyIcon(NotifyCommand cmd, ref NotifyIconData data);
Esempio n. 24
0
 public static extern bool Shell_NotifyIcon(NotifyCommand notifyCommand_0, [In] ref NotifyIconData notifyIconData_0);
Esempio n. 25
0
 public static extern int Shell_NotifyIcon( NotifyCommand cmd, ref NOTIFYICONDATA data );
Esempio n. 26
0
 public static bool smethod_1(ref NotifyIconData notifyIconData_0, NotifyCommand notifyCommand_0)
 {
     return(smethod_2(ref notifyIconData_0, notifyCommand_0, notifyIconData_0.ValidMembers));
 }
Esempio n. 27
0
        public MovesViewModel(IViewManager viewManager)
        {
            _viewManager = viewManager;

            NewGameCommand = new NotifyCommand(NewGameCommandHandler);
        }
    public override void Bind() {
        base.Bind();

        // Bind each button to handler:
        // When button is clicked, handler is excuted
        // Ex: When we press LevelSelectButton, we publish
        // RequestMainMenuScreenCommand and pass LevelSelectScreenViewModel type
		var evt = new RequestMainMenuScreenCommand();
		var evtPopUp = new NotifyCommand();

        this.BindButtonToHandler(LevelSelectButton, () =>
        {
			evt.ScreenType = typeof(LevelSelectScreenViewModel);
			Publish(evt);
			//Publish(new RequestMainMenuScreenCommand()
            //{
            //    ScreenType = typeof(LevelSelectScreenViewModel)
            //});
        });

        this.BindButtonToHandler(SettingsButton, () =>
        {
			evt.ScreenType = typeof(SettingsScreenViewModel);
			Publish(evt);
        });

		this.BindButtonToHandler(NoticeButton, () =>
		{
			evt.ScreenType = typeof(NoticeScreenViewModel);
			Publish(evt);
		});

		this.BindButtonToHandler(HeadButton, () =>
		{
			evt.ScreenType = typeof(SampleScreenViewModel);
			Publish(evt);
		});

		this.BindButtonToHandler(CardButton, () =>
			{
				evt.ScreenType = typeof(CardScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(CharPageButton, () =>
			{
				evt.ScreenType = typeof(CharPageScreenViewModel);
				Publish(evt);
			});
		
		this.BindButtonToHandler(ShopButton, () =>
			{
				evt.ScreenType = typeof(ShopScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(AcademyButton, () =>
			{
				evt.ScreenType = typeof(AcademyScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(ArtisanButton, () =>
			{
				evt.ScreenType = typeof(ArtisanScreenViewModel);
				Publish(evt);
			});
		
		this.BindButtonToHandler(TrainButton, () =>
			{
				evt.ScreenType = typeof(TrainScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(ConferenceButton, () =>
			{
				evt.ScreenType = typeof(ConferenceScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(ParallelButton, () =>
			{
				evt.ScreenType = typeof(ParallelScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(CompanionButton, () =>
			{
				evt.ScreenType = typeof(CompanionScreenViewModel);
				Publish(evt);
			});

		this.BindButtonToHandler(TechnologyTreeButton, () =>
			{
				evt.ScreenType = typeof(TechnologyTreeScreenViewModel);
				Publish(evt);
			});
		//Temp use
		this.BindButtonToHandler(SetBattleButton, () =>
			{

				evt.ScreenType = typeof(SetBattleScreenViewModel);
				Publish(evt);
				/*
				Publish(new UnloadSceneCommand()
					{
						SceneName = "MainMenuScene" // Unload  main menu scene
					});

				Publish(new LoadSceneCommand()
					{
						//SceneName = arg.LevelScene // Load level scene
						SceneName = "MainGameScene" // Load level scene
					});
				*/
				
				//Publish(new MainMenuFinishedEvent());
			});

		this.BindButtonToHandler(SampleButton, () =>
			{
				evt.ScreenType = typeof(SampleScreenViewModel);
				Publish(evt);
			});
        // This follows the same logic, but we use Method Group syntax.
        // And we do not publish event. We just quit.
		this.BindButtonToHandler(ExitButton, Application.Quit);
        //Equivalent to 
        //this.BindButtonToHandler(ExitButton, () => { Application.Quit; });

		//this.BindButtonToHandler(TryButton, Application.Quit);
    }
	public override void NotifyCommandHandler(NotifyCommand data){
		base.NotifyCommandHandler(data);
		//This method exists because we added NotifyComaand in the Handlers section of NotificationService.
		//It will be invoked every time you publish NotifyCommand
		StartCoroutine(ShowNotification(data));
	}
 /// <summary>
 // This method is executed when using this.Publish(new NotifyCommand())
 /// </summary>
 public virtual void NotifyCommandHandler(NotifyCommand data) {
     // Process the commands information.  Also, you can publish new events by using the line below.
     // this.Publish(new AnotherEvent())
 }
Esempio n. 31
0
 public static extern int Shell_NotifyIcon(NotifyCommand cmd, ref NotifyIconData data);
Esempio n. 32
0
 public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In]ref NotifyIconData data);
Esempio n. 33
0
 static public extern int Shell_NotifyIcon(NotifyCommand cmd, ref NOTIFYICONDATA data);
 private static extern bool Shell_NotifyIcon(NotifyCommand cmd, ref NotifyIconData data);
Esempio n. 35
0
 public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In] ref NotifyIconData data);
Esempio n. 36
0
 protected override void HandleNotifyCommand(NotifyCommand command)
 {
 }