Exemplo n.º 1
0
        public bool Ask(RoutedEventArgs e, IQuestionPresenter p)
        {
            var source        = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement  = source.Property <ITerm>("DropedPlacement");
            var agent         = (IAgent)BindableAgents[source.Property <int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property <ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd   = newPlacement.End;

            if (pointOutBlock.Start == newStart && pointOutBlock.End == newEnd)
            {
                return(false);
            }

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShift");
            p.Editable    = true;

            pointOutBlock.SaftyInvoke <Term>(x =>
            {
                p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShiftText"),
                                       agent.Profile.Name, x.Start, x.Text);
                p.Comments = x.Tag;
            });
            return(true);
        }
Exemplo n.º 2
0
        public void CompleteConfirm(IQuestionPresenter q)
        {
            if (q.Answer == Answer.Cancel)
            {
                return;
            }

            SubmitChanges(q.Answer != Answer.Yes);
        }
Exemplo n.º 3
0
 public virtual void CompleteConfirm(IQuestionPresenter q)
 {
     if (q.Answer == Answer.Yes)
     {
         Save();
     }
     if (q.Answer == Answer.No)
     {
         Cancel();
     }
 }
Exemplo n.º 4
0
        public object BeforeDelete(IQuestionPresenter question)
        {
            if (CurrentEditingObject.IsNew)
            {
                return(true);                            // 因为是new object 所以无需做删除提示
            }
            question.DisplayName         = this.GetType().Name;
            question.SavingConfirmModeOn = false;
            question.Text = string.Format("Do you want to delete {0}", CurrentEntity);

            return(question);
        }
Exemplo n.º 5
0
        public bool AskDeleteShift(IQuestionPresenter p)
        {
            if (SelectedTerm == null)
            {
                return(false);
            }

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShift");
            p.Editable    = false;
            p.Text        = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShiftText"),
                                          SelectedAgent.Profile.Name, SelectedTerm.Start, SelectedTerm.Text);
            return(true);
        }
Exemplo n.º 6
0
        public bool BeforeAssignSeat(IQuestionPresenter p)
        {
            var shift = SelectedTerm;

            if (shift == null)
            {
                return(false);
            }
            var selectedSeat = _seatDispatcherPresenter.Property <SeatBox>("SelectedSeat");

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeat");
            p.Editable    = false;
            p.Text        = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeatText"),
                                          selectedSeat.Seat.Area.Name, selectedSeat.Seat.Number, SelectedAgent.Profile.Name, shift.Start, shift.Text);
            return(true);
        }
Exemplo n.º 7
0
 public void BeforeCancelSeat(IQuestionPresenter p)
 {
     p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskCancelSeat");
     p.Editable    = false;
     p.Text        = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskCancelSeatText"), GetWatchPoint());
 }
Exemplo n.º 8
0
 public bool Callback(RoutedEventArgs e, IQuestionPresenter p)
 {
     _alterComments = p.Answer == Answer.Yes ? p.Comments : string.Empty;
     return(p.Answer == Answer.Yes);
 }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id = Intent.GetIntExtra("id", 0);
            questionPresenter = new QuestionPresenter(this);
            handler           = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            swipeRefreshLayout.SetOnRefreshListener(this);

            txtTitle     = FindViewById <TextView>(Resource.Id.txtTitle);
            imgIconName  = FindViewById <ImageView>(Resource.Id.imgIconName);
            txtUserName  = FindViewById <TextView>(Resource.Id.txtUserName);
            txtScore     = FindViewById <TextView>(Resource.Id.txtScore);
            txtDateAdded = FindViewById <TextView>(Resource.Id.txtDateAdded);
            txtGold      = FindViewById <TextView>(Resource.Id.txtGold);
            txtDealFlag  = FindViewById <TextView>(Resource.Id.txtDealFlag);
            txtTag       = FindViewById <TextView>(Resource.Id.txtTag);
            this.txtDealFlag.Selected = true;
            txtBody = FindViewById <WebView>(Resource.Id.txtBody);
            txtBody.Settings.JavaScriptEnabled        = true;
            txtBody.Settings.DomStorageEnabled        = true;
            txtBody.Settings.LoadsImagesAutomatically = true;
            txtBody.Settings.DefaultTextEncodingName  = "utf-8";
            txtBody.SetWebViewClient(BodyWebViewClient.With(this));
            txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
            txtBody.Settings.SetSupportZoom(false);
            txtBody.Settings.BuiltInZoomControls = false;
            txtBody.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            var jsInterface = new WebViewJSInterface(this);

            txtBody.AddJavascriptInterface(jsInterface, "openlistner");
            jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e)
            {
                PhotoActivity.Start(this, e.Result.Split(','), e.Index);
            };
            txtDigg          = FindViewById <TextView>(Resource.Id.txtDigg);
            txtRead          = FindViewById <TextView>(Resource.Id.txtRead);
            txtBookmark      = FindViewById <TextView>(Resource.Id.txtBookmark);
            txtComments      = FindViewById <TextView>(Resource.Id.txtComments);
            txtComments.Text = Resources.GetString(Resource.String.answer);

            (txtComments.Parent as FrameLayout).Click += delegate
            {
                if (question != null && question.Qid > 0)
                {
                    QuestionAnswersActivity.Start(this, question.Qid);
                }
            };
            (txtBookmark.Parent as FrameLayout).Click += delegate
            {
                if (question != null && question.Qid > 0)
                {
                    var linkurl = "https://q.cnblogs.com/q/" + question.Qid + "/";
                    var title   = question.Title + "_²©ÎÊ_²©¿ÍÔ°";
                    BookmarkAddActivity.Start(this, linkurl, title, true);
                }
            };
            swipeRefreshLayout.Post(async() =>
            {
                await questionPresenter.GetClientQuestion(Id);
            });
            shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this);
        }
Exemplo n.º 10
0
        public void CompleteConfirm(IQuestionPresenter q)
        {
            if (q.Answer == Answer.Cancel) return;

            SubmitChanges(q.Answer != Answer.Yes);
        }
 public void BeforeCancelSeat(IQuestionPresenter p)
 {
     p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskCancelSeat");
     p.Editable = false;
     p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskCancelSeatText"), GetWatchPoint());
 }
 public bool BeforeAssignSeat(IQuestionPresenter p)
 {
     var shift = SelectedTerm;
     if (shift == null) return false;
     var selectedSeat = _seatDispatcherPresenter.Property<SeatBox>("SelectedSeat");
     p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeat");
     p.Editable = false;
     p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeatText"),
       selectedSeat.Seat.Area.Name, selectedSeat.Seat.Number, SelectedAgent.Profile.Name, shift.Start, shift.Text);
     return true;
 }
 public bool Callback(RoutedEventArgs e, IQuestionPresenter p)
 {
     _alterComments = p.Answer == Answer.Yes ? p.Comments : string.Empty;
     return p.Answer == Answer.Yes;
 }
        public bool Ask(RoutedEventArgs e, IQuestionPresenter p)
        {
            var source = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement = source.Property<ITerm>("DropedPlacement");
            var agent = (IAgent)BindableAgents[source.Property<int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property<ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd = newPlacement.End;

            if (pointOutBlock.Start == newStart && pointOutBlock.End == newEnd)
                return false;

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShift");
            p.Editable = true;

            pointOutBlock.SaftyInvoke<Term>(x =>
                                                {
                                                    p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShiftText"),
                                                    agent.Profile.Name, x.Start, x.Text);
                                                    p.Comments = x.Tag;
                                                });
            return true;
        }
        public bool AskDeleteShift(IQuestionPresenter p)
        {
            if (SelectedTerm == null) return false;

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShift");
            p.Editable = false;
            p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShiftText"),
                SelectedAgent.Profile.Name, SelectedTerm.Start, SelectedTerm.Text);
            return true;
        }
Exemplo n.º 16
0
 public virtual bool DeleteCallback(IQuestionPresenter p)
 {
     return(p.Answer == Answer.Yes);
 }