示例#1
0
        public NewTimePeriodView(StartView start)
        {
            startView = start;
            InitializeComponent();

            createTimePerioddataGridView.Rows[0].Cells[0].Value = "Day 1";
        }
示例#2
0
 private void ShowStartScreen()
 {
     _startView          = new StartView();
     _startView.Clicked += new EventHandler(_startView_Clicked);
     _page.LayoutRoot.Children.Add(_startView);
     _gameModel.SetState(new StartState(_gameModel));
 }
        public void executeMenuChoice()
        {
            //StartView handles the main menu
            StartView startView = new StartView();

            startView.showStartMenu();

            StartView.MenuChoice menuChoice = startView.GetMenuChoice();
            if (menuChoice == StartView.MenuChoice.AddMember)
            {
                AddMemberController addMemberController = new AddMemberController();
            }
            if (menuChoice == StartView.MenuChoice.VerboseListMembers ||
                menuChoice == StartView.MenuChoice.CompactListMembers)
            {
                //Handles both types of lists, depending on user choice
                ListController listController = new ListController(menuChoice);
            }
            if (menuChoice == StartView.MenuChoice.AddBoat)
            {
                AddBoatController addBoatController = new AddBoatController();
            }
            //Takes user back to main menu
            if (menuChoice == StartView.MenuChoice.None)
            {
                startView = new StartView();
                executeMenuChoice();
            }
        }
示例#4
0
        public void ChangeCurrentView(CurrentViewTypes viewType)
        {
            switch (viewType)
            {
            case CurrentViewTypes.Start:
                IStartViewModel sVM = new StartViewModel(this);
                StartView       sV  = new StartView();
                //привязка
                sV.DataContext = sVM;
                //отображение
                MainWindowViewModel.CurrentView = sV;
                break;

            case CurrentViewTypes.Edit:
                IEditViewModel eVM = new EditViewModel(this);
                EditView       eV  = new EditView();
                //привязка
                eV.DataContext = eVM;
                //отображение
                MainWindowViewModel.CurrentView = eV;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(viewType));
            }
        }
 public AppViewsContainer(LoginView loginScreen, RegisterView registerScreen, StartView startScreen, BioDataView bioScreen, ChooseGoalView chooseGoalScreen)
 {
     this.loginScreen      = loginScreen;
     this.registerScreen   = registerScreen;
     this.startScreen      = startScreen;
     this.bioScreen        = bioScreen;
     this.chooseGoalScreen = chooseGoalScreen;
 }
示例#6
0
        static void Main(string[] args)
        {
            WebShopAssignment.Helpers.Seeder.SeedUsers();
            WebShopAssignment.Helpers.Seeder.SeedBookTitles();
            WebShopAssignment.Helpers.Seeder.SeedCategories();

            StartView.StartMenu();
        }
 public SampleMainViewModel()
     : base(new MockMainView {
     ContentViewState = ContentViewState.StartViewVisible
 },
            new MockShellService(), new MockFileService())
 {
     StartView = new StartView();
 }
示例#8
0
        IEnumerator LoadStartUI()
        {
            var stratView = new StartView()
            {
                HideNode = HideLayer.Node
            };

            yield return(MidLayer.PushView(stratView));
        }
 public MainWindow()
 {
     //Utworzenie nowego obiektu widoku
     startView = new StartView();
     InitializeComponent();
     //Przypisanie zawartości okna
     DataContext = startView;
     //Zmiana zawartości okna na widok magazynu po wybraniu przycisku Start
     this.startView.StartApp += new EventHandler(startAppView);
 }
示例#10
0
        public App()
        {
            InitializeComponent();

            var boot = new AppBootstrapper();

            boot.Initialize();

            MainPage = new StartView();
        }
示例#11
0
文件: Program.cs 项目: hoseto1/fmiedd
        static void Main(string[] args)
        {
            Console.Title           = "C-Mail 2014 © Iva Tsoneva";
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.Clear();

            StartView sview = new StartView();

            Console.ReadKey(true);
        }
示例#12
0
        public Sokoban()
        {
            _parser = new SokobanParser();

            _startView    = new StartView();
            _gameView     = new GameView();
            _finishedView = new FinishedView();
            _losedView    = new LosedView();

            State = GameStates.Menu;
        }
示例#13
0
 private void InitializeComponent()
 {
     this.WhenActivated(disposables => {
         _startView = this.FindControl <StartView>("StartView");
         var mainWindowViewModel  = DataContext as MainWindowViewModel;
         var gitFacade            = IoC.Container.Resolve <IGitFacade>();
         var startViewModel       = new StartViewModel(mainWindowViewModel);
         startViewModel.GitFacade = gitFacade;
         _startView.DataContext   = startViewModel;
     });
     AvaloniaXamlLoader.Load(this);
 }
示例#14
0
        private void ChangeWindow()
        {
            var           window        = Application.Current.Windows.OfType <Window>().SingleOrDefault(w => w.IsActive);
            StartView     startView     = new StartView();
            GameViewModel gameViewModel = new GameViewModel();

            MusicEngine.StartStop();
            MusicEngine.ButtonSoundEffect();
            window.Close();
            gameViewModel.CloseCurrentWindow();
            startView.Show();
        }
示例#15
0
        protected override void OnStartup(StartupEventArgs e)
        {
            RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            appName        = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName);
            ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, appName, out var createNew);
            if (!createNew)
            {
                // 唤起已经启动的进程
                var current = Process.GetCurrentProcess();
                foreach (var process in Process.GetProcessesByName(current.ProcessName))
                {
                    if (process.Id != current.Id)
                    {
                        Win32Api.SetForegroundWindow(process.MainWindowHandle);
                        Current.Shutdown();
                        Environment.Exit(-1);
                        break;
                    }
                }
            }
            else
            {
#if !DEBUG
                var autoUpdater = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AutoUpdater.exe");
                if (File.Exists(autoUpdater))
                {
                    Process.Start(autoUpdater, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
                }
                else
                {
                    Log.Warn("警告:未找到AutoUpdater.exe,无法及时更新到最新版。");
                }
#endif
                //FPS设置为20
                //Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline),
                //    new FrameworkPropertyMetadata { DefaultValue = 20 });
                var common = new Common();
                ConfigHelper.GetConfigHelper();
                appShortcutToStartup();
                var main = new StartView();
                main.Show();
            }

            base.OnStartup(e);

            //UI线程未捕获异常处理事件
            DispatcherUnhandledException += App_DispatcherUnhandledException;
            //Task线程内未捕获异常处理事件
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
            //非UI线程未捕获异常处理事件
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }
示例#16
0
        private void GoBack()
        {
            MusicEngine.ButtonSoundEffect();

            MusicEngine.StartStop();

            var window = Application.Current.Windows.OfType <Window>().SingleOrDefault(w => w.IsActive);

            StartView startView = new StartView();

            startView.Show();
            Selected_players.Clear();
            window.Close();
        }
        public void ChangeWindowPlay()
        {
            MusicEngine.ButtonSoundEffect();

            MusicEngine.StartStop();

            var window = Application.Current.Windows.OfType <Window>().SingleOrDefault(w => w.IsActive);

            StartView startView = new StartView();

            startView.Show();

            window.Close();
        }
示例#18
0
        public MainWindow()
        {
            InitializeComponent();
            var mainVM = new MainWindowViewModel();

            DataContext = mainVM;

            var startView      = new StartView();
            var startViewModel = new StartViewModel();

            startViewModel.LoadData();
            startView.DataContext = startViewModel;

            mainVM.CurrentView = startView;
        }
示例#19
0
        protected override void OnStartup(StartupEventArgs e)
        {
            RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
            appName        = System.IO.Path.GetFileNameWithoutExtension(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, appName, out var createNew);
            if (!createNew)
            {
                // 唤起已经启动的进程
                Process current = Process.GetCurrentProcess();
                foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                {
                    if (process.Id != current.Id)
                    {
                        Win32Api.SetForegroundWindow(process.MainWindowHandle);
                        App.Current.Shutdown();
                        Environment.Exit(-1);
                        break;
                    }
                }
            }
            else
            {
                //FPS设置为20
                //Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline),
                //    new FrameworkPropertyMetadata { DefaultValue = 20 });
                Common common = new Common();
                ConfigHelper.GetConfigHelper();
                appShortcutToStartup();
                var main = new StartView();
                main.Show();
                //WindowInteropHelper wndHelper = new WindowInteropHelper(main);
                //IntPtr handle = wndHelper.Handle;
                //int exStyle = (int)Win32Api.GetWindowLong(wndHelper.Handle, (int)Win32Api.GetWindowLongFields.GWL_EXSTYLE);
                //exStyle |= (int)Win32Api.ExtendedWindowStyles.WS_EX_TOOLWINDOW;
                //Win32Api.SetWindowLong(wndHelper.Handle, (int)Win32Api.GetWindowLongFields.GWL_EXSTYLE, (IntPtr)exStyle);
            }

            base.OnStartup(e);

            //UI线程未捕获异常处理事件
            this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
            //Task线程内未捕获异常处理事件
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
            //非UI线程未捕获异常处理事件
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
        }
示例#20
0
        public GameController()
        {
            while (WantsToPlay)
            {
                StartView.PrintView();
                var input = AskInput();

                var mazeKeys = new ConsoleKey[] { ConsoleKey.D1, ConsoleKey.D2, ConsoleKey.D3, ConsoleKey.D4, ConsoleKey.D5, ConsoleKey.D6 };

                if (input == ConsoleKey.S)
                {
                    WantsToPlay = false;
                    break;
                }

                if (mazeKeys.Contains(input))
                {
                    PlayGame(Array.IndexOf(mazeKeys, input) + 1);
                }
            }
        }
 private void InitCommands()
 {
     CreateMainWindowCommandFromDB = new RelayCommand(x =>
     {
         MainViewProxy.Proxy.StartUpKey = "DB";
         var window = new MainWindow();
         window.Show();
         CloseWindow();
     });
     CreateMainWindowCommandFromFile = new RelayCommand(x =>
     {
         MainViewProxy.Proxy.StartUpKey = "File";
         var window = new MainWindow();
         window.Show();
         CloseWindow();
     });
     ChangeLanguageCommand = new RelayCommand(x =>
     {
         var window = new StartView(x.ToString());
         window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
         window.Show();
         CloseWindow();
     });
 }
示例#22
0
        public App()
        {
            InitializeComponent();

            MainPage = new StartView();
        }
示例#23
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;
            }
        }
示例#24
0
 public StartScene()
 {
     view = new StartView();
 }
示例#25
0
 public StartScene()
 {
     view = new StartView();
 }
示例#26
0
 private void OnUnloaded(object sender, RoutedEventArgs e)
 {
     _owner = null;
 }
示例#27
0
 public NavigationModel(MainWindow mainWindow, UserModel user)
 {
     _mainWindow = mainWindow;
     _startView  = new StartView(user);
     _resultView = new ResultView(user);
 }
示例#28
0
        /// <summary>
        /// Method for printing the main menu
        /// </summary>
        public static void PrintMainMenu()
        {
            int    userMenuChoice;
            string menuInput = default;

            do
            {
                Console.Clear();
                StartView.Print();
                menuInput      = InputHelper.AskForMenuInput();
                userMenuChoice = InputHelper.ValidateMenuInput(menuInput);

                if (userMenuChoice == 0 && menuInput.ToLower() != "q")
                {
                    SharedError.PrintWrongMenuInput();
                }
                else
                {
                    var api = new WebShopApi();
                    switch (userMenuChoice)
                    {
                    case 1:
                        var userCredentials = LoginView.PrintLoginPage();
                        var user            = api.Login(userCredentials.userName, userCredentials.password);

                        if (UserController.UserIsNull(user) &&
                            !userCredentials.userName.Contains(abortChar))
                        {
                            SharedError.PrintWrongCredentials(user);

                            continue;
                        }
                        else if (userCredentials.userName.Contains(abortChar))
                        {
                            break;
                        }
                        else if (user.IsAdmin)
                        {
                            AdminController.PrintAdminSelectionMenu(user);
                        }
                        else
                        {
                            UserController.UserSelectionMenu(user);
                        }
                        break;

                    case 2:
                        var registererUserCredentials = UserView.Register();
                        if (!api.Register(registererUserCredentials.username,
                                          registererUserCredentials.password,
                                          registererUserCredentials.verifyPassword))
                        {
                            SharedError.Failed();
                            break;
                        }
                        SharedError.Success();
                        break;

                    case 0:
                        Environment.Exit(1);
                        break;

                    default:
                        SharedError.PrintWrongMenuInput();
                        break;
                    }
                }
            } while (menuInput.ToLower() != "q");
        }
        public void OpenStartWindow()
        {
            Window startWindow = new StartView(_sessionService, _quizDataService, this);

            startWindow.Show();
        }
        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);
        }
示例#31
0
 private void FindOwner()
 {
     FrameworkElement frameworkElement = this;
     StartView owner;
     do
     {
         frameworkElement = (FrameworkElement)VisualTreeHelper.GetParent(frameworkElement);
         owner = frameworkElement as StartView;
     }
     while (frameworkElement != null && owner == null);
     Owner = owner;
 }
示例#32
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            StartView.SetTemplateColor(ColorAssets.Text1);
        }
示例#33
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);
        }