Beispiel #1
0
    public static void Main()
    {
        var tv = new TitleView();

        tv.ShowFront();

        var nicC = new NicController();

        nicC.Run();

        var ev = new EndView();

        ev.ShowEnd();
    }
Beispiel #2
0
 private void BestätigenButton_Click(object sender, RoutedEventArgs e)
 {
     if (ViewEnd == true)
     {
         DataContext          = new EndView();
         ViewZurück           = true;
         ViewFertig           = true;
         ViewEnd              = false;
         Storno.IsEnabled     = false;
         Bezahlen.IsEnabled   = false;
         Waage.IsEnabled      = false;
         Zurück.IsEnabled     = true;
         Bestätigen.IsEnabled = true;
     }
     else if (ViewFertig == true)
     {
         DataContext                     = new HauptView();
         ViewEnd                         = false;
         ViewZurück                      = false;
         ViewFertig                      = false;
         Storno.IsEnabled                = true;
         Bezahlen.IsEnabled              = true;
         Waage.IsEnabled                 = true;
         Zurück.IsEnabled                = false;
         Bestätigen.IsEnabled            = false;
         GlobaleVariablen.AktuellerPreis = 0;
         GlobaleVariablen.Gewicht        = 0;
         GlobaleVariablen.GewichtString  = "";
         GlobaleVariablen.tmp            = 1;
         GlobaleVariablen.tmp2           = 0;
         GlobaleVariablen.tmp3           = "";
         GlobaleVariablen.tmp4           = 0;
         GlobaleVariablen.Gegeben        = 0;
         GlobaleVariablen.Rückgeld       = 0;
         GlobaleVariablen.Einkaufsliste.Clear();
         GlobaleVariablen.EinkaufslistePreis.Clear();
         GlobaleVariablen.Währung.Clear();
     }
     else if (InWaage == true)
     {
         DataContext          = new HauptView();
         InWaage              = false;
         Storno.IsEnabled     = true;
         Bezahlen.IsEnabled   = true;
         Waage.IsEnabled      = true;
         Zurück.IsEnabled     = false;
         Bestätigen.IsEnabled = false;
     }
 }
        public override Widget build(BuildContext context)
        {
            var    collectionIds = this.widget.viewModel.collectionIds;
            Widget content;

            if (this.widget.viewModel.collectionLoading && collectionIds.isEmpty())
            {
                content = new GlobalLoading(
                    color: CColors.Transparent,
                    loadingColor: LoadingColor.white
                    );
            }
            else if (collectionIds.Count <= 0)
            {
                content = new CustomScrollbar(
                    new CustomScrollView(
                        new PageStorageKey <string>("合辑"),
                        slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(height: 16)
                        ),
                    new SliverFillRemaining(
                        child: new BlankView(
                            "暂无合辑",
                            "image/default-article",
                            true,
                            () => {
                        this.widget.actionModel.startFetchCollection();
                        this.widget.actionModel.fetchCollection(arg: firstPageNumber);
                    },
                            new BoxDecoration(
                                color: CColors.White,
                                borderRadius: BorderRadius.only(12, 12)
                                )
                            )
                        )
                }
                        )
                    );
            }
            else
            {
                var    enablePullUp = this.widget.viewModel.collectionHasMore;
                Widget endView;
                if (!enablePullUp)
                {
                    endView = new EndView();
                }
                else
                {
                    endView = new Visibility(
                        visible: this._isLoading,
                        child: new Container(
                            padding: EdgeInsets.symmetric(16),
                            child: new CustomActivityIndicator(
                                loadingColor: LoadingColor.white,
                                animating: this._isLoading ? AnimatingType.repeat : AnimatingType.reset
                                )
                            )
                        );
                }

                content = new NotificationListener <ScrollNotification>(
                    onNotification: this._onNotification,
                    child: new CustomScrollbar(
                        new CustomScrollView(
                            new PageStorageKey <string>("合辑"),
                            physics: new AlwaysScrollableScrollPhysics(),
                            slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(
                            child: new Column(
                                children: new List <Widget> {
                        new SizedBox(height: 16),
                        new LeaderBoardUpdateTip(),
                        new CustomDivider(height: 1, color: CColors.Separator2)
                    }
                                )
                            )
                        ),
                    new SliverFixedExtentList(
                        del: new SliverChildBuilderDelegate(
                            builder: this._buildCollectionCard,
                            childCount: collectionIds.Count
                            ),
                        itemExtent: 112
                        ),
                    new SliverToBoxAdapter(
                        child: endView
                        )
                }
                            )
                        )
                    );
            }

            return(new Container(
                       child: content
                       ));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            StartLabel.Text = Resources.Start;
            EndLabel.Text   = Resources.End;
            TitleLabel.Text = Resources.StartAndStopTime;
            SetEndButton.SetTitle(Resources.Stop, UIControlState.Normal);
            SaveButton.SetTitle(Resources.Save, UIControlState.Normal);

            prepareViews();

            // Actions
            SaveButton.Rx()
            .BindAction(ViewModel.Save)
            .DisposedBy(disposeBag);

            CloseButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(disposeBag);

            // Start and stop date/time
            ViewModel.StartTimeString
            .Subscribe(StartTimeLabel.Rx().Text())
            .DisposedBy(disposeBag);

            ViewModel.StartDateString
            .Subscribe(StartDateLabel.Rx().Text())
            .DisposedBy(disposeBag);

            ViewModel.StopTimeString
            .Subscribe(EndTimeLabel.Rx().Text())
            .DisposedBy(disposeBag);

            ViewModel.StopDateString
            .Subscribe(EndDateLabel.Rx().Text())
            .DisposedBy(disposeBag);

            // Editing start and end time
            StartView.Rx()
            .BindAction(ViewModel.EditStartTime)
            .DisposedBy(disposeBag);

            EndView.Rx()
            .BindAction(ViewModel.EditStopTime)
            .DisposedBy(disposeBag);

            SetEndButton.Rx()
            .BindAction(ViewModel.EditStopTime)
            .DisposedBy(disposeBag);

            // Visibility
            ViewModel.IsRunning
            .Subscribe(running =>
            {
                SetEndButton.Hidden = !running;
                EndTimeLabel.Hidden = running;
                EndDateLabel.Hidden = running;
            })
            .DisposedBy(disposeBag);

            // Stard and end colors
            ViewModel.IsEditingStartTime
            .Select(editingStartTime => editingStartTime
                    ? Color.EditDuration.EditedTime.ToNativeColor()
                    : Color.EditDuration.NotEditedTime.ToNativeColor()
                    )
            .Subscribe(color =>
            {
                StartTimeLabel.TextColor = color;
                StartDateLabel.TextColor = color;
            })
            .DisposedBy(disposeBag);

            ViewModel.IsEditingStopTime
            .Select(editingStartTime => editingStartTime
                    ? Color.EditDuration.EditedTime.ToNativeColor()
                    : Color.EditDuration.NotEditedTime.ToNativeColor()
                    )
            .Subscribe(color =>
            {
                EndTimeLabel.TextColor = color;
                EndDateLabel.TextColor = color;
            })
            .DisposedBy(disposeBag);

            // Date picker
            ViewModel.IsEditingTime
            .Subscribe(DatePickerContainer.Rx().AnimatedIsVisible())
            .DisposedBy(disposeBag);

            DatePicker.Rx().Date()
            .Subscribe(ViewModel.ChangeActiveTime.Inputs)
            .DisposedBy(disposeBag);

            var startTime = ViewModel.IsEditingStartTime
                            .Where(CommonFunctions.Identity)
                            .SelectMany(_ => ViewModel.StartTime);

            var stopTime = ViewModel.IsEditingStopTime
                           .Where(CommonFunctions.Identity)
                           .SelectMany(_ => ViewModel.StopTime);

            Observable.Merge(startTime, stopTime)
            .Subscribe(v => DatePicker.SetDate(v.ToNSDate(), false))
            .DisposedBy(disposeBag);

            ViewModel.IsEditingStartTime
            .Where(CommonFunctions.Identity)
            .SelectMany(_ => ViewModel.StartTime)
            .Subscribe(v => DatePicker.SetDate(v.ToNSDate(), false))
            .DisposedBy(disposeBag);

            ViewModel.MinimumDateTime
            .Subscribe(v => DatePicker.MinimumDate = v.ToNSDate())
            .DisposedBy(disposeBag);

            ViewModel.MaximumDateTime
            .Subscribe(v => DatePicker.MaximumDate = v.ToNSDate())
            .DisposedBy(disposeBag);

            ViewModel.TimeFormat
            .Subscribe(v => DatePicker.Locale = v.IsTwentyFourHoursFormat ? new NSLocale("en_GB") : new NSLocale("en_US"))
            .DisposedBy(disposeBag);

            // DurationInput

            ViewModel.IsEditingTime
            .Invert()
            .Subscribe(DurationInput.Rx().Enabled())
            .DisposedBy(disposeBag);

            ViewModel.Duration
            .Subscribe(v => DurationInput.Duration = v)
            .DisposedBy(disposeBag);

            ViewModel.DurationString
            .Subscribe(v => DurationInput.FormattedDuration = v)
            .DisposedBy(disposeBag);

            DurationInput.Rx().Duration()
            .Subscribe(ViewModel.ChangeDuration.Inputs)
            .DisposedBy(disposeBag);

            // The wheel

            ViewModel.IsEditingTime
            .Invert()
            .Subscribe(v => WheelView.UserInteractionEnabled = v)
            .DisposedBy(disposeBag);

            ViewModel.MinimumStartTime
            .Subscribe(v => WheelView.MinimumStartTime = v)
            .DisposedBy(disposeBag);

            ViewModel.MaximumStartTime
            .Subscribe(v => WheelView.MaximumStartTime = v)
            .DisposedBy(disposeBag);

            ViewModel.MinimumStopTime
            .Subscribe(v => WheelView.MinimumEndTime = v)
            .DisposedBy(disposeBag);

            ViewModel.MaximumStopTime
            .Subscribe(v => WheelView.MaximumEndTime = v)
            .DisposedBy(disposeBag);

            ViewModel.StartTime
            .Subscribe(v => WheelView.StartTime = v)
            .DisposedBy(disposeBag);

            ViewModel.StopTime
            .Subscribe(v => WheelView.EndTime = v)
            .DisposedBy(disposeBag);

            ViewModel.IsRunning
            .Subscribe(v => WheelView.IsRunning = v)
            .DisposedBy(disposeBag);

            WheelView.Rx().StartTime()
            .Subscribe(ViewModel.ChangeStartTime.Inputs)
            .DisposedBy(disposeBag);

            WheelView.Rx().EndTime()
            .Subscribe(ViewModel.ChangeStopTime.Inputs)
            .DisposedBy(disposeBag);

            // Interaction observables for analytics

            var editingStart = Observable.Merge(
                StartView.Rx().Tap().SelectValue(true),
                EndView.Rx().Tap().SelectValue(false)
                );

            var dateComponentChanged = DatePicker.Rx().DateComponent()
                                       .WithLatestFrom(editingStart,
                                                       (_, isStart) => isStart ? EditTimeSource.BarrelStartDate : EditTimeSource.BarrelStopDate
                                                       );

            var timeComponentChanged = DatePicker.Rx().TimeComponent()
                                       .WithLatestFrom(editingStart,
                                                       (_, isStart) => isStart ? EditTimeSource.BarrelStartTime : EditTimeSource.BarrelStopTime
                                                       );

            var durationInputChanged = DurationInput.Rx().Duration()
                                       .SelectValue(EditTimeSource.NumpadDuration);

            Observable.Merge(
                dateComponentChanged,
                timeComponentChanged,
                WheelView.TimeEdited,
                durationInputChanged
                )
            .Distinct()
            .Subscribe(ViewModel.TimeEditedWithSource)
            .DisposedBy(disposeBag);
        }
Beispiel #5
0
        void ReleaseDesignerOutlets()
        {
            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (DatePicker != null)
            {
                DatePicker.Dispose();
                DatePicker = null;
            }

            if (DatePickerContainer != null)
            {
                DatePickerContainer.Dispose();
                DatePickerContainer = null;
            }

            if (DurationInput != null)
            {
                DurationInput.Dispose();
                DurationInput = null;
            }

            if (EndDateLabel != null)
            {
                EndDateLabel.Dispose();
                EndDateLabel = null;
            }

            if (EndLabel != null)
            {
                EndLabel.Dispose();
                EndLabel = null;
            }

            if (EndTimeLabel != null)
            {
                EndTimeLabel.Dispose();
                EndTimeLabel = null;
            }

            if (EndView != null)
            {
                EndView.Dispose();
                EndView = null;
            }

            if (SaveButton != null)
            {
                SaveButton.Dispose();
                SaveButton = null;
            }

            if (SetEndButton != null)
            {
                SetEndButton.Dispose();
                SetEndButton = null;
            }

            if (StackView != null)
            {
                StackView.Dispose();
                StackView = null;
            }

            if (StartDateLabel != null)
            {
                StartDateLabel.Dispose();
                StartDateLabel = null;
            }

            if (StartLabel != null)
            {
                StartLabel.Dispose();
                StartLabel = null;
            }

            if (StartTimeLabel != null)
            {
                StartTimeLabel.Dispose();
                StartTimeLabel = null;
            }

            if (StartView != null)
            {
                StartView.Dispose();
                StartView = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (WheelView != null)
            {
                WheelView.Dispose();
                WheelView = null;
            }

            if (startIcon != null)
            {
                startIcon.Dispose();
                startIcon = null;
            }

            if (endIcon != null)
            {
                endIcon.Dispose();
                endIcon = null;
            }
        }
Beispiel #6
0
 public EndScene()
 {
     view = new EndView();
 }
Beispiel #7
0
 public void Visit(EndView instruction)
 {
 }
        public override Widget build(BuildContext context)
        {
            var    bloggerIds = this.widget.viewModel.bloggerIds;
            Widget content;

            if (this.widget.viewModel.bloggerLoading && bloggerIds.isEmpty())
            {
                content = new GlobalLoading(
                    color: CColors.Transparent,
                    loadingColor: LoadingColor.white
                    );
            }
            else if (bloggerIds.Count <= 0)
            {
                content = new CustomScrollbar(
                    new CustomScrollView(
                        new PageStorageKey <string>("博主"),
                        physics: new AlwaysScrollableScrollPhysics(),
                        slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(height: 16)
                        ),
                    new SliverFillRemaining(
                        child: new BlankView(
                            "暂无博主",
                            "image/default-following",
                            true,
                            () => {
                        this.widget.actionModel.startFetchBlogger();
                        this.widget.actionModel.fetchBlogger(arg: firstPageNumber);
                    },
                            new BoxDecoration(
                                color: CColors.White,
                                borderRadius: BorderRadius.only(12, 12)
                                )
                            )
                        )
                }
                        )
                    );
            }
            else
            {
                var    enablePullUp = this.widget.viewModel.bloggerHasMore;
                Widget endView;
                if (!enablePullUp)
                {
                    endView = new EndView();
                }
                else
                {
                    endView = new Visibility(
                        visible: this._isLoading,
                        child: new Container(
                            color: CColors.Background,
                            padding: EdgeInsets.symmetric(16),
                            child: new CustomActivityIndicator(
                                loadingColor: LoadingColor.black,
                                animating: this._isLoading ? AnimatingType.repeat : AnimatingType.reset
                                )
                            )
                        );
                }
                content = new NotificationListener <ScrollNotification>(
                    onNotification: this._onNotification,
                    child: new CustomScrollbar(
                        new CustomScrollView(
                            new PageStorageKey <string>("博主"),
                            physics: new AlwaysScrollableScrollPhysics(),
                            slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(
                            child: new Column(
                                children: new List <Widget> {
                        new LeaderBoardBloggerHeader(
                            bloggerIds: bloggerIds,
                            userDict: this.widget.viewModel.userDict,
                            userId => this.widget.actionModel.pushToUserDetail(obj: userId)
                            ),
                        new LeaderBoardUpdateTip(),
                        new CustomDivider(height: 1, color: CColors.Separator2)
                    }
                                )
                            )
                        ),
                    new SliverList(
                        del: new SliverChildBuilderDelegate(
                            builder: this._buildBloggerCard,
                            childCount: bloggerIds.Count
                            )
                        ),
                    new SliverToBoxAdapter(
                        child: endView
                        )
                }
                            )
                        )
                    );
            }
            return(new Container(
                       child: content
                       ));
        }
 public void Visit(EndView instruction)
 {
     _instructions.Add(instruction);
 }
Beispiel #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            startTimeChangingSubscription = ViewModel.StartTimeChanging.Subscribe(startTimeChanging);

            prepareViews();

            var durationCombiner              = new DurationValueCombiner();
            var timeCombiner                  = new DateTimeOffsetTimeFormatValueCombiner(TimeZoneInfo.Local);
            var dateCombiner                  = new DateTimeOffsetDateFormatValueCombiner(TimeZoneInfo.Local, useLongFormat: false);
            var timeFormatToLocaleConverter   = new TimeFormatToLocaleValueConverter();
            var inverseBoolConverter          = new BoolToConstantValueConverter <bool>(false, true);
            var editedTimeLabelColorConverter = new BoolToConstantValueConverter <UIColor>(
                Color.EditDuration.EditedTime.ToNativeColor(),
                Color.EditDuration.NotEditedTime.ToNativeColor());

            var bindingSet = this.CreateBindingSet <EditDurationViewController, EditDurationViewModel>();

            //Commands
            bindingSet.Bind(SaveButton).To(vm => vm.SaveCommand);
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);

            //Start and stop date/time
            bindingSet.Bind(StartTimeLabel)
            .ByCombining(timeCombiner,
                         vm => vm.StartTime,
                         vm => vm.TimeFormat);

            bindingSet.Bind(StartDateLabel)
            .ByCombining(dateCombiner,
                         vm => vm.StartTime,
                         vm => vm.DateFormat);

            bindingSet.Bind(EndTimeLabel)
            .ByCombining(timeCombiner,
                         vm => vm.StopTime,
                         vm => vm.TimeFormat);

            bindingSet.Bind(EndDateLabel)
            .ByCombining(dateCombiner,
                         vm => vm.StopTime,
                         vm => vm.DateFormat);

            //Editing start and end time
            bindingSet.Bind(StartView)
            .For(v => v.BindTap())
            .To(vm => vm.EditStartTimeCommand);

            bindingSet.Bind(EndView)
            .For(v => v.BindTap())
            .To(vm => vm.EditStopTimeCommand);

            bindingSet.Bind(SetEndButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsRunning)
            .WithConversion(inverseBoolConverter);

            bindingSet.Bind(SetEndButton)
            .To(vm => vm.EditStopTimeCommand);

            //Visibility
            bindingSet.Bind(EndTimeLabel)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsRunning);

            bindingSet.Bind(EndDateLabel)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsRunning);

            //Stard and end colors
            bindingSet.Bind(StartTimeLabel)
            .For(v => v.TextColor)
            .To(vm => vm.IsEditingStartTime)
            .WithConversion(editedTimeLabelColorConverter);

            bindingSet.Bind(StartDateLabel)
            .For(v => v.TextColor)
            .To(vm => vm.IsEditingStartTime)
            .WithConversion(editedTimeLabelColorConverter);

            bindingSet.Bind(EndTimeLabel)
            .For(v => v.TextColor)
            .To(vm => vm.IsEditingStopTime)
            .WithConversion(editedTimeLabelColorConverter);

            bindingSet.Bind(EndDateLabel)
            .For(v => v.TextColor)
            .To(vm => vm.IsEditingStopTime)
            .WithConversion(editedTimeLabelColorConverter);

            //Date picker
            bindingSet.Bind(DatePickerContainer)
            .For(v => v.BindAnimatedVisibility())
            .To(vm => vm.IsEditingTime);

            bindingSet.Bind(DatePicker)
            .For(v => v.BindDateTimeOffset())
            .To(vm => vm.EditedTime);

            bindingSet.Bind(DatePicker)
            .For(v => v.MaximumDate)
            .To(vm => vm.MaximumDateTime);

            bindingSet.Bind(DatePicker)
            .For(v => v.MinimumDate)
            .To(vm => vm.MinimumDateTime);

            bindingSet.Bind(DatePicker)
            .For(v => v.Locale)
            .To(vm => vm.TimeFormat)
            .WithConversion(timeFormatToLocaleConverter);

            //The wheel
            bindingSet.Bind(DurationInput)
            .For(v => v.UserInteractionEnabled)
            .To(vm => vm.IsEditingTime)
            .WithConversion(inverseBoolConverter);

            bindingSet.Bind(DurationInput)
            .For(v => v.Duration)
            .To(vm => vm.Duration);

            bindingSet.Bind(DurationInput)
            .For(v => v.FormattedDuration)
            .ByCombining(durationCombiner,
                         vm => vm.Duration,
                         vm => vm.DurationFormat);

            bindingSet.Bind(WheelView)
            .For(v => v.UserInteractionEnabled)
            .To(vm => vm.IsEditingTime)
            .WithConversion(inverseBoolConverter);

            bindingSet.Bind(WheelView)
            .For(v => v.MaximumStartTime)
            .To(vm => vm.MaximumStartTime);

            bindingSet.Bind(WheelView)
            .For(v => v.MinimumStartTime)
            .To(vm => vm.MinimumStartTime);

            bindingSet.Bind(WheelView)
            .For(v => v.MaximumEndTime)
            .To(vm => vm.MaximumStopTime);

            bindingSet.Bind(WheelView)
            .For(v => v.MinimumEndTime)
            .To(vm => vm.MinimumStopTime);

            bindingSet.Bind(WheelView)
            .For(v => v.StartTime)
            .To(vm => vm.StartTime);

            bindingSet.Bind(WheelView)
            .For(v => v.EndTime)
            .To(vm => vm.StopTime);

            bindingSet.Bind(WheelView)
            .For(v => v.IsRunning)
            .To(vm => vm.IsRunning);

            bindingSet.Apply();

            // Interaction observables for analytics

            var editingStart = Observable.Merge(
                StartView.Rx().Tap().Select(true),
                EndView.Rx().Tap().Select(false)
                );

            var dateComponentChanged = DatePicker.Rx().DateComponent()
                                       .WithLatestFrom(editingStart,
                                                       (_, isStart) => isStart ? EditTimeSource.BarrelStartDate : EditTimeSource.BarrelStopDate
                                                       );

            var timeComponentChanged = DatePicker.Rx().TimeComponent()
                                       .WithLatestFrom(editingStart,
                                                       (_, isStart) => isStart ? EditTimeSource.BarrelStartTime : EditTimeSource.BarrelStopTime
                                                       );

            var durationInputChanged = Observable
                                       .FromEventPattern(e => DurationInput.DurationChanged += e, e => DurationInput.DurationChanged -= e)
                                       .Select(EditTimeSource.NumpadDuration);

            Observable.Merge(
                dateComponentChanged,
                timeComponentChanged,
                WheelView.TimeEdited,
                durationInputChanged
                )
            .Distinct()
            .Subscribe(ViewModel.TimeEditedWithSource)
            .DisposedBy(disposeBag);
        }