本文整理汇总了C#中System.Windows.StartupEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# StartupEventArgs类的具体用法?C# StartupEventArgs怎么用?C# StartupEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StartupEventArgs类属于System.Windows命名空间,在下文中一共展示了StartupEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
try
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
SoftphoneEngine model = new SoftphoneEngine();
MainWindow_1 window = new MainWindow_1(model);
window.Show();
}
catch (Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.Append("Could not initialize softphone: \r\n");
sb.Append(ex.Message);
sb.Append("\r\n");
sb.Append(ex.InnerException);
sb.Append(ex.StackTrace);
MessageBox.Show(sb.ToString());
Application.Current.Shutdown();
}
base.OnStartup(e);
}
示例2: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
//Application.Current.Resources.MergedDictionaries.Clear();
//ResourceDictionary resource = (ResourceDictionary)Application.LoadComponent(
// new Uri("Dictionary1.xaml", UriKind.Relative));
//Application.Current.Resources.MergedDictionaries.Add(resource);
}
示例3: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
// Global exception handling
Current.DispatcherUnhandledException += AppDispatcherUnhandledException;
string procName = Process.GetCurrentProcess().ProcessName;
// get the list of all processes by that name
Process[] processes = Process.GetProcessesByName(procName);
if (processes.Length > 1)
{
MessageBox.Show(TranslationStrings.LabelApplicationAlreadyRunning);
Shutdown(-1);
return;
}
ThemeManager.AddAccent("Astro", new Uri("pack://application:,,,/CameraControl;component/Resources/AstroAccent.xaml"));
ThemeManager.AddAppTheme("Black", new Uri("pack://application:,,,/CameraControl;component/Resources/AstroTheme.xaml"));
ServiceProvider.Branding = Branding.LoadBranding();
if (ServiceProvider.Branding.ShowStartupScreen)
{
_startUpWindow=new StartUpWindow();
_startUpWindow.Show();
}
Task.Factory.StartNew(InitApplication);
}
示例4: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
CommandingBootstrapper bootstrapper = new CommandingBootstrapper();
bootstrapper.Run();
}
示例5: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MainWindow window = new MainWindow();
// Create the ViewModel to which
// the main window binds.
var viewModel = new ViewModel.MainWindowViewModel();
// When the ViewModel asks to be closed,
// close the window.
EventHandler handler = (sender, e2) =>
{
window.Close();
};
viewModel.RequestClose += handler;
viewModel.RequestClosed += (sender, e3) =>
{
viewModel.RequestClose -= handler;
};
// Allow all controls in the window to
// bind to the ViewModel by setting the
// DataContext, which propagates down
// the element tree.
window.DataContext = viewModel;
window.Show();
}
示例6: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
//for install plugin command when wox didn't start up
//we shouldn't init MainWindow, just intall plugin and exit.
if (e.Args.Length > 0 && e.Args[0].ToLower() == "installplugin")
{
var path = e.Args[1];
if (!File.Exists(path))
{
MessageBox.Show("Plugin " + path + " didn't exist");
return;
}
PluginInstaller.Install(path);
Environment.Exit(0);
return;
}
window = new MainWindow();
if (e.Args.Length == 0 || e.Args[0].ToLower() != "hidestart")
{
window.ShowApp();
}
window.ParseArgs(e.Args);
}
示例7: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
linkIO = LinkIOImp.Instance;
if (!Directory.Exists(Data.NineFolder))
{
Directory.CreateDirectory(Data.NineFolder);
}
currentWindow = new MainWindow();
#if START_ON_MAINPAGE
// Connect user as a Teacher
new UserConnection().Connection.Execute(0);
// If a Lesson exists, go to MainPage
var nineFiles = Directory.GetFiles(Data.NineFolder.ToString(), "*.nine", SearchOption.AllDirectories);
if (nineFiles.Length > 0)
{
FileStream serializedLesson = new FileStream(nineFiles[0], FileMode.Open);
Data.Instance.Lesson = (Lessons.Lesson)(new BinaryFormatter()).Deserialize(serializedLesson);
serializedLesson.Close();
Catalog.Instance.NavigateTo("MainPage");
}
// Else go to HomePage (to create a Lesson)
else
{
Catalog.Instance.NavigateTo("HomePage");
}
#else
Catalog.Instance.NavigateTo("UserConnectionPage");
#endif
currentWindow.Show();
}
示例8: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
Csla.DataPortal.ProxyTypeName = "Csla.DataPortalClient.WcfProxy, Csla";
Csla.DataPortalClient.WcfProxy.DefaultUrl = "http://localhost:3390/ChildGrandChildWeb/WcfPortal.svc";
this.RootVisual = new Page();
}
示例9: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
PlatformService.Instance = this;
Config config = Config.Load();
if(!config.UseWebServices) {
string connectionString = String.Format("Server = {0}; Database = {1}; Uid = {2};",
config.DatabaseServer, config.DatabaseName, config.DatabaseUser);
IDatabase db = null;
try {
db = new MYSQLDatabase(connectionString);
} catch(Exception ex) {
PlatformService.Instance.ShowErrorMessage(
"Could not connect to database '" + connectionString + "'\n\n" + ex.Message,
"Database connection failure");
Environment.Exit(-1);
}
SharedServices.Init(db);
}
else
{
var client = new RestClient(config.WebServiceBase);
SharedServices.Init(client);
}
base.OnStartup(e);
}
示例10: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
string langPath = "/lang/zh.xaml";
App.Current.Resources.MergedDictionaries.Clear();
App.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri(langPath, UriKind.RelativeOrAbsolute) });
}
示例11: App_OnStartup
private void App_OnStartup(object sender, StartupEventArgs e)
{
Updater.Run();
ErrorSelectionWindow = new ErrorSelectionWindow();
ErrorSelectionWindow.Show();
ErrorSelectionWindow.Topmost = true;
}
示例12: OnApplicationStartup
/// <summary>
/// Handles the Startup event of the Application control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.StartupEventArgs"/> instance containing the event data.</param>
private void OnApplicationStartup(object sender, StartupEventArgs e)
{
Catel.Windows.StyleHelper.CreateStyleForwardersForDefaultStyles();
var serviceLocator = ServiceLocator.Default;
serviceLocator.RegisterType<IViewLocator, ViewLocator>();
var viewLocator = serviceLocator.ResolveType<IViewLocator>();
viewLocator.NamingConventions.Add("[UP].Views.[VM]");
viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]");
viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]View");
viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]Window");
viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]");
viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]View");
viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]Window");
serviceLocator.RegisterType<IViewModelLocator, ViewModelLocator>();
var viewModelLocator = serviceLocator.ResolveType<IViewModelLocator>();
viewModelLocator.NamingConventions.Add("Catel.Examples.AdvancedDemo.ViewModels.[VW]ViewModel");
// Register several different external IoC containers for demo purposes
IoCHelper.MefContainer = new CompositionContainer();
IoCHelper.UnityContainer = new UnityContainer();
serviceLocator.RegisterExternalContainer(IoCHelper.MefContainer);
serviceLocator.RegisterExternalContainer(IoCHelper.UnityContainer);
RootVisual = new MainPage();
}
示例13: OnStartup
/// <summary>
/// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
/// </summary>
/// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
protected override void OnStartup(StartupEventArgs e)
{
#if DEBUG
Catel.Logging.LogManager.AddDebugListener(true);
var logPath = Path.Combine(GetType().Assembly.GetDirectory(), "debug.log");
LogManager.AddListener(new FileLogListener(logPath, 25 * 1024));
#endif
//var consoleLogListener = new ConsoleLogListener();
//consoleLogListener.IgnoreCatelLogging = true;
//LogManager.AddListener(consoleLogListener);
Console.WriteLine(typeof(ILicenseService));
StyleHelper.CreateStyleForwardersForDefaultStyles();
var serviceLocator = ServiceLocator.Default;
var languageService = serviceLocator.ResolveType<ILanguageService>();
//languageService.PreferredCulture = new CultureInfo("nl-NL");
//languageService.FallbackCulture = new CultureInfo("en-US");
languageService.PreloadLanguageSources();
base.OnStartup(e);
}
示例14: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
var handle = IntPtr.Zero;
var className = new StringBuilder(1024);
for(;;)
{
handle = WinApi.FindWindowEx(IntPtr.Zero, handle, null, "LyncMsg");
if (handle == IntPtr.Zero)
break;
if (WinApi.GetClassName(handle, className, 1024) <= 0)
continue;
if (className.ToString().IndexOf("[LyncMsg.exe") >= 0)
break;
}
if (handle == IntPtr.Zero)
{
base.OnStartup(e);
return;
}
if (WinApi.IsWindowVisible(handle) && (WinApi.IsIconic(handle) || WinApi.GetForegroundWindow() != handle))
WinApi.SwitchToThisWindow(handle, true);
else
WinApi.ShowWindow(handle, WinApi.WindowShowStyle.SwShow);
Current.Shutdown();
}
示例15: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
try
{
// Deployed applications must be licensed at the Basic level or greater (https://developers.arcgis.com/licensing).
// To enable Basic level functionality set the Client ID property before initializing the ArcGIS Runtime.
// ArcGISRuntimeEnvironment.ClientId = "<Your Client ID>";
// Initialize the ArcGIS Runtime before any components are created.
ArcGISRuntimeEnvironment.Initialize();
// Standard level functionality can be enabled once the ArcGIS Runtime is initialized.
// To enable Standard level functionality you must either:
// 1. Allow the app user to authenticate with ArcGIS Online or Portal for ArcGIS then call the set license method with their license info.
// ArcGISRuntimeEnvironment.License.SetLicense(LicenseInfo object returned from an ArcGIS Portal instance)
// 2. Call the set license method with a license string obtained from Esri Customer Service or your local Esri distributor.
// ArcGISRuntimeEnvironment.License.SetLicense("<Your License String or Strings (extensions) Here>");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "ArcGIS Runtime initialization failed.");
// Exit application
this.Shutdown();
}
}