Пример #1
0
 public override void Execute(INotification notification)
 {
     base.Execute(notification);
     SelectionModel selectionModel = (SelectionModel) DataGridFacade.Instance.RetrieveModel(SelectionModel.NAME);
     switch (notification.Code)
     {
         case Notifications.ItemsChanged:
             selectionModel.Items = notification.Body as IList<object>;
             break;
         case Notifications.SelectingItems:
             if (notification.Type == NotificationTypes.ClearSelection)
             {
                 selectionModel.SelectedItems.Clear();
             }
             selectionModel.Select(notification.Body);
             break;
         case Notifications.SelectAll:
             selectionModel.SelectAll();
             break;
         case Notifications.SelectRange:
             selectionModel.SelectRange(notification.Body, notification.Type == NotificationTypes.ClearSelection);
             break;
         case Notifications.DeselectingItems:
             selectionModel.SelectedItems.Deselect(notification.Body);
             break;
         case Notifications.IsItemSelected:
             selectionModel.SendNotification(Notifications.ItemIsSelected, notification.Body,
                                             selectionModel.SelectedItems.IsSelected(notification.Body).ToString());
             break;
         case Notifications.SelectionModeChanging:
             selectionModel.SelectionMode = (SelectionMode) notification.Body;
             break;
     }
 }
        /**
         * Fabricate a result by multiplying the input by 2
         *
         * @param notification the carrying the ControllerTestVO
         */
        public override void Execute(INotification notification)
        {
            var vo = (ControllerTestVO)notification.Body;

            // Fabricate a result
            vo.result = vo.result + (2 * vo.input);
        }
Пример #3
0
		public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback)
		{
            Interlocked.Increment(ref waitCounter);

			var msg = notification as GcmNotification;

			var result = new GcmMessageTransportResponse();
			result.Message = msg;
						
			//var postData = msg.GetJson();

			var webReq = (HttpWebRequest)WebRequest.Create(gcmSettings.GcmUrl);
			//webReq.ContentLength = postData.Length;
			webReq.Method = "POST";
			webReq.ContentType = "application/json";
			//webReq.ContentType = "application/x-www-form-urlencoded;charset=UTF-8   can be used for plaintext bodies
			webReq.UserAgent = "PushSharp (version: " + assemblyVerison.ToString () + ")";
			webReq.Headers.Add("Authorization: key=" + gcmSettings.SenderAuthToken);

			webReq.BeginGetRequestStream(new AsyncCallback(requestStreamCallback), new GcmAsyncParameters()
			{
				Callback = callback,
				WebRequest = webReq,
				WebResponse = null,
				Message = msg,
				SenderAuthToken = gcmSettings.SenderAuthToken,
				SenderId = gcmSettings.SenderID,
				ApplicationId = gcmSettings.ApplicationIdPackageName
			});
		}
Пример #4
0
		public override void HandleNotification (INotification notification)
		{
            switch((NotificationEnum)notification.NotifyEnum)
			{
				case NotificationEnum.HERO_INIT:
				{
                    HeroRecord record = notification.Body as HeroRecord;
                    HandleHeroInit(record);
					break;
				}
                case NotificationEnum.MOUSE_HIT_OBJECT:
                {
                    HandleHeroClick();
                    break;
                }
				case NotificationEnum.HERO_CONVERT:
				{
					int heroKid = (int)notification.Body;
					HandleHeroConvert(heroKid);
					break;
				}
				case NotificationEnum.BATTLE_PAUSE:
				{
					bool isPause = (bool)notification.Body;
					HandleBattlePause(isPause);
					break;
				}
				case NotificationEnum.HERO_TRANSPORT:
				{
					Vector3 destPosition = (Vector3)notification.Body;
					HandleHeroTransport(destPosition);
					break;
				}
			}
		}
        /**
         * Constructor.
         */
        /**
         * Fabricate a result by multiplying the input by 2
         *
         * @param event the <code>IEvent</code> carrying the <code>MacroCommandTestVO</code>
         */
        public override void Execute(INotification note)
        {
            MacroCommandTestVO vo = (MacroCommandTestVO) note.Body;

            // Fabricate a result
            vo.result1 = 2 * vo.input;
        }
Пример #6
0
 public override ScopeMatchResult Matches(IRequestContext requestContext, INotification notification)
 {
     var res = new ScopeMatchResult();
     res.Add(requestContext.CollectionName);
     res.Success = this.CollectionNames.Any(c => requestContext.CollectionName.SameAs(c));
     return res;
 }
Пример #7
0
		public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback)
		{
			if (string.IsNullOrEmpty(googleAuthToken))
				RefreshGoogleAuthToken();

			var msg = notification as C2dmNotification;

			var result = new C2dmMessageTransportResponse();
			result.Message = msg;

			//var postData = msg.GetPostData();

			var webReq = (HttpWebRequest)WebRequest.Create(C2DM_SEND_URL);
			//webReq.ContentLength = postData.Length;
			webReq.Method = "POST";
			webReq.ContentType = "application/x-www-form-urlencoded";
			webReq.UserAgent = "PushSharp (version: 1.0)";
			webReq.Headers.Add("Authorization: GoogleLogin auth=" + googleAuthToken);

			webReq.BeginGetRequestStream(requestStreamCallback, new C2dmAsyncParameters()
			{
				Callback = callback,
				WebRequest = webReq,
				WebResponse = null,
				Message = msg,
				GoogleAuthToken = googleAuthToken,
				SenderId = androidSettings.SenderID,
				ApplicationId = androidSettings.ApplicationID
			});
		}
        ///<summary>
        /// Prepare the Model.
        ///</summary>
        public override void Execute( INotification notification )
        {
            // Create User Proxy,
            UserProxy userProxy = new UserProxy();

            //Populate it with dummy data
            userProxy.AddItem( new UserVo{ Username="******", Fname="Larry", Lname="Stooge", Email="*****@*****.**", Password="******", Department = DeptEnum.ACCT } );
            userProxy.AddItem( new UserVo{ Username="******", Fname="Curly", Lname="Stooge", Email="*****@*****.**", Password="******", Department = DeptEnum.SALES } );
            userProxy.AddItem( new UserVo{ Username="******", Fname="Moe", Lname="Stooge", Email="*****@*****.**", Password="******", Department = DeptEnum.PLANT } );

            // register it
            Facade.RegisterProxy( userProxy );

            // Create Role Proxy
            RoleProxy roleProxy = new RoleProxy();

            //Populate it with dummy data
            RoleEnum[] lstoogeRoles = { RoleEnum.PAYROLL, RoleEnum.EMP_BENEFITS };
            roleProxy.AddItem( new RoleVo("lstooge", new ObservableCollection<RoleEnum>( lstoogeRoles ) ) );

            RoleEnum[] cstoogeRoles = { RoleEnum.ACCT_PAY, RoleEnum.ACCT_RCV, RoleEnum.GEN_LEDGER };
            roleProxy.AddItem( new RoleVo("cstooge", new ObservableCollection<RoleEnum>( cstoogeRoles ) ) );

            RoleEnum[] mstoogeRoles = { RoleEnum.INVENTORY, RoleEnum.PRODUCTION, RoleEnum.SALES, RoleEnum.SHIPPING };
            roleProxy.AddItem( new RoleVo("mstooge", new ObservableCollection<RoleEnum>( mstoogeRoles ) ) );

            // register it
            Facade.RegisterProxy( roleProxy );
        }
Пример #9
0
protected override void validate(object target, object rawValue, INotification notification)
{
    if (rawValue == null || rawValue.ToString() == string.Empty)
            {
                logMessage(notification, GetMessage(this, Property));
            }
}
 public override void LoadNotificationFromXml(INotification notification, XmlElement notificationElement)
 {
     var n = notification as PopupNotification;
     n.NotificationText = notificationElement.GetAttribute("notificationText");
     n.Caption = notificationElement.GetAttribute("caption");
     n.Icon = (ToolTipIcon)Enum.Parse(typeof(ToolTipIcon), notificationElement.GetAttribute("icon"));
 }
 public override void SaveNotificationToXml(INotification notification, XmlElement notificationElement)
 {
     var n = notification as PopupNotification;
     notificationElement.SetAttribute("notificationText", n.NotificationText);
     notificationElement.SetAttribute("caption", n.Caption);
     notificationElement.SetAttribute("icon", n.Icon.ToString());
 }
 internal void SetBreakPoint(CorModule module, string className, string methodName, INotification _lisenter)
 {
     BreakPointInfo breakpoint = new BreakPointInfo(module.Name, className, methodName, null, _lisenter);
     if (!breakStringVsBP.ContainsKey(breakpoint.Identifier)){
         int token = 0;
         CorFunction fun = null;
         try{
             module.Importer.FindTypeDefByName(className, 0, out token);
         } catch (Exception){
             throw new BreakPointException(className + " class is not found in" + module.Name);
         }
         MetaType type = new MetaType(module.Importer, token);
         try{
             List<BreakPointInfo> bps = new List<BreakPointInfo>();
             foreach (MetadataMethodInfo methodInfo in type.GetMethods(methodName)){
                 BreakPointInfo bp = new BreakPointInfo(module.Name, className, methodName, null, _lisenter);
                 fun = module.GetCorFuntion((uint)methodInfo.MetadataToken);
                 bp.bpoint = fun.CreateBreakPoint();
                 bp.bpoint.Activate();
                 bps.Add(bp);
             }
             if(bps.Count > 0){
                 breakStringVsBP.Add(bps[0].Identifier, bps);
             }
         } catch (Exception) {
             throw new BreakPointException(methodName + " Method is not found in" + className);
         }
     }
 }
Пример #13
0
        private void SetNotification(NotificationTypeEnum notificationTypeEnum)
        {
            _notification = _notificationFactory.Get(notificationTypeEnum);
            _notification.Configuration = new NotificationConfiguration()
            {
                Icon = AppModel.Instance.NotifyIcon,
                DefaultSound = Resources.NotificationSound
            };
            try
            {
                _notification.Configuration.CustomSound = AppModel.Instance.CustomNotificationSound;
            }
            catch (CachedSoundFileNotExistsException)
            {
                if (!_notification.NeedCustomSound())
                {
                    return;
                }

                MessageBox.Show(string.Format(Properties.Notifications.AudioFileNotFound, Application.ProductName,
                        Properties.Notifications.NotifSound),Properties.Notifications.AudioFileNotFoundTitle,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                _model.NotificationSettings = NotificationTypeEnum.SoundNotification;
            }
        }
Пример #14
0
    public override void Execute(INotification notification)
    {
        //-----------------关联命令-----------------------
      //  Facade.RegisterCommand(NotiConst.DISPATCH_MESSAGE, typeof(SocketCommand));

        //-----------------初始化管理器-----------------------
     /*   Facade.AddManager(ManagerName.Lua, new LuaScriptMgr());

        Facade.AddManager<PanelManager>(ManagerName.Panel);
        Facade.AddManager<MusicManager>(ManagerName.Music);
        Facade.AddManager<TimerManager>(ManagerName.Timer);
        Facade.AddManager<NetworkManager>(ManagerName.Network);
        Facade.AddManager<ResourceManager>(ManagerName.Resource);
     */
        //-----------------初始化管理器-----------------------
        Facade.AddManager(ManagerName.Lua, new LuaScriptMgr());


        //添加资源管理器
        Facade.AddManager<ResManager>(ManagerName.Resource);

        //游戏对象管理器
       Facade.AddManager<ObjManager>(ManagerName.ObjMgr);

        //添加音效管理器
       Facade.AddManager<AudioManager>(ManagerName.Music);

        //添加游戏管理器......!!资源管理器对其他管理器对象有依赖,,,必须放所有管理器对象后面添加
        Facade.AddManager<GameManager>(ManagerName.Game);


        

        Debug.Log("SimpleFramework StartUp-------->>>>>");
    }
 public void SaveSettingsToNotification(INotification notification)
 {
     var n = notification as UsbLampNotification;
     n.Enabled = this.settingsPanel.NotificationEnabled;
     n.FlashCount = this.settingsPanel.FlashesCount;
     n.FlashColor = this.settingsPanel.LampColor;
 }
Пример #16
0
 public override void Execute(INotification notification)
 {
     base.Execute(notification);
     Thread worker = new Thread(DoSaveTimeEntry);
     worker.IsBackground = true;
     worker.Start();
 }
Пример #17
0
 public void HandleNotification(INotification notification)
 {
     if (_interestNotifications.Contains(notification.name))
     {
         _HandleNotification(notification);
     }
 }
Пример #18
0
        /**
         * Constructor.
         */
        /**
         * Fabricate a result by multiplying the input by 2
         *
         * @param note the Notification carrying the FacadeTestVO
         */
        public override void Execute(INotification note)
        {
            FacadeTestVO vo = (FacadeTestVO) note.Body;

            // Fabricate a result
            vo.result = 2 * vo.input;
        }
Пример #19
0
        /**
         * Constructor.
         */
        /**
         * Fabricate a result by multiplying the input by 2
         *
         * @param note the note carrying the MainCommandTestVO
         */
        public override void Execute( INotification note )
        {
            MainCommandTestVO vo = (MainCommandTestVO) note.Body;

            // Fabricate a result
            vo.result = vo.result + (2 * vo.input);
        }
Пример #20
0
        protected override Window GetWindow( INotification notification )
        {
            var window = base.GetWindow( notification );

            if( WindowWidth.HasValue )
            {
                window.Width = WindowWidth.Value;
            }

            if( WindowHeight.HasValue )
            {
                window.Height = WindowHeight.Value;
            }

            window.ResizeMode = ResizeMode;

            if( WindowWidth.HasValue || WindowHeight.HasValue )
            {
                // unfortunately we cannot tell base class to NOT set SizeToContent so we correct it afterwards
                var d = DependencyPropertyDescriptor.FromProperty( Window.SizeToContentProperty, typeof( Window ) );
                d.AddValueChanged( window, OnSizeToContentChanged );
            }

            if( UseNotificationContentAsDataContext )
            {
                window.DataContext = notification.Content;
            }

            window.Closed += OnWindowClosed;

            return window;
        }
Пример #21
0
        public override void Execute(INotification notification)
        {
            if (notification.Name == Application.APPSTART)
            {
                string path = Path.Combine(ConfigLoader.Config.DirBase, "Mall.txt");
                MallAccess.Load(path);
                return;
            }
            UserNote note = notification as UserNote;
            if (note == null || note.Player == null)
                return;

            switch (note.Name)
            {

                case MallCommand.GetMallList:
                    GetMallList(note);
                    break;
                case MallCommand.BuyMallGoods:
                    BuyMallGoods(note);
                    break;
                case MallCommand.OneBondLog:
                    OneBondLog(note);
                    break;
                case MallCommand.OneBondBuy:
                    BondBuy(note);
                    break;
            }
        }
Пример #22
0
		public override void HandleNotification (INotification notification)
		{
            switch((NotificationEnum)notification.NotifyEnum)
			{
				case NotificationEnum.BLOCK_INIT:
				{
					HandleBlockInit();
					break;
				}
				case NotificationEnum.BLOCK_DISPOSE:
				{
                    HandleBlockDispose();
					break;
				}
				case NotificationEnum.BLOCK_REFRESH:
				{
					Vector3 position = (Vector3)notification.Body;
					HandleRefreshBlocks(position);
					break;
				}
                case NotificationEnum.BLOCK_SHOW_ALL:
                {
                    HandleShowAllBlocks();
                    break;
                }
			}
		}
Пример #23
0
        public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback)
        {
            var message = notification as FirefoxOSNotification;
            var data = Encoding.UTF8.GetBytes(message.ToString());

            var request = (HttpWebRequest)WebRequest.Create(message.EndPointUrl);

            request.Method = "PUT";
            request.ContentLength = data.Length;
            request.UserAgent = string.Format("PushSharp (version: {0})", version);

            using (var rs = request.GetRequestStream())
            {
                rs.Write(data, 0, data.Length);
            }

            try
            {
                request.BeginGetResponse(ResponseCallback, new object[] { request, message, callback });
            }
            catch (WebException ex)
            {
                callback(this, new SendNotificationResult(message, false, ex));
            }
        }
Пример #24
0
		public override void HandleNotification (INotification notification)
		{
            switch((NotificationEnum)notification.NotifyEnum)
			{
				case NotificationEnum.NPC_INIT:
					HandleNPCInit();
					break;
				case NotificationEnum.NPC_DISPOSE:
					HandleNPCDispose();
					break;
				case NotificationEnum.TOWN_NPC_SPAWN:
					HandleTownNPCSpawn();
					break;
                case NotificationEnum.BLOCK_SPAWN:
				{
					Block block = notification.Body as Block;
					HandleNPCSpawn(block);
					break;
				}
                case NotificationEnum.BLOCK_DESPAWN:
				{
					Block block = notification.Body as Block;
					HandleNPCDespawn(block);
					break;
				}
				case NotificationEnum.NPC_DIALOG_SHOW:
					NPC npc = notification.Body as NPC;
					HandleDialogShow(npc);
					break;
			}
		}
Пример #25
0
        /// <summary>
        /// This is the one where all the magic happens.
        /// </summary>
        /// <returns>The outcome of the policy Execution as per ISubscriber's contract</returns>
        /// <param name="requestContext">TFS Request Context</param>
        /// <param name="notification">The <paramref name="notification"/> containing the WorkItemChangedEvent</param>
        public ProcessingResult ProcessEvent(IRequestContext requestContext, INotification notification)
        {
            var result = new ProcessingResult();

            Policy[] policies = this.FilterPolicies(this.settings.Policies, requestContext, notification).ToArray();

            if (policies.Any())
            {
                IWorkItem workItem = this.store.GetWorkItem(notification.WorkItemId);

                foreach (var policy in policies)
                {
                    this.logger.ApplyingPolicy(policy.Name);
                    this.ApplyRules(workItem, policy.Rules);
                }

                this.SaveChangedWorkItems();
                result.StatusCode = 0;
                result.StatusMessage = "Success";
            }
            else
            {
                result.StatusCode = 1;
                result.StatusMessage = "No operation";
            }

            return result;
        }
        public override void HandleNotification( INotification note )
        {
            UserVo User = note.Body as UserVo;

            switch( note.Name )
            {
                case ApplicationFacade.NEW_USER:
                    ClearForm();
                    UserForm.Username.IsEnabled = true;
                    UserForm.User = User;
                    UserForm.Mode = UserForm.MODE_ADD;
                    UserForm.SubmitButton.Content = "Add User";
                    UserForm.IsEnabled = true;
                    UserForm.First.Focus();
                    UserForm.Username.IsEnabled = true;
                break;

                case ApplicationFacade.USER_DELETED:
                    UserForm.User = null;
                    ClearForm();
                break;

                case ApplicationFacade.USER_SELECTED:
                    ClearForm();
                    UserForm.IsEnabled = true;
                    UserForm.Username.IsEnabled = false;

                    UserForm.User = User;
                    UserForm.Confirm.Password = User.Password;
                    UserForm.Mode = UserForm.MODE_EDIT;
                    UserForm.First.Focus();
                    UserForm.SubmitButton.Content = "Update User";
                break;
            }
        }
        public override void Execute(INotification notification)
        {
            var programArgsProxy = Facade.RetrieveProxy<ProgramArgsProxy>(Globals.ProgramArgsProxy);
            var typeOfCommand = programArgsProxy.Args.OutputFileFormat;
            var serializationResult = string.Empty;

            switch (typeOfCommand)
            {
                case OutputReportType.FLAT:
                    serializationResult = OutputCommandsToFlat();
                    break;
                case OutputReportType.JSON:
                    serializationResult = OutputCommandsToJson();
                    break;
                case OutputReportType.XML:
                    serializationResult = OutputCommandsToXml();
                    break;
            }

            switch (programArgsProxy.Args.OutputFile)
            {
                case "":
                    Console.WriteLine(serializationResult);
                    break;
                default:
                    using (var outFile = new StreamWriter(programArgsProxy.Args.OutputFile))
                    {
                        outFile.Write(serializationResult);
                    }
                    break;
            }
        }
        public override async Task NotifyAsync(IVssRequestContext requestContext, INotification notification, BotElement bot, EventRuleElement matchingRule)
        {
            var token = bot.GetSetting("token");
            if (string.IsNullOrEmpty(token)) throw new ArgumentException("Missing token!");

            var tasks = new List<Task>();
            var slackClient = new SlackClient();

            foreach (string tfsUserName in notification.TargetUserNames)
            {
                var userId = bot.GetMappedUser(tfsUserName);

                if (userId != null)
                {
                    Message slackMessage = ToSlackMessage((dynamic)notification, bot, null, true);
                    if (slackMessage != null)
                    {
                        slackMessage.AsUser = true;
                        var t = Task.Run(async () =>
                        {
                            var response = await slackClient.SendApiMessageAsync(slackMessage, token, userId);
                            response.EnsureSuccessStatusCode();
                            var content = await response.Content.ReadAsStringAsync();
                        });
                        tasks.Add(t);
                    }
                }
            }

            await Task.WhenAll(tasks);
        }
        /// <summary>
        /// Returns the window to display as part of the trigger action.
        /// </summary>
        /// <param name="notification">The notification to be set as a DataContext in the window.</param>
        /// <returns></returns>
        protected override Window GetWindow(INotification notification)
        {
            Window wrapperWindow;

            if (WindowContent != null)
            {
                wrapperWindow = CreateWindow();

                if (wrapperWindow == null)
                    throw new NullReferenceException("CreateWindow cannot return null");

                // If the WindowContent does not have its own DataContext, it will inherit this one.
                wrapperWindow.DataContext = notification;
                wrapperWindow.Title = notification.Title;

                PrepareContentForWindow(notification, wrapperWindow);
            }
            else
            {
                wrapperWindow = CreateDefaultWindow(notification);
            }

            if (AssociatedObject != null)
                wrapperWindow.Owner = Window.GetWindow(AssociatedObject);

            // If the user provided a Style for a Window we set it as the window's style.
            if (WindowStyle != null)
                wrapperWindow.Style = WindowStyle;

            return wrapperWindow;
        }
Пример #30
0
        public override void Execute(INotification notification)
        {
            if (notification.Name == Application.APPSTART)
            {
                //取得活动列表
                WebBusiness.PartList();
                return;
            }

            UserNote note = notification as UserNote;
            if (note != null)
            {
                ExecuteNote(note);
            }

            Notification nf = notification as Notification;
            if (nf != null)
            {
                if (nf.Name == WebCommand.GetPartList)
                {
                    WebBusiness.PartList();
                    PlayersProxy.CallAll(WebCommand.UpdatePartListR, new object[] { true });
                }
            }
        }
Пример #31
0
 private IEnumerable <Policy> FilterPolicies(IEnumerable <Policy> policies, IRequestContext requestContext, INotification notification)
 {
     return(policies.Where(policy => policy.Scope.All(scope =>
     {
         var result = scope.Matches(requestContext, notification);
         this.logger.PolicyScopeMatchResult(scope, result);
         return result.Success;
     })));
 }
Пример #32
0
 public void RemoveDomainEvent(INotification eventItem)
 {
     _domainEvents?.Remove(eventItem);
 }
Пример #33
0
 public void AddDomainEvent(INotification eventItem)
 {
     _domainEvents = _domainEvents ?? new List <INotification>();
     _domainEvents.Add(eventItem);
 }
Пример #34
0
 public void AddDomainEvent(INotification eventItem)
 {
     domainEvents.Add(eventItem);
 }
 public ExampleService(IExampleRepository exampleRepository, INotification notification) : base(notification)
 {
     _exampleRepository = exampleRepository;
     _notification      = notification;
 }
Пример #36
0
 public GenericService(INotification notification)
 {
     this._notification = notification;
 }
Пример #37
0
 public AccountController(ILoggerFactory loggerFactory, INotification emailSender, IAuthService authService, ILanguage language) :
     base(loggerFactory.CreateLogger <AccountController>(), language)
 {
     _emailSender = emailSender;
     _authService = authService;
 }
 /// <inheritdoc />
 /// <summary>
 /// Handle <c>INotification</c>s.
 /// </summary>
 /// <remarks>
 ///     <para c="INotification">
 ///         Typically this will be handled in a switch statement,
 ///         with one 'case' entry per
 ///         the <c>Mediator</c> is interested in.
 ///     </para>
 /// </remarks>
 /// <param name="notification"></param>
 public virtual void HandleNotification(INotification notification)
 {
 }
 public UsuarioUnauthorizedController(IUsuarioService usuarioService, IUsuarioRepository repository, INotification notification)
 {
     _usuarioService    = usuarioService;
     _usuarioRepository = repository;
     _notification      = notification;
 }
 protected abstract T CreateWindow(INotification context);
Пример #41
0
 public void SendNotification(INotification notification)
 {
     notification.SendNotification();
 }
Пример #42
0
 /// <summary>
 /// 此命令被调用时执行的函数
 /// </summary>
 /// <param name="notification"></param>
 public virtual void Execute(INotification notification)
 {
 }
Пример #43
0
 public void PublishNotification(INotification notification)
 {
 }
Пример #44
0
 public override void HandleNotification(INotification notification)
 {
 }
Пример #45
0
 public NotificationRequeueEventArgs(INotification notification, Exception cause)
 {
     this.Cancel       = false;
     this.Notification = notification;
     this.RequeueCause = cause;
 }
Пример #46
0
 public Customer(INotification notification)
 {
     this.Notification = notification;
 }
Пример #47
0
 public void QueueNotification(INotification notification)
 {
     QueueNotification(notification, false);
 }
Пример #48
0
 public async Task NotifyAsync(INotification notification)
 {
     await _notificationHandler.HandleAsync(notification);
 }
Пример #49
0
 public abstract void LoadNotificationFromXml(INotification notification, XmlElement notificationElement);
Пример #50
0
        protected void RaiseSubscriptionExpired(string expiredSubscriptionId, DateTime expirationDateUtc, INotification notification)
        {
            var evt = OnDeviceSubscriptionExpired;

            if (evt != null)
            {
                evt(this, expiredSubscriptionId, expirationDateUtc, notification);
            }
        }
Пример #51
0
 public abstract void Notify(INotification notification);
 /// <summary>
 /// Send message with <see cref="SendGridProvider"/>
 /// </summary>
 /// <param name="notification">The notification object</param>
 /// <param name="message">The wrapper of the message that will be sent</param>
 /// <returns></returns>
 public static Task <NotificationResult> SendEmailWithSendGrid(this INotification notification, SendGridMessage message)
 {
     return(notification.Send(SendGridConstants.DefaultName, message.ToParameters()));
 }
Пример #53
0
 public abstract void Handle(INotification message);
Пример #54
0
 public abstract void SaveNotificationToXml(INotification notification, XmlElement notificationElement);
Пример #55
0
 public NotificationDecorator(IAuthentication authentication, INotification notification) : base(authentication)
 {
     _Notification = notification;
 }
Пример #56
0
 /// <summary>
 /// Notify <c>Observer</c>s of an <c>INotification</c>
 /// </summary>
 /// <remarks>This method is left public mostly for backward compatibility, and to allow you to send custom notification classes using the facade.</remarks>
 /// <remarks>Usually you should just call sendNotification and pass the parameters, never having to construct the notification yourself.</remarks>
 /// <param name="notification">The <c>INotification</c> to have the <c>View</c> notify observers of</param>
 /// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
 public void NotifyObservers(INotification notification)
 {
     // The view is initialized in the constructor of the singleton, so this call should be thread safe.
     // This method is thread safe on the view.
     m_view.NotifyObservers(notification);
 }
        public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback)
        {
            var n = notification as BlackberryNotification;

            try
            {
                var response    = http.PostNotification(bisChannelSettings, n).Result;
                var description = string.Empty;

                var status = new BlackberryMessageStatus
                {
                    Notification = n,
                    HttpStatus   = HttpStatusCode.ServiceUnavailable
                };

                var bbNotStatus = string.Empty;
                status.HttpStatus = response.StatusCode;

                var doc = XDocument.Load(response.Content.ReadAsStreamAsync().Result);

                XElement result = doc.Descendants().FirstOrDefault(desc =>
                                                                   desc.Name == "response-result" ||
                                                                   desc.Name == "badmessage-response");
                if (result != null)
                {
                    bbNotStatus = result.Attribute("code").Value;
                    description = result.Attribute("desc").Value;
                }


                BlackberryNotificationStatus notStatus;
                Enum.TryParse(bbNotStatus, true, out notStatus);
                status.NotificationStatus = notStatus;

                if (status.NotificationStatus == BlackberryNotificationStatus.NoAppReceivePush)
                {
                    if (callback != null)
                    {
                        callback(this,
                                 new SendNotificationResult(notification, false, new Exception("Device Subscription Expired"))
                        {
                            IsSubscriptionExpired = true
                        });
                    }

                    return;
                }

                if (status.HttpStatus == HttpStatusCode.OK &&
                    status.NotificationStatus == BlackberryNotificationStatus.RequestAcceptedForProcessing)
                {
                    if (callback != null)
                    {
                        callback(this, new SendNotificationResult(notification));
                    }
                    return;
                }

                if (callback != null)
                {
                    callback(this,
                             new SendNotificationResult(status.Notification, false,
                                                        new BisNotificationSendFailureException(status, description)));
                }
            }
            catch (Exception ex)
            {
                if (callback != null)
                {
                    callback(this, new SendNotificationResult(notification, false, ex));
                }
            }
        }
Пример #58
0
 /// <summary>
 /// Windowでの操作結果をNotifictionへ適用する
 /// Window.DataContextからViewModelを取得して値の取り出しを行う
 /// </summary>
 /// <param name="windown"></param>
 /// <param name="notification"></param>
 protected virtual void ApplyWindowToNotification(Window windown, INotification notification)
 {
 }
 public BaseService(INotification notification)
 {
     this._notification = notification;
 }
Пример #60
0
 /// <summary>
 /// Notify the interested object.
 /// </summary>
 /// <param name="Notification">the <c>INotification</c> to pass to the interested object's notification method.</param>
 public virtual void NotifyObserver(INotification Notification)
 {
     NotifyMethod(Notification);
 }