internal void Initialize(DialogInitializationArguments args, ICancelHandler cancelHandler) { _onCancelAction = () => OnDialogCancelled(cancelHandler); var thread = new Thread(() => InitializeTask(args)); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
private void InitializeTask(DialogInitializationArguments args) { _hostAppName = args.AppName; _dataSource = new WaitDialogDataSource(); _window = new WaitWindowDialog(args.AppMainWindowHandle, args.AppProcessId, null) { DataContext = _dataSource }; _window.Cancelled += OnDialogCancelled; UpdateDialogStyle(args); StartApplication(); }
public void UpdateDialogStyle(DialogInitializationArguments args) { if (_disposed) { throw new ObjectDisposedException(nameof(UpdateDialogStyle)); } if (_dataSource == null) { return; } _dataSource.ForegroundColorBrush = new SolidColorBrush(ToColorFromRgba(args.TextColor)); _dataSource.BackgroundColorBrush = new SolidColorBrush(ToColorFromRgba(args.BackgroundColor)); _dataSource.BorderColorBrush = new SolidColorBrush(ToColorFromRgba(args.BorderColor)); _dataSource.CaptionBackgroundColorBrush = new SolidColorBrush(ToColorFromRgba(args.CaptionBackgroundColor)); _dataSource.CaptionForegroundColorBrush = new SolidColorBrush(ToColorFromRgba(args.CaptionTextColor)); _dataSource.CancelText = args.CancelText; }
private void EnsureInitialized() { ThreadHelper.ThrowIfNotOnUIThread(nameof(EnsureInitialized)); if (_initializationArguments == null) { _initializationArguments = new DialogInitializationArguments(); _initializationArguments.AppMainWindowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; _initializationArguments.AppProcessId = Process.GetCurrentProcess().Id; _initializationArguments.AppName = "FoC Launcher"; _initializationArguments.CancelText = "Cancel"; InitializeFontAndColorInformation(); } if (_provider != null) { return; } CreateAndStartAppDomain(); }