-
-
Save kraftwerk15/a819cf9312183dc3c007a1f36f9b1db1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ShowForm(UIApplication uiapp) | |
{ | |
#if NET46 | |
IntPtr owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; | |
#endif | |
#if !NET46 | |
IntPtr owner = uiapp.MainWindowHandle; | |
#endif | |
// If we do not have a dialog yet, create and show it | |
if (applicationView == null || applicationView.Visibility != System.Windows.Visibility.Hidden) | |
{ | |
// A new handler to handle request posting by the dialog | |
RequestHandler handler = new RequestHandler(); | |
m_Handler = handler; | |
// External Event for the dialog to use (to post requests) | |
ExternalEvent exEvent = ExternalEvent.Create(handler); | |
m_ExEvent = exEvent; | |
// We give the objects to the new dialog; | |
// The dialog becomes the owner responsible fore disposing them, eventually. | |
ApplicationView settings = new ApplicationView(exEvent, handler); | |
settings.Height = 800; | |
settings.Width = 800; | |
settings.Title = "Family Browser"; | |
settings.WindowStartupLocation = WindowStartupLocation.CenterScreen; | |
settings.WindowStyle = WindowStyle.ToolWindow; | |
settings.ResizeMode = ResizeMode.CanResizeWithGrip; | |
settings.MinHeight = 600; | |
settings.MinWidth = 650; | |
settings.ShowInTaskbar = false; | |
WindowInteropHelper x = new WindowInteropHelper(settings); | |
x.Owner = owner; | |
applicationView = settings; | |
settings.Show(); | |
} | |
else if (applicationView.Visibility == System.Windows.Visibility.Hidden) | |
{ | |
applicationView.Visibility = System.Windows.Visibility.Visible; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ApplicationView settings = new ApplicationView(exEvent, handler); | |
ResourceDictionary myresourcedictionary = new ResourceDictionary | |
{ | |
Source = | |
new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml", | |
UriKind.RelativeOrAbsolute) | |
}; | |
ResourceDictionary myresourcedictionary1 = new ResourceDictionary | |
{ | |
Source = | |
new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml", | |
UriKind.RelativeOrAbsolute) | |
}; | |
ResourceDictionary myresourcedictionary2 = new ResourceDictionary | |
{ | |
Source = | |
new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml", | |
UriKind.RelativeOrAbsolute) | |
}; | |
//Collection<ResourceDictionary> resourceDictionaries = new Collection<ResourceDictionary>(); | |
//resourceDictionaries.Add(myresourcedictionary); | |
//resourceDictionaries.Add(myresourcedictionary1); | |
//resourceDictionaries.Add(myresourcedictionary2); | |
//settings.Resources.MergedDictionaries = resourceDictionaries; | |
settings.Resources = myresourcedictionary; | |
settings.Resources = myresourcedictionary1; | |
settings.Resources = myresourcedictionary2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment