public WindowDocument(WindowedDocumentUIService owner, IWindowSurrogate window, object documentContentView, string documentType) { this.owner = owner; Window = window; this.documentContentView = documentContentView; this.documentType = documentType; Window.Closing += window_Closing; Window.Closed += window_Closed; }
public WindowDocument(WindowedDocumentUIService owner, IWindowSurrogate window, object documentContentView) { this.owner = owner; Window = window; this.documentContentView = documentContentView; Window.RealWindow.Closing += window_Closing; Window.RealWindow.Closed += window_Closed; }
void UnsubscribeWindow(IWindowSurrogate window) { window.Activated -= OnWindowActivated; #if !SILVERLIGHT window.Deactivated -= OnWindowDeactivated; #endif window.Closed -= OnWindowClosed; }
public static IWindowSurrogate GetWindowSurrogate(object window) { IWindowSurrogate res = (window as DependencyObject).With(x => GetActualWindowSurrogate(x)); if (res != null) { return(res); } res = window as IWindowSurrogate ?? new WindowProxy((WindowBase)window); (window as DependencyObject).Do(x => SetActualWindowSurrogate(x, res)); return(res); }
IDocument IDocumentManagerService.CreateDocument(string documentType, object viewModel, object parameter, object parentViewModel) { object view = CreateAndInitializeView(documentType, viewModel, parameter, parentViewModel, this); IWindowSurrogate window = CreateWindow(view); windows.Add(window); SubscribeWindow(window); IDocument document = new WindowDocument(this, window, view, documentType); SetDocument(window.RealWindow, document); SetTitleBinding(view, WindowBase.TitleProperty, window.RealWindow, true); return(document); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(ActualWindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; InitializeDocumentContainer(window.RealWindow, Window.ContentProperty, WindowStyle); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; if (AllowSetWindowOwner && AssociatedObject != null) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } return(window); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; if (SetWindowOwner) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } Style windowStyle = GetDocumentContainerStyle(window.RealWindow, view, WindowStyle, WindowStyleSelector); InitializeDocumentContainer(window.RealWindow, Window.ContentProperty, windowStyle); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; return(window); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType ?? DefaultWindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; window.RealWindow.Style = WindowStyle; #if !SILVERLIGHT window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; if (AllowSetWindowOwner && AssociatedObject != null) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } #endif return(window); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; #if SILVERLIGHT window.RealWindow.Style = WindowStyle; #else if (SetWindowOwner) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } window.RealWindow.Style = GetDocumentContainerStyle(window.RealWindow, view, WindowStyle, WindowStyleSelector); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; #endif return(window); }
void IWindowService.Show(string documentType, object viewModel, object parameter, object parentViewModel) { if (window != null) { window.Show(); return; } object view = CreateAndInitializeView(documentType, viewModel, parameter, parentViewModel, this); window = CreateWindow(view); SetTitleBinding(); window.Closing += OnWindowClosing; window.Closed += OnWindowClosed; if (WindowShowMode == WindowShowMode.Dialog) { window.ShowDialog(); } else { window.Show(); } }
void UnsubscribeWindow(IWindowSurrogate window) { window.Activated -= OnWindowActivated; window.Deactivated -= OnWindowDeactivated; window.Closed -= OnWindowClosed; }
void IWindowService.Show(string documentType, object viewModel, object parameter, object parentViewModel) { if(window != null) { window.Show(); return; } object view = CreateAndInitializeView(documentType, viewModel, parameter, parentViewModel, this); window = CreateWindow(view); window.RealWindow.Title = Title ?? string.Empty; SetTitleBinding(); window.RealWindow.Closing += OnWindowClosing; window.RealWindow.Closed += OnWindowClosed; if(WindowShowMode == WindowShowMode.Dialog) window.ShowDialog(); else window.Show(); }
static void SetActualWindowSurrogate(DependencyObject obj, IWindowSurrogate value) { obj.SetValue(ActualWindowSurrogateProperty, value); }