internal MessageWindow(MessageWindowOptions windowOptions, Action <MessageWindowResult> onMessageResult) { this.OverrideStyleKey <MessageWindow>(); WindowOptions = windowOptions; _onMessageResult = onMessageResult; Message = windowOptions.MessageText; Title = windowOptions.Caption; IsResizable = false; DetachButtons(); switch (windowOptions.Buttons) { case MessageWindowButtons.OK: _actualButtons = new List <MessageWindowButton> { MessageWindowResultKind.OK.Create() }; break; case MessageWindowButtons.OKCancel: _actualButtons = new List <MessageWindowButton> { MessageWindowResultKind.OK.Create(), MessageWindowResultKind.Cancel.Create() }; break; case MessageWindowButtons.Yes: _actualButtons = new List <MessageWindowButton> { MessageWindowResultKind.Yes.Create() }; break; case MessageWindowButtons.YesNo: _actualButtons = new List <MessageWindowButton> { MessageWindowResultKind.Yes.Create(), MessageWindowResultKind.No.Create() }; break; case MessageWindowButtons.YesNoCancel: _actualButtons = new List <MessageWindowButton> { MessageWindowResultKind.Yes.Create(), MessageWindowResultKind.No.Create(), MessageWindowResultKind.Cancel.Create() }; break; default: throw new ArgumentOutOfRangeException(); } AttachButtons(); if (windowOptions.ImageSource != null) { ActualMessageIcon = windowOptions.ImageSource; } else { _messageIconResourceReference = ThemeManager.GetThemeReference(ThemeKeyword.ApplicationBackgroundBrush); ((INotifyPropertyChanged)_messageIconResourceReference).PropertyChanged += OnThemeResourceIconChanged; } Screen.VirtualScreenSizeChanged += OnSizeChanged; MoveWindowToCenterInternal(); this.InvokeOnLayoutUpdate(() => { Focus(); }); this.GetServiceOrCreate(() => new KeyboardHelperService()).Action += OnKeyboardAction; PlatformCtor(); }
protected internal override void BindThemeResource(ThemeResourceReference themeResourceReference) { }