本文整理汇总了C#中System.App.InitializeComponent方法的典型用法代码示例。如果您正苦于以下问题:C# App.InitializeComponent方法的具体用法?C# App.InitializeComponent怎么用?C# App.InitializeComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.App
的用法示例。
在下文中一共展示了App.InitializeComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
var app = new App { ShutdownMode = ShutdownMode.OnLastWindowClose };
app.InitializeComponent();
var container = new Container(x=> x.AddRegistry<AppRegistry>());
var factory = container.GetInstance<TraderWindowFactory>();
var window = factory.Create(true);
container.Configure(x => x.For<Dispatcher>().Add(window.Dispatcher));
//run start up jobs
var priceUpdater = container.GetInstance<TradePriceUpdateJob>();
window.Show();
app.Resources.Add(SystemParameters.ClientAreaAnimationKey, null);
app.Resources.Add(SystemParameters.MinimizeAnimationKey, null);
app.Resources.Add(SystemParameters.UIEffectsKey, null);
app.Run();
}
示例2: Program1
private Program1()
{
m_app = new App();
//this applies the XAML, e.g. StartupUri, Application.Resources
m_app.InitializeComponent();
}
示例3: Main
static void Main()
{
App app = new App();
//this applies the XAML, e.g. StartupUri, Application.Resources
app.InitializeComponent();
//shows the Window specified by StartupUri
app.Run();
}
示例4: OnStartup
// called on first run.
protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
{
app = new App();
app.InitializeComponent();
MainWindow mainWindow = new MainWindow();
CapturedItemsListController.Create(mainWindow);
app.Run(mainWindow);
return false;
}
示例5: Main
public static void Main()
{
bool onlyInstance;
var mutex = new Mutex(true, "UniqueGBlasonInstance", out onlyInstance);
if (!onlyInstance)
{
return;
}
var app = new App();
app.InitializeComponent();
app.Run();
GC.KeepAlive(mutex);
}
示例6: Main
public static void Main(string[] args)
{
var a = new App();
if (args != null)
{
var info = CreateStartupInfo(args);
if (info != null)
a.Properties["override"] = info;
}
a.InitializeComponent();
a.Run();
}
示例7: Main
public static void Main(string[] args)
{
#if (DEBUG)
args = "want to play minecraft".Split(' ');
#endif
availableGames = ConfigurationManager.AppSettings.AllKeys.Where(x => x.StartsWith("game-")).ToDictionary(x => x.Substring(5).Replace("-", " "), x => ConfigurationManager.AppSettings[x]);
availableWatches = ConfigurationManager.AppSettings.AllKeys.Where(x => x.StartsWith("watch-")).ToDictionary(x => x.Substring(6).Replace("-", " "), x => ConfigurationManager.AppSettings[x]);
int result = 10;
if (ConfigurationManager.AppSettings["required"] != null)
{
int.TryParse(ConfigurationManager.AppSettings["required"], out result);
}
MainWindow.Required = result;
if ((args != null) && (args.Length != 0))
{
string str = string.Join(" ", args).ToLower();
if (str.StartsWith("want to play "))
{
GameName = str.Substring("want to play ".Length);
if (!availableGames.ContainsKey(GameName))
{
Console.WriteLine("I do not know the game: " + str.Substring("want to play ".Length).Replace(" ", "-"));
return;
}
}
else if (str.StartsWith("want to watch "))
{
WatchName = str.Substring("want to watch ".Length);
if (!availableWatches.ContainsKey(WatchName))
{
Console.WriteLine("I do not know the watch: " + str.Substring("want to watch ".Length).Replace(" ", "-"));
return;
}
}
else
{
Console.WriteLine("You must enter: I want to play [GAMENAME]");
Console.WriteLine("You must enter: I want to watch [WATCHNAME]");
return;
}
App app1 = new App();
app1.InitializeComponent();
app1.Run();
}
else
{
Console.WriteLine("Liam, you must enter a game.");
}
}
示例8: Main
public static void Main(string[] args)
{
if (args.Length == 2 && args[0] == "addver")
{
Console.WriteLine("addver");
//var file = @"D:\git-repo\git-hub\RpcLite-chrishaly\src\Aolyn\Aolyn.Data.Npgsql\Properties\AssemblyInfo.cs";
//AddAssemblyVersion(file);
AddAssemblyVersion(args[1]);
return;
}
var app = new App();
app.InitializeComponent();
app.Run();
}
示例9: Main
public static void Main(string[] args)
{
var app = new App { ShutdownMode = ShutdownMode.OnLastWindowClose };
app.InitializeComponent();
var container = new Container(x=> x.AddRegistry<AppRegistry>());
var factory = container.GetInstance<WindowFactory>();
var window = factory.Create();
container.Configure(x => x.For<Dispatcher>().Add(window.Dispatcher));
//run start up jobs
window.Show();
app.Run();
}
示例10: RunApplication
private static void RunApplication(Container container)
{
try
{
var app = new App();
var mainWindow = container.GetInstance<MainWindow>();
// InitializeComponent() must be called, or global resources (those defined in App.xaml) will not be loaded
app.InitializeComponent();
app.Run(mainWindow);
}
catch (Exception ex)
{
//Log the exception and exit
}
}
示例11: Main
static int Main(string[] args)
{
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
int exitCode = 0;
if (args.Length > 0)
{
RunConsole(args);
}
else
{ //normale WPF-Applikationslogik
var app = new App();
app.InitializeComponent();
app.Run();
}
return exitCode;
}
示例12: Main
public static void Main()
{
bool otherEPOSIsNotRunning = false;
AppMutex = new Mutex(false, APPLICATION_NAME, out otherEPOSIsNotRunning);
if (AppMutex.WaitOne(0, false))
{
LoginView loginView = new LoginView();
loginView.ShowDialog();
if (loginView.DialogResult.Equals(true))
{
loginView.Close();
App app = new App();
app.InitializeComponent();
app.Run();
}
}
}
示例13: AppRunner
public AppRunner()
{
appThread = new Thread(delegate()
{
try
{
app = new App();
app.Properties["override"] = info;
app.InitializeComponent();
app.Run();
}
catch (Exception x)
{
capturedException = x;
}
});
appThread.SetApartmentState(ApartmentState.STA);
}
示例14: Main
static void Main()
{
App app = new App
{
ShutdownMode = ShutdownMode.OnExplicitShutdown
};
app.InitializeComponent();
SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext());
Program4a p = new Program4a();
p.ExitRequested += (sender, e) =>
{
app.Shutdown();
};
Task programStart = p.StartAsync();
app.Run();
}
示例15: Main
public static void Main(string[] args)
{
var app = new App { ShutdownMode = ShutdownMode.OnLastWindowClose };
app.InitializeComponent();
var tempWindowToGetDispatcher = new Window();
var container = new Container(x => x.AddRegistry<AppRegistry>());
container.Configure(x => x.For<Dispatcher>().Add(tempWindowToGetDispatcher.Dispatcher));
container.GetInstance<StartupController>();
var factory = container.GetInstance<WindowFactory>();
var window = factory.Create(args);
tempWindowToGetDispatcher.Close();
var layoutServce = container.GetInstance<ILayoutService>();
var appStatePublisher = container.GetInstance<IApplicationStatePublisher>();
app.Exit += (sender, e) => appStatePublisher.Publish(ApplicationState.ShuttingDown);
window.Show();
app.Run();
}