/// <summary> /// The FilterOptionWindow needs a <see cref="Aurora.MainWindow"/> object /// <para> /// <list type="bullet"> /// <listheader> /// <description> /// The user can change the properties: /// </description> /// </listheader> /// <item> /// <description>Brigthness</description> /// </item> /// <item> /// <description>Red component</description> /// </item> /// <item> /// <description>Blue component</description> /// </item> /// <item> /// <description>Green component</description> /// </item> /// </list> /// </para> /// </summary> /// <param name="mainWindow"></param> public FilterOptionWindow(MainWindow mainWindow) { InitializeComponent(); ColorMask.Height = mainWindow.Height; this.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; this.Loaded += Mask_Options_Loaded; Binding BrightnessBinding = new Binding("Brightness"); BrightnessBinding.Source = mainWindow; BrightnessBinding.Mode = BindingMode.TwoWay; BrightnessSlider.SetBinding(Slider.ValueProperty, BrightnessBinding); Binding RedBinding = new Binding("RedMask"); RedBinding.Source = mainWindow; RedBinding.Mode = BindingMode.TwoWay; RedSlider.SetBinding(Slider.ValueProperty, RedBinding); Binding BlueBinding = new Binding("BlueMask"); BlueBinding.Source = mainWindow; BlueBinding.Mode = BindingMode.TwoWay; BlueSlider.SetBinding(Slider.ValueProperty, BlueBinding); Binding GreenBinding = new Binding("GreenMask"); GreenBinding.Source = mainWindow; GreenBinding.Mode = BindingMode.TwoWay; GreenSlider.SetBinding(Slider.ValueProperty, GreenBinding); }
void ReleaseDesignerOutlets() { if (GoBackButton != null) { GoBackButton.Dispose(); GoBackButton = null; } if (AdjustBrightnessCheckbox != null) { AdjustBrightnessCheckbox.Dispose(); AdjustBrightnessCheckbox = null; } if (AdjustHueCheckbox != null) { AdjustHueCheckbox.Dispose(); AdjustHueCheckbox = null; } if (AdjustOpacityCheckbox != null) { AdjustOpacityCheckbox.Dispose(); AdjustOpacityCheckbox = null; } if (AdjustSaturationCheckbox != null) { AdjustSaturationCheckbox.Dispose(); AdjustSaturationCheckbox = null; } if (BaseColorSelector != null) { BaseColorSelector.Dispose(); BaseColorSelector = null; } if (BrightnessSlider != null) { BrightnessSlider.Dispose(); BrightnessSlider = null; } if (BrightnessValue != null) { BrightnessValue.Dispose(); BrightnessValue = null; } if (Color != null) { Color.Dispose(); Color = null; } if (ColorName != null) { ColorName.Dispose(); ColorName = null; } if (HueSlider != null) { HueSlider.Dispose(); HueSlider = null; } if (HueValue != null) { HueValue.Dispose(); HueValue = null; } if (OpacitySlider != null) { OpacitySlider.Dispose(); OpacitySlider = null; } if (OpacityValue != null) { OpacityValue.Dispose(); OpacityValue = null; } if (SaturationSlider != null) { SaturationSlider.Dispose(); SaturationSlider = null; } if (SaturationValue != null) { SaturationValue.Dispose(); SaturationValue = null; } }
void ReleaseDesignerOutlets() { if (AlignXButton != null) { AlignXButton.Dispose(); AlignXButton = null; } if (BrightnessSlider != null) { BrightnessSlider.Dispose(); BrightnessSlider = null; } if (BrightnessToolItem != null) { BrightnessToolItem.Dispose(); BrightnessToolItem = null; } if (CancelToolItem != null) { CancelToolItem.Dispose(); CancelToolItem = null; } if (EditThumbsButton != null) { EditThumbsButton.Dispose(); EditThumbsButton = null; } if (FrameSelectedLabel != null) { FrameSelectedLabel.Dispose(); FrameSelectedLabel = null; } if (FrameSelectSlider != null) { FrameSelectSlider.Dispose(); FrameSelectSlider = null; } if (GraphResetButton != null) { GraphResetButton.Dispose(); GraphResetButton = null; } if (MainGraph != null) { MainGraph.Dispose(); MainGraph = null; } if (MainProgressBar != null) { MainProgressBar.Dispose(); MainProgressBar = null; } if (MainTable != null) { MainTable.Dispose(); MainTable = null; } if (MainTabView != null) { MainTabView.Dispose(); MainTabView = null; } if (MetadataToolItem != null) { MetadataToolItem.Dispose(); MetadataToolItem = null; } if (OpenFileToolItem != null) { OpenFileToolItem.Dispose(); OpenFileToolItem = null; } if (ProcessToolItem != null) { ProcessToolItem.Dispose(); ProcessToolItem = null; } if (Statuslabel != null) { Statuslabel.Dispose(); Statuslabel = null; } if (TabChangeButton != null) { TabChangeButton.Dispose(); TabChangeButton = null; } if (ThumbEditView != null) { ThumbEditView.Dispose(); ThumbEditView = null; } if (ThumbViewGraph != null) { ThumbViewGraph.Dispose(); ThumbViewGraph = null; } if (ThumbViewList != null) { ThumbViewList.Dispose(); ThumbViewList = null; } if (YToEndButton != null) { YToEndButton.Dispose(); YToEndButton = null; } if (YToStartButton != null) { YToStartButton.Dispose(); YToStartButton = null; } }
public MainPage() { InitializeComponent(); this.WhenActivated(disposables => { NightModeBrightnessPicker.Items = Enumerable.Range(0, 255).ToArray(); this.WhenAnyValue(x => x.ViewModel.Color) .ObserveOn(RxApp.MainThreadScheduler) .Select(x => Color.FromRgba(x.R / 255f, x.G / 255f, x.B / 255f, x.A / 32f)) .BindTo(this, x => x.Grid.BackgroundColor) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Color) .Select(x => x.GetBrightness()) .Merge(this .WhenAnyValue(x => x.ViewModel.Color.A) .Select(x => x / 255f) .Skip(1)) .Select(x => 1 - x) .Select(x => Color.FromRgb(x, x, x)) .SubscribeSafe(SetTextColors) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.ConnectionState.Message) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(this, x => x.ConnectionStateLabel.Text) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.ConnectionState.Type) .Select(x => x == StateType.Connecting) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(this, x => x.ProgressIndicator.IsVisible) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.ConnectionState.Type) .Select(x => x == StateType.Connected) .ObserveOn(RxApp.MainThreadScheduler) .Do(SetSliderIsEnabled) .Select(x => x ? 1f : 0.5f) .Do(SetSliderOpacity) .SubscribeSafe() .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Red) .BindTo(this, x => x.RedLabel.Text) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Green) .BindTo(this, x => x.GreenLabel.Text) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Blue) .BindTo(this, x => x.BlueLabel.Text) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Alpha) .BindTo(this, x => x.BrightnessLabel.Text) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Red) .Take(1) .BindTo(this, x => x.RedSlider.Value) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Green) .Take(1) .BindTo(this, x => x.GreenSlider.Value) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Blue) .Take(1) .BindTo(this, x => x.BlueSlider.Value) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.Alpha) .Take(1) .BindTo(this, x => x.BrightnessSlider.Value) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.IsNightModeEnabled) .CombineLatest(GetInitialNightModePickerRowHeight(), Tuple.Create) .ObserveOn(RxApp.MainThreadScheduler) .Do(AnimateNightModePickerLayout) .Select(x => x.Item1) .BindTo(this, x => x.NightModeSwitch.IsToggled) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.NightModeBrightness) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(this, x => x.NightModeBrightnessPicker.SelectedIndex) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.NightModeFromTime) .ObserveOn(RxApp.MainThreadScheduler) .SubscribeSafe(x => NightModeFromTimePicker.GetUnderlyingPicker().Time = x) .DisposeWith(disposables); this.WhenAnyValue(x => x.ViewModel.NightModeToTime) .ObserveOn(RxApp.MainThreadScheduler) .SubscribeSafe(x => NightModeToTimePicker.GetUnderlyingPicker().Time = x) .DisposeWith(disposables); RedSlider .ValueChange() .Select(x => (int)x) .BindTo(ViewModel, x => x.Red) .DisposeWith(disposables); GreenSlider .ValueChange() .Select(x => (int)x) .BindTo(ViewModel, x => x.Green) .DisposeWith(disposables); BlueSlider .ValueChange() .Select(x => (int)x) .BindTo(ViewModel, x => x.Blue) .DisposeWith(disposables); BrightnessSlider .ValueChange() .Select(x => (int)x) .BindTo(ViewModel, x => x.Alpha) .DisposeWith(disposables); NightModeSwitch .ToggleChange() .BindTo(ViewModel, x => x.IsNightModeEnabled) .DisposeWith(disposables); NightModeBrightnessPicker .SelectionChange() .BindTo(ViewModel, x => x.NightModeBrightness) .DisposeWith(disposables); NightModeFromTimePicker .TimeChange() .BindTo(ViewModel, x => x.NightModeFromTime) .DisposeWith(disposables); NightModeToTimePicker .TimeChange() .BindTo(ViewModel, x => x.NightModeToTime) .DisposeWith(disposables); }); }
private void Window_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { BrightnessSlider.Focus(); }