public void RefreshCollectionIcon(object sender, MessageBusEvent evnt)
 {
     if (evnt is RefreshCollectionIconEvent)
     {
         refreshCollectionIcon();
     }
 }
Example #2
0
        public void StartActivity(object sender, MessageBusEvent evnt)
        {
            if (evnt.Data?.Length > 0)
            {
                var activityName = evnt.Data[0].ToString();

                Intent i = null;

                switch (activityName)
                {
                case "MainActivity":
                    i = new Intent(this, typeof(MainActivity));
                    break;

                default:
                    break;
                }

                if (i != null)
                {
                    i.SetFlags(ActivityFlags.NewTask);
                    base.StartActivity(i);
                }
            }
        }
Example #3
0
 public void RefreshCollectionListEventHandler(object sender, MessageBusEvent evnt)
 {
     Activity.RunOnUiThread(() => {
         mRecyclerView.setRefreshing(true);
         onRefresh();
     });
 }
Example #4
0
 private void SyncFinishedEventHandler(object sender, MessageBusEvent e)
 {
     RunOnUiThread(() =>
     {
         mNavigationView.Menu.GetItem(1).SetChecked(true);
         ChangeTheme(Resource.Color.palette_green_primary, Resource.Color.palette_green_primary_dark);
         ListItemClicked(1);
     });
 }
Example #5
0
 public void DownloadProgressEventHandler(object sender, MessageBusEvent evnt)
 {
     if (evnt is DownloadMessage progress)
     {
         Activity.RunOnUiThread(() => {
             mRecyclerView.setTipViewText(progress.message);
         });
     }
 }
Example #6
0
        /// <summary>
        /// Messages the bus event handler.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="evnt">Evnt.</param>
        public void MessageBusEventHandler(object sender, MessageBusEvent evnt)
        {
            //extrac the data
            var data2 = evnt.Data [0] as String;

            //execute on the UI thread
            BeginInvokeOnMainThread(() => {
                //post to the output box
                txtOutput.Text += data2 + Environment.NewLine;
            });
        }
Example #7
0
        public void initCategoryList(object sender, MessageBusEvent evnt)
        {
            var e = evnt as SelectionEvent;

            Activity.RunOnUiThread(() =>
            {
                mRecyclerView.setRefreshing(true);
                sort       = e.sort.GetEnumDescription();
                distillate = e.distillate.GetEnumDescription();
                onRefresh();
            });
        }
Example #8
0
		/// <summary>
		/// Messages the bus event handler.
		/// </summary>
		/// <param name="sender">Sender.</param>
		/// <param name="evnt">Evnt.</param>
		public void MessageBusEventHandler (object sender, MessageBusEvent evnt)
		{
			//extrac the data
			var data2 = evnt.Data [0] as String;

			//run on the ui thread
			RunOnUiThread (() => {
				//post to the output box
				txtOutput.Text += data2 + System.Environment.NewLine;
			});

		}
Example #9
0
        public void initCategoryList(object sender, MessageBusEvent evnt)
        {
            var e = evnt as SubEvent;

            Activity.RunOnUiThread(() =>
            {
                minor = e.minor.ToString();
                if (type.Equals(e.type.ToString()))
                {
                    onRefresh();
                }
            });
        }
Example #10
0
 public void DownloadMessageEventHandler(object sender, MessageBusEvent evnt)
 {
     if (evnt is DownloadMessage msg)
     {
         Activity.RunOnUiThread(() => {
             mRecyclerView.setTipViewText(msg.message);
             if (msg.isComplete)
             {
                 mRecyclerView.hideTipView(2200);
             }
         });
     }
 }
        public void initCategoryList(object sender, MessageBusEvent evnt)
        {
            var e = evnt as TagEvent;

            Activity.RunOnUiThread(() =>
            {
                currendTag = e.tag.ToString();
                if (UserVisibleHint)
                {
                    getBookLists(duration, sort, 0, limit, currendTag, Settings.UserChooseSex.GetEnumDescription());
                }
            });
        }
Example #12
0
        void RegisterForEvent(string eventId)
        {
            handler = new MessageBusEventHandler()
            {
                EventAction = (obj, message) =>
                {
                    lastSender = obj;
                    lastEvent  = message;
                },
                EventId = eventId
            };

            target.Register(handler);
        }
Example #13
0
 public void Publish <TEventType>(TEventType ev) where TEventType : IEvent
 {
     try
     {
         string              jsonContent = JsonHelper.ToJson(ev);
         MessageBusEvent     eventItem   = new MessageBusEvent(ObjectHelper.GetClassName(ev), jsonContent);
         IMessageBusProvider mbProvider  = IoC.Container.Resolve <IMessageBusProvider>();
         mbProvider.Send(eventItem);
     }
     catch (Exception ex)
     {
         throw new InvalidOperationException("common.event.handlerTypeForEventIsRequired", ex);
     }
 }
Example #14
0
        /// <summary>
        /// Customs the message event handler.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="evnt">Evnt.</param>
        public void CustomMessageEventHandler(object sender, MessageBusEvent evnt)
        {
            if (evnt is CustomMessageBusEvent)
            {
                //convert to customer event type
                var custEvent = evnt as CustomMessageBusEvent;

                //execute on the UI thread
                BeginInvokeOnMainThread(() => {
                    //post to the output box
                    txtOutput.Text += String.Format("Custom Event Timestamp: {0}", custEvent.TimeStamp) + Environment.NewLine;
                });
            }
        }
        public void initCategoryList(object sender, MessageBusEvent evnt)
        {
            var e = evnt as SelectionEvent;

            Activity.RunOnUiThread(() =>
            {
                mRecyclerView.setRefreshing(true);
                sort       = e.sort.GetEnumDescription();
                type       = e.type.GetEnumDescription();
                distillate = e.distillate.GetEnumDescription();
                start      = 0;
                getBookReviewList(sort, type, distillate, start, limit);
            });
        }
Example #16
0
        /// <summary>
        /// Messages the bus event handler.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="evnt">Evnt.</param>
        public void MessageBusEventHandler(object sender, MessageBusEvent evnt)
        {
            //extrac the data
            var data2 = evnt.Data [0] as String;

            //execute on the UI thread
            BeginInvokeOnMainThread(() => {
                //post to the output box
                var aString = txtOutput.TextStorage.Value;

                aString += data2 + Environment.NewLine;

                txtOutput.TextStorage.SetString(new NSAttributedString(aString));
            });
        }
Example #17
0
        /// <summary>
        /// Customs the message event handler.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="evnt">Evnt.</param>
        public void CustomMessageEventHandler(object sender, MessageBusEvent evnt)
        {
            if (evnt is CustomMessageBusEvent)
            {
                BeginInvokeOnMainThread(() => {
                    //convert to customer event type
                    var custEvent = evnt as CustomMessageBusEvent;

                    var aString = txtOutput.TextStorage.Value;

                    aString += String.Format("Custom Event Timestamp: {0}", custEvent.TimeStamp) + Environment.NewLine;

                    txtOutput.TextStorage.SetString(new NSAttributedString(aString));
                });
            }
        }
Example #18
0
		/// <summary>
		/// Customs the message event handler.
		/// </summary>
		/// <param name="sender">Sender.</param>
		/// <param name="evnt">Evnt.</param>
		public void CustomMessageEventHandler (object sender, MessageBusEvent evnt)
		{
			if (evnt is CustomMessageBusEvent)
			{
				//convert to customer event type
				var custEvent = evnt as CustomMessageBusEvent;

				//run on the ui thread
				RunOnUiThread (() => {
					//post to the output box
					txtOutput.Text += String.Format ("Custom Event Timestamp: {0}", custEvent.TimeStamp) + System.Environment.NewLine;
				});
				
			}


		}
Example #19
0
 public void UserSexChooseFinishedEventHandler(object sender, MessageBusEvent evnt)
 {
     //首次进入APP,选择性别后,获取推荐列表
     BookApi.Instance.getRecommend(Settings.UserChooseSex.GetEnumDescription())
     .Subscribe(recommend => {
         if (recommend != null)
         {
             Activity.RunOnUiThread(() => {
                 List <Recommend.RecommendBooks> list = recommend.books;
                 if (list != null && list.Any())
                 {
                     showRecommendList(list);
                 }
             });
         }
     }, e => showError(), complete);
 }
Example #20
0
        /***************Event*****************/

        public void showDownProgress(object sender, MessageBusEvent e)
        {
            var progress = e as DownloadProgress;

            if (bookId.Equals(progress.bookId))
            {
                RunOnUiThread(() => {
                    if (isVisible(mLlBookReadBottom))
                    { // 如果工具栏显示,则进度条也显示
                        visible(mTvDownloadProgress);
                        // 如果之前缓存过,就给提示
                        mTvDownloadProgress.Text = (progress.message);
                    }
                    else
                    {
                        gone(mTvDownloadProgress);
                    }
                });
            }
        }
Example #21
0
        public void downloadMessage(object sender, MessageBusEvent e)
        {
            DownloadMessage msg = e as DownloadMessage;

            if (isVisible(mLlBookReadBottom))
            { // 如果工具栏显示,则进度条也显示
                if (bookId.Equals(msg.bookId))
                {
                    RunOnUiThread(() => {
                        visible(mTvDownloadProgress);
                        mTvDownloadProgress.Text = (msg.message);
                        if (msg.isComplete)
                        {
                            mTvDownloadProgress.PostDelayed(() =>
                            {
                                gone(mTvDownloadProgress);
                            }, 2500);
                        }
                    });
                }
            }
        }
Example #22
0
        private void addToDownloadQueue(object sender, MessageBusEvent evnt)
        {
            if (evnt is DownloadQueue queue)
            {
                if (!TextUtils.IsEmpty(queue.bookId))
                {
                    bool exists = false;
                    // 判断当前书籍缓存任务是否存在
                    for (int i = 0; i < downloadQueues.Count(); i++)
                    {
                        if (downloadQueues[i].bookId.Equals(queue.bookId))
                        {
                            LogUtils.e("addToDownloadQueue:exists");
                            exists = true;
                            break;
                        }
                    }
                    if (exists)
                    {
                        Post(new DownloadMessage(queue.bookId, "当前缓存任务已存在", false));
                        return;
                    }

                    // 添加到下载队列
                    downloadQueues.Add(queue);
                    LogUtils.e("addToDownloadQueue:" + queue.bookId);
                    Post(new DownloadMessage(queue.bookId, "成功加入缓存队列", false));
                }
                // 从队列顺序取出第一条下载
                if (downloadQueues.Count() > 0 && !isBusy)
                {
                    isBusy = true;
                    downloadBook(downloadQueues[0]);
                }
            }
        }
Example #23
0
 private void SortOutletListEventHandler(object sender, MessageBusEvent e)
 {
     SortOutletList();
 }
Example #24
0
 public void CreateEventContent(string key, string content)
 {
     this.Content = new MessageBusEvent(key, content);
     this.AddEvent(new Event.MessageBus.OnMessageBusCreated(key, content));
 }
Example #25
0
 public void Send(MessageBusEvent eventItem)
 {
     string url = string.Format("{0}/{1}", Configuration.Current.MessageBus.BaseUri, "/api/busevents");
     /// Will handle response later
     IResponseData <CreateMessageBusEventResponse> response = this.connector.Post <MessageBusEvent, CreateMessageBusEventResponse>(url, eventItem);
 }
Example #26
0
 void ResetLastEvent()
 {
     lastEvent  = null;
     lastSender = null;
 }
Example #27
0
 public CreateMessageBusEventResponse Create(MessageBusEvent ev)
 {
     return(null);
     //this.ValidateCreateMessageBusEventRequest(ev);
     //using (IUnitOfWork uow = Unit)
 }
Example #28
0
 private void OutletListItemViewAppearedEventHandler(object sender, MessageBusEvent e)
 {
     HideProgressDialog();
 }