public override void ViewDidLoad() { base.ViewDidLoad(); prepareViews(); Title = ViewModel.Title; VersionLabel.Text = ViewModel.Version; LoggingOutView.Hidden = true; SendFeedbackSuccessView.Hidden = true; this.Bind(ViewModel.Email, EmailLabel.Rx().Text()); this.Bind(ViewModel.IsSynced, SyncedView.Rx().IsVisible()); this.Bind(ViewModel.WorkspaceName, WorkspaceLabel.Rx().Text()); this.Bind(ViewModel.DurationFormat, DurationFormatLabel.Rx().Text()); this.Bind(ViewModel.IsRunningSync, SyncingView.Rx().IsVisible()); this.Bind(ViewModel.DateFormat, DateFormatLabel.Rx().Text()); this.Bind(ViewModel.BeginningOfWeek, BeginningOfWeekLabel.Rx().Text()); this.Bind(ViewModel.IsFeedbackSuccessViewShowing, SendFeedbackSuccessView.Rx().AnimatedIsVisible()); this.BindVoid(ViewModel.LoggingOut, () => { LoggingOutView.Hidden = false; SyncingView.Hidden = true; SyncedView.Hidden = true; }); this.Bind(HelpView.Rx().Tap(), ViewModel.OpenHelpView); this.Bind(LogoutButton.Rx().Tap(), ViewModel.TryLogout); this.Bind(AboutView.Rx().Tap(), ViewModel.OpenAboutView); this.Bind(FeedbackView.Rx().Tap(), ViewModel.SubmitFeedback); this.Bind(DateFormatView.Rx().Tap(), ViewModel.SelectDateFormat); this.Bind(WorkspaceView.Rx().Tap(), ViewModel.PickDefaultWorkspace); this.Bind(DurationFormatView.Rx().Tap(), ViewModel.SelectDurationFormat); this.BindVoid(ManualModeSwitch.Rx().Changed(), ViewModel.ToggleManualMode); this.Bind(BeginningOfWeekView.Rx().Tap(), ViewModel.SelectBeginningOfWeek); this.Bind(CalendarSettingsView.Rx().Tap(), ViewModel.OpenCalendarSettingsAction); this.BindVoid(SendFeedbackSuccessView.Rx().Tap(), ViewModel.CloseFeedbackSuccessView); this.Bind(NotificationSettingsView.Rx().Tap(), ViewModel.OpenNotificationSettingsAction); this.Bind(TwentyFourHourClockSwitch.Rx().Changed(), ViewModel.ToggleUseTwentyFourHourClock); UIApplication.Notifications .ObserveWillEnterForeground((sender, e) => startAnimations()) .DisposedBy(DisposeBag); if (!ViewModel.CalendarSettingsEnabled) { hideCalendarSettingsSection(); } ViewModel.IsManualModeEnabled .FirstAsync() .Subscribe(isEnabled => ManualModeSwitch.SetState(isEnabled, false)) .DisposedBy(DisposeBag); ViewModel.UseTwentyFourHourFormat .FirstAsync() .Subscribe(useTwentyFourHourFormat => TwentyFourHourClockSwitch.SetState(useTwentyFourHourFormat, false)) .DisposedBy(DisposeBag); }
public override void ViewDidLoad() { base.ViewDidLoad(); prepareViews(); Title = ViewModel.Title; VersionLabel.Text = ViewModel.Version; LoggingOutView.Hidden = true; SendFeedbackSuccessView.Hidden = true; this.Bind(ViewModel.Email, EmailLabel.BindText()); this.Bind(ViewModel.IsSynced, SyncedView.BindIsVisible()); this.Bind(ViewModel.WorkspaceName, WorkspaceLabel.BindText()); this.Bind(ViewModel.DurationFormat, DurationFormatLabel.BindText()); this.Bind(ViewModel.IsRunningSync, SyncingView.BindIsVisible()); this.Bind(ViewModel.DateFormat, DateFormatLabel.BindText()); this.Bind(ViewModel.IsManualModeEnabled, ManualModeSwitch.BindIsOn()); this.Bind(ViewModel.BeginningOfWeek, BeginningOfWeekLabel.BindText()); this.Bind(ViewModel.UseTwentyFourHourFormat, TwentyFourHourClockSwitch.BindIsOn()); this.BindVoid(ViewModel.LoggingOut, () => { LoggingOutView.Hidden = false; SyncingView.Hidden = true; SyncedView.Hidden = true; }); this.Bind(ViewModel.IsFeedbackSuccessViewShowing, SendFeedbackSuccessView.BindAnimatedIsVisible()); this.Bind(HelpView.Tapped(), ViewModel.OpenHelpView); this.Bind(LogoutButton.Tapped(), ViewModel.TryLogout); this.Bind(AboutView.Tapped(), ViewModel.OpenAboutView); this.Bind(FeedbackView.Tapped(), ViewModel.SubmitFeedback); this.Bind(DateFormatView.Tapped(), ViewModel.SelectDateFormat); this.Bind(WorkspaceView.Tapped(), ViewModel.PickDefaultWorkspace); this.BindVoid(ManualModeView.Tapped(), ViewModel.ToggleManualMode); this.Bind(DurationFormatView.Tapped(), ViewModel.SelectDurationFormat); this.Bind(BeginningOfWeekView.Tapped(), ViewModel.SelectBeginningOfWeek); this.Bind(TwentyFourHourClockView.Tapped(), ViewModel.ToggleUseTwentyFourHourClock); this.BindVoid(SendFeedbackSuccessView.Tapped(), ViewModel.CloseFeedbackSuccessView); UIApplication.Notifications .ObserveWillEnterForeground((sender, e) => startAnimations()) .DisposedBy(DisposeBag); }
public override void ViewDidLoad() { base.ViewDidLoad(); prepareViews(); calendarSizeDisposable = CalendarContainer.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onCalendarSizeChanged); source = new ReportsTableViewSource(ReportsTableView, ViewModel); source.OnScroll += onReportsTableScrolled; ReportsTableView.Source = source; bool areThereEnoughWorkspaces(ICollection <(string ItemName, IThreadSafeWorkspace Item)> workspaces) => workspaces.Count > 1; bool isWorkspaceNameTooLong(string workspaceName) { var attributes = new UIStringAttributes { Font = WorkspaceLabel.Font }; var size = new NSString(workspaceName).GetSizeUsingAttributes(attributes); return(size.Width >= maximumWorkspaceNameLabelWidth); }; //Text this.Bind(ViewModel.WorkspaceNameObservable, WorkspaceLabel.Rx().Text()); this.Bind(ViewModel.CurrentDateRangeStringObservable, titleButton.Rx().Title()); //Visibility this.Bind(ViewModel.WorkspacesObservable.Select(areThereEnoughWorkspaces), WorkspaceButton.Rx().IsVisible()); this.Bind(ViewModel.WorkspaceNameObservable.Select(isWorkspaceNameTooLong), WorkspaceFadeView.Rx().FadeRight()); //Commands this.BindVoid(titleButton.Rx().Tap(), ViewModel.ToggleCalendar); this.BindVoid(ReportsTableView.Rx().Tap(), ViewModel.HideCalendar); this.Bind(WorkspaceButton.Rx().Tap(), ViewModel.SelectWorkspace); var bindingSet = this.CreateBindingSet <ReportsViewController, ReportsViewModel>(); bindingSet.Bind(source).To(vm => vm.Segments); bindingSet.Apply(); }
public override void ViewDidLoad() { base.ViewDidLoad(); GroupSimilarTimeEntriesLabel.Text = Resources.GroupTimeEntries; YourProfileCellLabel.Text = Resources.YourProfile; WorkspaceCellLabel.Text = Resources.Workspace; FormatSettingsHeaderLabel.Text = Resources.FormatSettings; DateFormatCellLabel.Text = Resources.DateFormat; Use24HourClockCellLabel.Text = Resources.Use24HourClock; DurationFormatCellLabel.Text = Resources.DurationFormat; FirstDayOfTheWeekCellLabel.Text = Resources.FirstDayOfTheWeek; ManualModeCellLabel.Text = Resources.ManualMode; ManualModeDescriptionLabel.Text = Resources.ManualModeDescription; CalendarSettingsCellLabel.Text = Resources.CalendarSettingsTitle; SmartAlertCellLabel.Text = Resources.SmartAlerts; SubmitFeedbackCellLabel.Text = Resources.SubmitFeedback; AboutCellLabel.Text = Resources.About; HelpCellLabel.Text = Resources.Help; LoggingOutLabel.Text = Resources.LoggingOutSecurely; SyncingLabel.Text = Resources.Syncing; SyncedLabel.Text = Resources.SyncCompleted; FeedbackToastTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper(); FeedbackToastTextLabel.Text = Resources.ThankYouForTheFeedback; LogoutButton.SetTitle(Resources.SignOutOfToggl, UIControlState.Normal); prepareViews(); Title = ViewModel.Title; VersionLabel.Text = ViewModel.Version; LoggingOutView.Hidden = true; SendFeedbackSuccessView.Hidden = true; ViewModel.Email .Subscribe(EmailLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.IsSynced .Subscribe(SyncedView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.WorkspaceName .Subscribe(WorkspaceLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.DurationFormat .Subscribe(DurationFormatLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.IsRunningSync .Subscribe(SyncingView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.DateFormat .Subscribe(DateFormatLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.BeginningOfWeek .Subscribe(BeginningOfWeekLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.IsFeedbackSuccessViewShowing .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible()) .DisposedBy(DisposeBag); ViewModel.LoggingOut .Subscribe(_ => { LoggingOutView.Hidden = false; SyncingView.Hidden = true; SyncedView.Hidden = true; }) .DisposedBy(DisposeBag); HelpView.Rx() .BindAction(ViewModel.OpenHelpView) .DisposedBy(DisposeBag); LogoutButton.Rx() .BindAction(ViewModel.TryLogout) .DisposedBy(DisposeBag); AboutView.Rx() .BindAction(ViewModel.OpenAboutView) .DisposedBy(DisposeBag); FeedbackView.Rx() .BindAction(ViewModel.SubmitFeedback) .DisposedBy(DisposeBag); DateFormatView.Rx() .BindAction(ViewModel.SelectDateFormat) .DisposedBy(DisposeBag); WorkspaceView.Rx() .BindAction(ViewModel.PickDefaultWorkspace) .DisposedBy(DisposeBag); DurationFormatView.Rx() .BindAction(ViewModel.SelectDurationFormat) .DisposedBy(DisposeBag); ManualModeSwitch.Rx().Changed() .Subscribe(ViewModel.ToggleManualMode) .DisposedBy(DisposeBag); GroupSimilarTimeEntriesSwitch.Rx() .BindAction(ViewModel.ToggleTimeEntriesGrouping) .DisposedBy(DisposeBag); BeginningOfWeekView.Rx() .BindAction(ViewModel.SelectBeginningOfWeek) .DisposedBy(DisposeBag); CalendarSettingsView.Rx() .BindAction(ViewModel.OpenCalendarSettings) .DisposedBy(DisposeBag); SendFeedbackSuccessView.Rx().Tap() .Subscribe(ViewModel.CloseFeedbackSuccessView) .DisposedBy(DisposeBag); NotificationSettingsView.Rx() .BindAction(ViewModel.OpenNotificationSettings) .DisposedBy(DisposeBag); TwentyFourHourClockSwitch.Rx().Changed() .Subscribe(ViewModel.ToggleTwentyFourHourSettings.Inputs) .DisposedBy(DisposeBag); UIApplication.Notifications .ObserveWillEnterForeground((sender, e) => startAnimations()) .DisposedBy(DisposeBag); if (!ViewModel.CalendarSettingsEnabled) { hideCalendarSettingsSection(); } ViewModel.IsManualModeEnabled .FirstAsync() .Subscribe(isEnabled => ManualModeSwitch.SetState(isEnabled, false)) .DisposedBy(DisposeBag); ViewModel.IsGroupingTimeEntries .FirstAsync() .Subscribe(isGrouping => GroupSimilarTimeEntriesSwitch.SetState(isGrouping, false)) .DisposedBy(DisposeBag); ViewModel.UseTwentyFourHourFormat .FirstAsync() .Subscribe(useTwentyFourHourFormat => TwentyFourHourClockSwitch.SetState(useTwentyFourHourFormat, false)) .DisposedBy(DisposeBag); }
public override void ViewDidLoad() { base.ViewDidLoad(); calendarViewController = ViewControllerLocator.GetViewController(ViewModel.CalendarViewModel) as ReportsCalendarViewController; prepareViews(); OverviewContainerView.AddSubview(overview); overview.Frame = OverviewContainerView.Bounds; overview.Item = ViewModel; BarChartsContainerView.AddSubview(barChart); barChart.Frame = BarChartsContainerView.Bounds; barChart.Item = ViewModel; calendarSizeDisposable = CalendarContainer.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onCalendarSizeChanged); source = new ReportsTableViewSource(ReportsTableView, ViewModel); source.SetItems(ImmutableList <ChartSegment> .Empty); ReportsTableView.ReloadData(); ViewModel.SegmentsObservable .Subscribe(ReportsTableView.Rx().ReloadItems(source)) .DisposedBy(DisposeBag); source.ScrolledWithHeaderOffset .Subscribe(onReportsTableScrolled) .DisposedBy(DisposeBag); ReportsTableView.Source = source; bool areThereEnoughWorkspaces(ICollection <SelectOption <IThreadSafeWorkspace> > workspaces) => workspaces.Count > 1; bool isWorkspaceNameTooLong(string workspaceName) { var attributes = new UIStringAttributes { Font = WorkspaceLabel.Font }; var size = new NSString(workspaceName).GetSizeUsingAttributes(attributes); var maxWidth = TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular ? maximumWorkspaceNameLabelWidthRegular : maximumWorkspaceNameLabelWidthCompact; return(size.Width >= maxWidth); }; //Text ViewModel.WorkspaceNameObservable .Subscribe(WorkspaceLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.CurrentDateRange .Subscribe(titleButton.Rx().Title()) .DisposedBy(DisposeBag); //Visibility ViewModel.WorkspacesObservable .Select(areThereEnoughWorkspaces) .Subscribe(WorkspaceButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.WorkspaceNameObservable .Select(isWorkspaceNameTooLong) .Subscribe(WorkspaceFadeView.Rx().FadeRight()) .DisposedBy(DisposeBag); //Commands titleButton.Rx().Tap() .Subscribe(toggleCalendar) .DisposedBy(DisposeBag); ReportsTableView.Rx().Tap() .Subscribe(HideCalendar) .DisposedBy(DisposeBag); WorkspaceButton.Rx() .BindAction(ViewModel.SelectWorkspace) .DisposedBy(DisposeBag); void toggleCalendar() { if (calendarIsVisible) { HideCalendar(); return; } if (TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact) { ShowCalendar(); return; } ShowPopoverCalendar(); } }
void ReleaseDesignerOutlets() { if (AboutView != null) { AboutView.Dispose(); AboutView = null; } if (BeginningOfWeekLabel != null) { BeginningOfWeekLabel.Dispose(); BeginningOfWeekLabel = null; } if (BeginningOfWeekView != null) { BeginningOfWeekView.Dispose(); BeginningOfWeekView = null; } if (DateFormatLabel != null) { DateFormatLabel.Dispose(); DateFormatLabel = null; } if (DateFormatView != null) { DateFormatView.Dispose(); DateFormatView = null; } if (DurationFormatLabel != null) { DurationFormatLabel.Dispose(); DurationFormatLabel = null; } if (DurationFormatView != null) { DurationFormatView.Dispose(); DurationFormatView = null; } if (EmailLabel != null) { EmailLabel.Dispose(); EmailLabel = null; } if (EmailView != null) { EmailView.Dispose(); EmailView = null; } if (FeedbackView != null) { FeedbackView.Dispose(); FeedbackView = null; } if (FormatSettingsTitle != null) { FormatSettingsTitle.Dispose(); FormatSettingsTitle = null; } if (LoggingOutActivityIndicatorView != null) { LoggingOutActivityIndicatorView.Dispose(); LoggingOutActivityIndicatorView = null; } if (LoggingOutIndicator != null) { LoggingOutIndicator.Dispose(); LoggingOutIndicator = null; } if (LoggingOutLabel != null) { LoggingOutLabel.Dispose(); LoggingOutLabel = null; } if (LoggingOutView != null) { LoggingOutView.Dispose(); LoggingOutView = null; } if (LogoutButton != null) { LogoutButton.Dispose(); LogoutButton = null; } if (LogoutContainerView != null) { LogoutContainerView.Dispose(); LogoutContainerView = null; } if (LogoutVerticalOffsetConstraint != null) { LogoutVerticalOffsetConstraint.Dispose(); LogoutVerticalOffsetConstraint = null; } if (ManualModeSwitch != null) { ManualModeSwitch.Dispose(); ManualModeSwitch = null; } if (ManualModeView != null) { ManualModeView.Dispose(); ManualModeView = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (SyncedIcon != null) { SyncedIcon.Dispose(); SyncedIcon = null; } if (SyncedLabel != null) { SyncedLabel.Dispose(); SyncedLabel = null; } if (SyncedView != null) { SyncedView.Dispose(); SyncedView = null; } if (SyncingActivityIndicatorView != null) { SyncingActivityIndicatorView.Dispose(); SyncingActivityIndicatorView = null; } if (HelpView != null) { HelpView.Dispose(); HelpView = null; } if (SyncingIndicator != null) { SyncingIndicator.Dispose(); SyncingIndicator = null; } if (SyncingLabel != null) { SyncingLabel.Dispose(); SyncingLabel = null; } if (SyncingView != null) { SyncingView.Dispose(); SyncingView = null; } if (TopConstraint != null) { TopConstraint.Dispose(); TopConstraint = null; } if (TwentyFourHourClockSwitch != null) { TwentyFourHourClockSwitch.Dispose(); TwentyFourHourClockSwitch = null; } if (TwentyFourHourClockView != null) { TwentyFourHourClockView.Dispose(); TwentyFourHourClockView = null; } if (VersionLabel != null) { VersionLabel.Dispose(); VersionLabel = null; } if (WorkspaceLabel != null) { WorkspaceLabel.Dispose(); WorkspaceLabel = null; } if (WorkspaceView != null) { WorkspaceView.Dispose(); WorkspaceView = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); TitleLabel.Text = Resources.NewProject; NameTextField.Placeholder = Resources.ProjectName; ErrorLabel.Text = Resources.ProjectNameTakenError; DoneButton.SetTitle(Resources.Create, UIControlState.Normal); ProjectNameUsedErrorTextHeight.Constant = 0; // Name NameTextField.Rx().Text() .Subscribe(ViewModel.Name.Accept) .DisposedBy(DisposeBag); ViewModel.Name .Subscribe(NameTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); // Color ColorPickerOpeningView.Rx() .BindAction(ViewModel.PickColor) .DisposedBy(DisposeBag); ViewModel.Color .Select(color => color.ToNativeColor()) .Subscribe(ColorCircleView.Rx().BackgroundColor()) .DisposedBy(DisposeBag); // Error ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Error .Select(e => string.IsNullOrEmpty(e) ? new nfloat(0) : errorVisibleHeight) .Subscribe(ProjectNameUsedErrorTextHeight.Rx().Constant()) .DisposedBy(DisposeBag); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { ViewModel.Error .Select(e => string.IsNullOrEmpty(e) ? desiredIpadHeight : errorVisibleHeight + desiredIpadHeight) .Select(h => new CGSize(0, h)) .Subscribe(this.Rx().PreferredContentSize()) .DisposedBy(DisposeBag); } // Workspace WorkspaceLabel.Rx() .BindAction(ViewModel.PickWorkspace) .DisposedBy(DisposeBag); ViewModel.WorkspaceName .Subscribe(WorkspaceLabel.Rx().Text()) .DisposedBy(DisposeBag); // Client ClientLabel.Rx() .BindAction(ViewModel.PickClient) .DisposedBy(DisposeBag); var emptyText = Resources.AddClient.PrependWithAddIcon(ClientLabel.Font.CapHeight); ViewModel.ClientName .Select(attributedClientName) .Subscribe(ClientLabel.Rx().AttributedText()) .DisposedBy(DisposeBag); // Is Private PrivateProjectSwitchContainer.Rx().Tap() .Select(_ => PrivateProjectSwitch.On) .Subscribe(ViewModel.IsPrivate.Accept) .DisposedBy(DisposeBag); ViewModel.IsPrivate .Subscribe(PrivateProjectSwitch.Rx().On()) .DisposedBy(DisposeBag); // Save DoneButton.Rx() .BindAction(ViewModel.Save) .DisposedBy(DisposeBag); CloseButton.Rx() .BindAction(ViewModel.Close) .DisposedBy(DisposeBag); NSAttributedString attributedClientName(string clientName) { if (string.IsNullOrEmpty(clientName)) { return(emptyText); } return(new NSAttributedString(clientName)); } }
void ReleaseDesignerOutlets() { if (ClientLabel != null) { ClientLabel.Dispose(); ClientLabel = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (ColorCircleView != null) { ColorCircleView.Dispose(); ColorCircleView = null; } if (ColorPickerOpeningView != null) { ColorPickerOpeningView.Dispose(); ColorPickerOpeningView = null; } if (DoneButton != null) { DoneButton.Dispose(); DoneButton = null; } if (ErrorLabel != null) { ErrorLabel.Dispose(); ErrorLabel = null; } if (NameTextField != null) { NameTextField.Dispose(); NameTextField = null; } if (PrivateProjectLabel != null) { PrivateProjectLabel.Dispose(); PrivateProjectLabel = null; } if (PrivateProjectSwitch != null) { PrivateProjectSwitch.Dispose(); PrivateProjectSwitch = null; } if (PrivateProjectSwitchContainer != null) { PrivateProjectSwitchContainer.Dispose(); PrivateProjectSwitchContainer = null; } if (ProjectNameUsedErrorTextHeight != null) { ProjectNameUsedErrorTextHeight.Dispose(); ProjectNameUsedErrorTextHeight = null; } if (ProjectNameUsedErrorView != null) { ProjectNameUsedErrorView.Dispose(); ProjectNameUsedErrorView = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (WorkspaceLabel != null) { WorkspaceLabel.Dispose(); WorkspaceLabel = null; } if (NameView != null) { NameView.Dispose(); NameView = null; } if (WorkspaceView != null) { WorkspaceView.Dispose(); WorkspaceView = null; } if (ClientView != null) { ClientView.Dispose(); ClientView = null; } }
void ReleaseDesignerOutlets() { if (AboutCellLabel != null) { AboutCellLabel.Dispose(); AboutCellLabel = null; } if (AboutView != null) { AboutView.Dispose(); AboutView = null; } if (BeginningOfWeekLabel != null) { BeginningOfWeekLabel.Dispose(); BeginningOfWeekLabel = null; } if (BeginningOfWeekView != null) { BeginningOfWeekView.Dispose(); BeginningOfWeekView = null; } if (CalendarSectionTopConstraint != null) { CalendarSectionTopConstraint.Dispose(); CalendarSectionTopConstraint = null; } if (CalendarSettingsCellLabel != null) { CalendarSettingsCellLabel.Dispose(); CalendarSettingsCellLabel = null; } if (CalendarSettingsSection != null) { CalendarSettingsSection.Dispose(); CalendarSettingsSection = null; } if (CalendarSettingsView != null) { CalendarSettingsView.Dispose(); CalendarSettingsView = null; } if (DateFormatCellLabel != null) { DateFormatCellLabel.Dispose(); DateFormatCellLabel = null; } if (DateFormatLabel != null) { DateFormatLabel.Dispose(); DateFormatLabel = null; } if (DateFormatView != null) { DateFormatView.Dispose(); DateFormatView = null; } if (DurationFormatCellLabel != null) { DurationFormatCellLabel.Dispose(); DurationFormatCellLabel = null; } if (DurationFormatLabel != null) { DurationFormatLabel.Dispose(); DurationFormatLabel = null; } if (DurationFormatView != null) { DurationFormatView.Dispose(); DurationFormatView = null; } if (EmailLabel != null) { EmailLabel.Dispose(); EmailLabel = null; } if (EmailView != null) { EmailView.Dispose(); EmailView = null; } if (FeedbackToastTextLabel != null) { FeedbackToastTextLabel.Dispose(); FeedbackToastTextLabel = null; } if (FeedbackToastTitleLabel != null) { FeedbackToastTitleLabel.Dispose(); FeedbackToastTitleLabel = null; } if (FeedbackView != null) { FeedbackView.Dispose(); FeedbackView = null; } if (FirstDayOfTheWeekCellLabel != null) { FirstDayOfTheWeekCellLabel.Dispose(); FirstDayOfTheWeekCellLabel = null; } if (FormatSettingsHeaderLabel != null) { FormatSettingsHeaderLabel.Dispose(); FormatSettingsHeaderLabel = null; } if (FormatSettingsTitle != null) { FormatSettingsTitle.Dispose(); FormatSettingsTitle = null; } if (HelpCellLabel != null) { HelpCellLabel.Dispose(); HelpCellLabel = null; } if (HelpView != null) { HelpView.Dispose(); HelpView = null; } if (LoggingOutActivityIndicatorView != null) { LoggingOutActivityIndicatorView.Dispose(); LoggingOutActivityIndicatorView = null; } if (LoggingOutIndicator != null) { LoggingOutIndicator.Dispose(); LoggingOutIndicator = null; } if (LoggingOutLabel != null) { LoggingOutLabel.Dispose(); LoggingOutLabel = null; } if (LoggingOutView != null) { LoggingOutView.Dispose(); LoggingOutView = null; } if (LogoutButton != null) { LogoutButton.Dispose(); LogoutButton = null; } if (LogoutContainerView != null) { LogoutContainerView.Dispose(); LogoutContainerView = null; } if (LogoutVerticalOffsetConstraint != null) { LogoutVerticalOffsetConstraint.Dispose(); LogoutVerticalOffsetConstraint = null; } if (ManualModeCellLabel != null) { ManualModeCellLabel.Dispose(); ManualModeCellLabel = null; } if (ManualModeDescriptionLabel != null) { ManualModeDescriptionLabel.Dispose(); ManualModeDescriptionLabel = null; } if (ManualModeSwitch != null) { ManualModeSwitch.Dispose(); ManualModeSwitch = null; } if (ManualModeView != null) { ManualModeView.Dispose(); ManualModeView = null; } if (NotificationSettingsView != null) { NotificationSettingsView.Dispose(); NotificationSettingsView = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (SendFeedbackSuccessView != null) { SendFeedbackSuccessView.Dispose(); SendFeedbackSuccessView = null; } if (SmartAlertCellLabel != null) { SmartAlertCellLabel.Dispose(); SmartAlertCellLabel = null; } if (SubmitFeedbackCellLabel != null) { SubmitFeedbackCellLabel.Dispose(); SubmitFeedbackCellLabel = null; } if (SyncedIcon != null) { SyncedIcon.Dispose(); SyncedIcon = null; } if (SyncedLabel != null) { SyncedLabel.Dispose(); SyncedLabel = null; } if (SyncedView != null) { SyncedView.Dispose(); SyncedView = null; } if (SyncingActivityIndicatorView != null) { SyncingActivityIndicatorView.Dispose(); SyncingActivityIndicatorView = null; } if (SyncingIndicator != null) { SyncingIndicator.Dispose(); SyncingIndicator = null; } if (SyncingLabel != null) { SyncingLabel.Dispose(); SyncingLabel = null; } if (SyncingView != null) { SyncingView.Dispose(); SyncingView = null; } if (TopConstraint != null) { TopConstraint.Dispose(); TopConstraint = null; } if (TwentyFourHourClockSwitch != null) { TwentyFourHourClockSwitch.Dispose(); TwentyFourHourClockSwitch = null; } if (TwentyFourHourClockView != null) { TwentyFourHourClockView.Dispose(); TwentyFourHourClockView = null; } if (Use24HourClockCellLabel != null) { Use24HourClockCellLabel.Dispose(); Use24HourClockCellLabel = null; } if (VersionLabel != null) { VersionLabel.Dispose(); VersionLabel = null; } if (WorkspaceCellLabel != null) { WorkspaceCellLabel.Dispose(); WorkspaceCellLabel = null; } if (WorkspaceLabel != null) { WorkspaceLabel.Dispose(); WorkspaceLabel = null; } if (WorkspaceView != null) { WorkspaceView.Dispose(); WorkspaceView = null; } if (YourProfileCellLabel != null) { YourProfileCellLabel.Dispose(); YourProfileCellLabel = null; } if (GroupSimilarTimeEntriesLabel != null) { GroupSimilarTimeEntriesLabel.Dispose(); GroupSimilarTimeEntriesLabel = null; } if (GroupSimilarTimeEntriesSwitch != null) { GroupSimilarTimeEntriesSwitch.Dispose(); GroupSimilarTimeEntriesSwitch = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); prepareViews(); calendarSizeDisposable = CalendarContainer.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onCalendarSizeChanged); source = new ReportsTableViewSource(ReportsTableView, ViewModel); source.OnScroll += onReportsTableScrolled; ReportsTableView.Source = source; bool areThereEnoughWorkspaces(ICollection <(string ItemName, IThreadSafeWorkspace Item)> workspaces) => workspaces.Count > 1; bool isWorkspaceNameTooLong(string workspaceName) { var attributes = new UIStringAttributes { Font = WorkspaceLabel.Font }; var size = new NSString(workspaceName).GetSizeUsingAttributes(attributes); return(size.Width >= maximumWorkspaceNameLabelWidth); }; //Text ViewModel.WorkspaceNameObservable .Subscribe(WorkspaceLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.CurrentDateRangeStringObservable .Subscribe(titleButton.Rx().Title()) .DisposedBy(DisposeBag); //Visibility ViewModel.WorkspacesObservable .Select(areThereEnoughWorkspaces) .Subscribe(WorkspaceButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.WorkspaceNameObservable .Select(isWorkspaceNameTooLong) .Subscribe(WorkspaceFadeView.Rx().FadeRight()) .DisposedBy(DisposeBag); //Commands titleButton.Rx().Tap() .Subscribe(ViewModel.ToggleCalendar) .DisposedBy(DisposeBag); ReportsTableView.Rx().Tap() .Subscribe(ViewModel.HideCalendar) .DisposedBy(DisposeBag); WorkspaceButton.Rx() .BindAction(ViewModel.SelectWorkspace) .DisposedBy(DisposeBag); ViewModel.SegmentsObservable .Subscribe(segments => source.ItemsSource = segments) .DisposedBy(DisposeBag); }
public override void ViewDidLoad() { base.ViewDidLoad(); var separator = NavigationController.NavigationBar.InsertSeparator(); separator.BackgroundColor = ColorAssets.OpaqueSeparator; calendarViewController = ViewControllerLocator.GetViewController(ViewModel.CalendarViewModel) as ReportsCalendarViewController; prepareViews(); OverviewContainerView.AddSubview(overview); overview.Frame = OverviewContainerView.Bounds; overview.Item = ViewModel; BarChartsContainerView.AddSubview(barChart); barChart.Frame = BarChartsContainerView.Bounds; barChart.Item = ViewModel; calendarSizeDisposable = CalendarContainer.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onCalendarSizeChanged); source = new ReportsTableViewSource(ReportsTableView, ViewModel); source.SetItems(ImmutableList <ChartSegment> .Empty); ReportsTableView.ReloadData(); ViewModel.SegmentsObservable .Subscribe(ReportsTableView.Rx().ReloadItems(source)) .DisposedBy(DisposeBag); source.ScrolledWithHeaderOffset .Subscribe(onReportsTableScrolled) .DisposedBy(DisposeBag); ReportsTableView.Source = source; bool areThereEnoughWorkspaces(ICollection <SelectOption <IThreadSafeWorkspace> > workspaces) => workspaces.Count > 1; bool isWorkspaceNameTooLong(string workspaceName) { var attributes = new UIStringAttributes { Font = WorkspaceLabel.Font }; var size = new NSString(workspaceName).GetSizeUsingAttributes(attributes); var maxWidth = TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular ? maximumWorkspaceNameLabelWidthRegular : maximumWorkspaceNameLabelWidthCompact; return(size.Width >= maxWidth); }; //Text ViewModel.WorkspaceNameObservable .Subscribe(WorkspaceLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.CurrentDateRange .Subscribe(titleButton.Rx().TitleAdaptive()) .DisposedBy(DisposeBag); ViewModel.CurrentDateRange .Select(range => range == null) .DistinctUntilChanged() .Subscribe(shouldCenter => { if (shouldCenter) { activityIndicator.Frame = activityIndicatorCenteredFrame; } else { activityIndicator.Frame = activityIndicatorLeftAlignedFrame; } }) .DisposedBy(DisposeBag); //Visibility ViewModel.WorkspacesObservable .Select(areThereEnoughWorkspaces) .Do(updateWorkspaceButtonInsets) .Subscribe(WorkspaceButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.WorkspaceNameObservable .Select(isWorkspaceNameTooLong) .Subscribe(WorkspaceFadeView.Rx().FadeRight()) .DisposedBy(DisposeBag); ViewModel.IsLoadingObservable .Subscribe(activityIndicator.Rx().IsAnimating()) .DisposedBy(DisposeBag); //Commands titleButton.Rx().Tap() .Subscribe(toggleCalendar) .DisposedBy(DisposeBag); ReportsTableView.Rx().Tap() .Subscribe(HideCalendar) .DisposedBy(DisposeBag); WorkspaceButton.Rx() .BindAction(ViewModel.SelectWorkspace) .DisposedBy(DisposeBag); //Handoff viewDidAppearSubject.AsObservable() .CombineLatest( ViewModel.WorkspaceId, ViewModel.StartDate, ViewModel.EndDate, (_, workspaceId, start, end) => createUserActivity(workspaceId, start, end)) .Subscribe(updateUserActivity); NSUserActivity createUserActivity(long workspaceId, DateTimeOffset start, DateTimeOffset end) { var userActivity = new NSUserActivity(Handoff.Action.Reports); userActivity.EligibleForHandoff = true; userActivity.WebPageUrl = Handoff.Url.Reports(workspaceId, start, end); return(userActivity); } void updateUserActivity(NSUserActivity userActivity) { UserActivity = userActivity; UserActivity.BecomeCurrent(); } void toggleCalendar() { if (calendarIsVisible) { HideCalendar(); return; } if (TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact) { ShowCalendar(); return; } ShowPopoverCalendar(); } }
void ReleaseDesignerOutlets() { if (EmailLabel != null) { EmailLabel.Dispose(); EmailLabel = null; } if (WorkspaceLabel != null) { WorkspaceLabel.Dispose(); WorkspaceLabel = null; } if (PlanLabel != null) { PlanLabel.Dispose(); PlanLabel = null; } if (TwentyFourHourClockSwitch != null) { TwentyFourHourClockSwitch.Dispose(); TwentyFourHourClockSwitch = null; } if (AddMobileTagSwitch != null) { AddMobileTagSwitch.Dispose(); AddMobileTagSwitch = null; } if (FeedbackView != null) { FeedbackView.Dispose(); FeedbackView = null; } if (RateView != null) { RateView.Dispose(); RateView = null; } if (UpdateView != null) { UpdateView.Dispose(); UpdateView = null; } if (HelpView != null) { HelpView.Dispose(); HelpView = null; } if (VersionLabel != null) { VersionLabel.Dispose(); VersionLabel = null; } if (AddMobileTagView != null) { AddMobileTagView.Dispose(); AddMobileTagView = null; } if (TwentyFourHourClockView != null) { TwentyFourHourClockView.Dispose(); TwentyFourHourClockView = null; } if (SubscriptionView != null) { SubscriptionView.Dispose(); SubscriptionView = null; } if (WorkspaceView != null) { WorkspaceView.Dispose(); WorkspaceView = null; } if (EmailView != null) { EmailView.Dispose(); EmailView = null; } if (LoggingOutIndicator != null) { LoggingOutIndicator.Dispose(); LoggingOutIndicator = null; } if (LoggingOutLabel != null) { LoggingOutLabel.Dispose(); LoggingOutLabel = null; } if (LoggingOutView != null) { LoggingOutView.Dispose(); LoggingOutView = null; } if (LogoutButton != null) { LogoutButton.Dispose(); LogoutButton = null; } if (SyncedIcon != null) { SyncedIcon.Dispose(); SyncedIcon = null; } if (SyncedLabel != null) { SyncedLabel.Dispose(); SyncedLabel = null; } if (SyncedView != null) { SyncedView.Dispose(); SyncedView = null; } if (SyncingIndicator != null) { SyncingIndicator.Dispose(); SyncingIndicator = null; } if (SyncingLabel != null) { SyncingLabel.Dispose(); SyncingLabel = null; } if (SyncingView != null) { SyncingView.Dispose(); SyncingView = null; } }