private void PositionWindowRelativeToTaskbar() { WindowsTaskbar taskbar = new WindowsTaskbar(); switch (taskbar.GetTaskBarLocation()) { case WindowsTaskbar.TaskBarLocation.LEFT: Left = -WindowsTaskbar.GetTaskbarHeight(taskbar.GetTaskBarLocation()); Top = SystemParameters.PrimaryScreenHeight - Height; break; case WindowsTaskbar.TaskBarLocation.RIGHT: Left = SystemParameters.PrimaryScreenWidth - (Width + WindowsTaskbar.GetTaskbarHeight(taskbar.GetTaskBarLocation())); Top = SystemParameters.PrimaryScreenHeight - Height; break; case WindowsTaskbar.TaskBarLocation.TOP: Left = SystemParameters.PrimaryScreenWidth - Width; Top = -WindowsTaskbar.GetTaskbarHeight(taskbar.GetTaskBarLocation()); break; case WindowsTaskbar.TaskBarLocation.BOTTOM: Left = SystemParameters.PrimaryScreenWidth - Width; Top = SystemParameters.PrimaryScreenHeight - (Height + WindowsTaskbar.GetTaskbarHeight(taskbar.GetTaskBarLocation())); break; } }
public ConfigDialog(Config config) { InitializeComponent(); if (Locations.IsPortable) { Text += @" - " + Resources.PortableMode; } HandleCreated += delegate { if (Locations.IsPortable || ZeroInstallInstance.IsRunningFromCache) { WindowsTaskbar.PreventPinning(Handle); } }; _config = config; ConfigToControls(); LoadImplementationDirs(); LoadCatalogSources(); LoadTrust(); panelTrustedKeys.Controls.Add(treeViewTrustedKeys); treeViewTrustedKeys.CheckedEntriesChanged += treeViewTrustedKeys_CheckedEntriesChanged; if (WindowsUtils.IsWindows) { LoadLanguages(); } else { tabPageLanguage.Visible = false; } }
public static void ConfigureTaskbar(Form form, string name, string?subCommand = null, string?arguments = null) { #region Sanity checks if (form == null) { throw new ArgumentNullException(nameof(form)); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } #endregion if (Locations.IsPortable || ZeroInstallInstance.IsRunningFromCache) { WindowsTaskbar.PreventPinning(form.Handle); } string appUserModelID = AppUserModelID; if (!string.IsNullOrEmpty(subCommand)) { appUserModelID += "." + subCommand; } string exePath = Path.Combine(Locations.InstallBase, ExeName + ".exe"); WindowsTaskbar.SetWindowAppID(form.Handle, appUserModelID, exePath.EscapeArgument() + " " + arguments, exePath, name); }
/// <summary> /// Creates a new store management window. /// </summary> /// <param name="store">The <see cref="IImplementationStore"/> to manage.</param> /// <param name="feedCache">Information about implementations found in the <paramref name="store"/> are extracted from here.</param> public StoreManageForm(IImplementationStore store, IFeedCache feedCache) { _store = store ?? throw new ArgumentNullException(nameof(store)); _feedCache = feedCache ?? throw new ArgumentNullException(nameof(feedCache)); InitializeComponent(); buttonRunAsAdmin.AddShieldIcon(); HandleCreated += delegate { if (Locations.IsPortable || ZeroInstallInstance.IsRunningFromCache) { WindowsTaskbar.PreventPinning(Handle); } if (Locations.IsPortable) { Text += @" - " + Resources.PortableMode; } if (WindowsUtils.IsAdministrator) { Text += @" (Administrator)"; } else if (WindowsUtils.HasUac) { buttonRunAsAdmin.Visible = true; } }; Shown += async delegate { await RefreshListAsync(); }; _treeView.SelectedEntryChanged += OnSelectedEntryChanged; _treeView.CheckedEntriesChanged += OnCheckedEntriesChanged; splitContainer.Panel1.Controls.Add(_treeView); }
public static void Save() { PlayerPrefs.SetString(nameof(WindowsTaskbar), WindowsTaskbar.ToString()); PlayerPrefs.SetString(nameof(LoopbackDeviceID), LoopbackDeviceID); PlayerPrefs.SetInt(nameof(CaptureBufferMilliseconds), CaptureBufferMilliseconds); PlayerPrefs.Save(); }
//--------------------// #region Form private void MainForm_HandleCreated(object sender, EventArgs e) { Program.ConfigureTaskbar(this, Text); WindowsTaskbar.AddTaskLinks(Program.AppUserModelID, new[] { new WindowsTaskbar.ShellLink(buttonSync.Text.Replace("&", ""), Path.Combine(Locations.InstallBase, Commands.WinForms.Program.ExeName + ".exe"), SyncApps.Name), new WindowsTaskbar.ShellLink(buttonUpdateAll.Text.Replace("&", ""), Path.Combine(Locations.InstallBase, Commands.WinForms.Program.ExeName + ".exe"), UpdateApps.Name) }); }
private void Button_Click(object sender, RoutedEventArgs e) { WindowsTaskbar taskbar = new WindowsTaskbar(); PrimaryScreenHeightValue.Content = SystemParameters.PrimaryScreenHeight.ToString(); PrimaryScreenWidthValue.Content = SystemParameters.PrimaryScreenWidth.ToString(); WorkAreaHeightValue.Content = SystemParameters.WorkArea.Top.ToString(); WorkAreaWidthValue.Content = SystemParameters.WorkArea.Left.ToString(); TopValue.Content = Top.ToString(); LeftValue.Content = Left.ToString(); TaskbarHeight.Content = WindowsTaskbar.GetTaskbarHeight(taskbar.GetTaskBarLocation()).ToString(); TaskbarPosition.Content = taskbar.GetTaskBarLocation().ToString(); }
//--------------------// #region Form private void MainForm_HandleCreated(object sender, EventArgs e) { if (Locations.IsPortable || ZeroInstallInstance.IsRunningFromCache) { WindowsTaskbar.PreventPinning(Handle); } else { string exePath = Path.Combine(Locations.InstallBase, "ZeroInstall.exe"); string commandsExe = Path.Combine(Locations.InstallBase, "0install-win.exe"); WindowsTaskbar.SetWindowAppID(Handle, "ZeroInstall", exePath.EscapeArgument(), exePath, "Zero Install"); WindowsTaskbar.AddTaskLinks("ZeroInstall", new[] { new WindowsTaskbar.ShellLink(buttonSync.Text.Replace("&", ""), commandsExe, SyncApps.Name), new WindowsTaskbar.ShellLink(buttonUpdateAll.Text.Replace("&", ""), commandsExe, UpdateApps.Name), new WindowsTaskbar.ShellLink(buttonStoreManage.Text.Replace("&", ""), commandsExe, StoreMan.Name + " manage") }); } }
internal static void ConfigureTaskbar([NotNull] Form form, [NotNull] string name, [CanBeNull] string subCommand = null, [CanBeNull] string arguments = null) { #region Sanity checks if (form == null) { throw new ArgumentNullException("form"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } #endregion string appUserModelID = AppUserModelID; if (!string.IsNullOrEmpty(subCommand)) { appUserModelID += "." + subCommand; } string exePath = Path.Combine(Locations.InstallBase, ExeName + ".exe"); WindowsTaskbar.SetWindowAppID(form.Handle, appUserModelID, exePath.EscapeArgument() + " " + arguments, exePath, name); }
internal static void ConfigureTaskbar([NotNull] Form form, [NotNull] string name) { #region Sanity checks if (form == null) { throw new ArgumentNullException(nameof(form)); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } #endregion if (Locations.IsPortable || ProgramUtils.IsRunningFromCache) { WindowsTaskbar.PreventPinning(form.Handle); } string appUserModelID = AppUserModelID; string exePath = Path.Combine(Locations.InstallBase, ExeName + ".exe"); WindowsTaskbar.SetWindowAppID(form.Handle, appUserModelID, exePath.EscapeArgument(), exePath, name); }
/// <summary> /// Prepares reporting an error. /// </summary> /// <param name="exception">The exception object describing the error.</param> /// <param name="uploadUri">The URI to upload error reports to.</param> private ErrorReportForm(Exception exception, Uri uploadUri) { #region Sanity checks if (exception == null) { throw new ArgumentNullException(nameof(exception)); } if (uploadUri == null) { throw new ArgumentNullException(nameof(uploadUri)); } #endregion InitializeComponent(); HandleCreated += delegate { WindowsTaskbar.PreventPinning(Handle); }; Shown += delegate { this.SetForegroundWindow(); }; _exception = exception; // A missing file as the root is more important than the secondary exceptions it causes if (exception.InnerException is FileNotFoundException) { exception = exception.InnerException; } // Make the message simpler for missing files detailsBox.Text = (exception is FileNotFoundException) ? exception.Message.Replace("\n", Environment.NewLine) : exception.ToString(); // Append inner exceptions if (exception.InnerException != null) { detailsBox.Text += Environment.NewLine + Environment.NewLine + exception.InnerException; } _uploadUri = uploadUri; }
private void MainForm_Shown(object sender, EventArgs e) { WindowsTaskbar.SetProgressState(Handle, WindowsTaskbar.ProgressBarState.Indeterminate); backgroundWorker.RunWorkerAsync(); }
private void AsyncWaitDialog_FormClosing(object sender, FormClosingEventArgs e) { WindowsTaskbar.SetProgressState(Handle, WindowsTaskbar.ProgressBarState.NoProgress); }
private void AsyncWaitDialog_Shown(object sender, EventArgs e) { WindowsTaskbar.SetProgressState(Handle, WindowsTaskbar.ProgressBarState.Indeterminate); }
private OutputBox() { InitializeComponent(); HandleCreated += delegate { WindowsTaskbar.PreventPinning(Handle); }; }
/// <inheritdoc/> public void Report(TaskSnapshot value) { // Ensure execution on GUI thread if (InvokeRequired) { BeginInvoke(new Action <TaskSnapshot>(Report), value); return; } switch (value.State) { case TaskState.Ready: // When the State is complete the bar should always be empty Style = ProgressBarStyle.Continuous; Value = 0; if (UseTaskbar && ParentHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressState(ParentHandle, WindowsTaskbar.ProgressBarState.NoProgress); } break; case TaskState.Started: case TaskState.Header: Style = ProgressBarStyle.Marquee; if (UseTaskbar && ParentHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressState(ParentHandle, WindowsTaskbar.ProgressBarState.Indeterminate); } break; case TaskState.Data: if (value.UnitsTotal == -1) { Style = ProgressBarStyle.Marquee; if (UseTaskbar && ParentHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressState(ParentHandle, WindowsTaskbar.ProgressBarState.Indeterminate); } } else { Style = ProgressBarStyle.Continuous; if (UseTaskbar && ParentHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressState(ParentHandle, WindowsTaskbar.ProgressBarState.Normal); } } break; case TaskState.IOError: case TaskState.WebError: Style = ProgressBarStyle.Continuous; if (UseTaskbar && ParentHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressState(ParentHandle, WindowsTaskbar.ProgressBarState.Error); } break; case TaskState.Complete: // When the State is complete the bar should always be full Style = ProgressBarStyle.Continuous; Value = 100; if (UseTaskbar && ParentHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressState(ParentHandle, WindowsTaskbar.ProgressBarState.NoProgress); } break; } var currentValue = (int)(value.Value * 100); if (currentValue < 0) { currentValue = 0; } else if (currentValue > 100) { currentValue = 100; } // When the State is complete the bar should always be full if (value.State == TaskState.Complete) { currentValue = 100; } Value = currentValue; IntPtr formHandle = ParentHandle; if (UseTaskbar && formHandle != IntPtr.Zero) { WindowsTaskbar.SetProgressValue(formHandle, currentValue, 100); } }
/// <summary> /// Initializes a new instance of the <see cref="ShellView"/> class. /// </summary> public ShellView() { this.InitializeComponent(); IUserSettingService userSettingService = IoC.Get <IUserSettingService>(); bool minimiseToTray = userSettingService.GetUserSetting <bool>(UserSettingConstants.MainWindowMinimize); if (minimiseToTray) { StreamResourceInfo streamResourceInfo = Application.GetResourceStream(new Uri("pack://application:,,,/handbrakepineapple.ico")); if (streamResourceInfo != null) { Stream iconStream = streamResourceInfo.Stream; notifyIconService = IoC.Get <INotifyIconService>(); notifyIconService.Setup(new Icon(iconStream)); this.notifyIconService.SetClickCallback(() => this.NotifyIconClick()); } this.StateChanged += this.ShellViewStateChanged; } this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.E, ModifierKeys.Control)), new KeyGesture(Key.E, ModifierKeys.Control))); // Start Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.P, ModifierKeys.Alt)), new KeyGesture(Key.P, ModifierKeys.Alt))); // Pause Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.K, ModifierKeys.Control)), new KeyGesture(Key.K, ModifierKeys.Control))); // Stop Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.L, ModifierKeys.Control)), new KeyGesture(Key.L, ModifierKeys.Control))); // Open Log Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Q, ModifierKeys.Control)), new KeyGesture(Key.Q, ModifierKeys.Control))); // Open Queue Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control)), new KeyGesture(Key.A, ModifierKeys.Control))); // Add to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Alt)), new KeyGesture(Key.A, ModifierKeys.Alt))); // Add all to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift))); // Add selection to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control)), new KeyGesture(Key.O, ModifierKeys.Control))); // File Scan this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Alt)), new KeyGesture(Key.O, ModifierKeys.Alt))); // Scan Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift))); // Scan a Folder this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift))); // Garbage Collection this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F1, ModifierKeys.None)), new KeyGesture(Key.F1, ModifierKeys.None))); // Help this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.S, ModifierKeys.Control)), new KeyGesture(Key.S, ModifierKeys.Control))); // Browse Destination // Tabs Switching this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D1, ModifierKeys.Control)), new KeyGesture(Key.D1, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D2, ModifierKeys.Control)), new KeyGesture(Key.D2, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D3, ModifierKeys.Control)), new KeyGesture(Key.D3, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D4, ModifierKeys.Control)), new KeyGesture(Key.D4, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D5, ModifierKeys.Control)), new KeyGesture(Key.D5, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D6, ModifierKeys.Control)), new KeyGesture(Key.D6, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D7, ModifierKeys.Control)), new KeyGesture(Key.D7, ModifierKeys.Control))); // Enable Windows 7 Taskbar progress indication. if (this.TaskbarItemInfo == null) { this.TaskbarItemInfo = WindowsTaskbar.GetTaskBar(); } // Setup the UI Language string culture = userSettingService.GetUserSetting <string>(UserSettingConstants.UiLanguage); if (!string.IsNullOrEmpty(culture)) { InterfaceLanguage language = InterfaceLanguageUtilities.FindInterfaceLanguage(culture); if (language != null) { if (language.RightToLeft) { if (Application.Current.MainWindow != null) { Application.Current.MainWindow.FlowDirection = FlowDirection.RightToLeft; } } } } }
/// <summary> /// Initializes a new instance of the <see cref="ShellView"/> class. /// </summary> public ShellView() { this.InitializeComponent(); IUserSettingService userSettingService = IoC.Get <IUserSettingService>(); bool minimiseToTray = userSettingService.GetUserSetting <bool>(UserSettingConstants.MainWindowMinimize); if (minimiseToTray) { StreamResourceInfo streamResourceInfo = Application.GetResourceStream(new Uri("pack://application:,,,/handbrakepineapple.ico")); if (streamResourceInfo != null) { Stream iconStream = streamResourceInfo.Stream; notifyIconService = IoC.Get <INotifyIconService>(); notifyIconService.Setup(new Icon(iconStream)); this.notifyIconService.SetClickCallback(() => this.NotifyIconClick()); } this.StateChanged += this.ShellViewStateChanged; } this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.E, ModifierKeys.Control)), new KeyGesture(Key.E, ModifierKeys.Control))); // Start Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.P, ModifierKeys.Alt)), new KeyGesture(Key.P, ModifierKeys.Alt))); // Pause Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.K, ModifierKeys.Control)), new KeyGesture(Key.K, ModifierKeys.Control))); // Stop Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.L, ModifierKeys.Control)), new KeyGesture(Key.L, ModifierKeys.Control))); // Open Log Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Q, ModifierKeys.Control)), new KeyGesture(Key.Q, ModifierKeys.Control))); // Open Queue Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Alt)), new KeyGesture(Key.A, ModifierKeys.Alt))); // Add to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Alt)), new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Alt))); // Add all to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift))); // Add selection to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control)), new KeyGesture(Key.O, ModifierKeys.Control))); // File Scan this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Alt)), new KeyGesture(Key.O, ModifierKeys.Alt))); // Scan Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift))); // Scan a Folder this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift))); // Garbage Collection this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F1, ModifierKeys.None)), new KeyGesture(Key.F1, ModifierKeys.None))); // Help this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.S, ModifierKeys.Control)), new KeyGesture(Key.S, ModifierKeys.Control))); // Browse Destination this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.OemPlus, ModifierKeys.Control)), new KeyGesture(Key.OemPlus, ModifierKeys.Control))); // Next Title this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.OemMinus, ModifierKeys.Control)), new KeyGesture(Key.OemMinus, ModifierKeys.Control))); // Previous Title this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Add, ModifierKeys.Control)), new KeyGesture(Key.Add, ModifierKeys.Control))); // Next Title this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Subtract, ModifierKeys.Control)), new KeyGesture(Key.Subtract, ModifierKeys.Control))); // Previous Title // Tabs Switching this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D1, ModifierKeys.Control)), new KeyGesture(Key.D1, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D2, ModifierKeys.Control)), new KeyGesture(Key.D2, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D3, ModifierKeys.Control)), new KeyGesture(Key.D3, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D4, ModifierKeys.Control)), new KeyGesture(Key.D4, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D5, ModifierKeys.Control)), new KeyGesture(Key.D5, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D6, ModifierKeys.Control)), new KeyGesture(Key.D6, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D7, ModifierKeys.Control)), new KeyGesture(Key.D7, ModifierKeys.Control))); // Enable Windows Taskbar progress indication. if (this.TaskbarItemInfo == null) { this.TaskbarItemInfo = WindowsTaskbar.GetTaskBar(); } // Setup the Right To Left Mode RightToLeftMode rightToLeft = (RightToLeftMode)userSettingService.GetUserSetting <int>(UserSettingConstants.RightToLeftUi); switch (rightToLeft) { case RightToLeftMode.EntireInterface: if (Application.Current.MainWindow != null) { Application.Current.MainWindow.FlowDirection = FlowDirection.RightToLeft; } break; case RightToLeftMode.TextOnly: FrameworkElement.FlowDirectionProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(FlowDirection.RightToLeft)); FrameworkElement.FlowDirectionProperty.OverrideMetadata(typeof(TextBox), new FrameworkPropertyMetadata(FlowDirection.RightToLeft)); break; } }