Answer the question
In order to leave comments, you need to log in
Why isn't InitializeComponent running?
Good afternoon.
Develop an application that works with conditional files. And you need to open files of some resolution by double click. So far I decided to do it without entries in the register, but simply through opening with the help and specifying the path to the file.
App.xaml.cs code:
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
if (e.Args.Length != 0)
{
Uri uri = new Uri(e.Args[0]);
this.Properties["ArbitraryArgName"] = uri.LocalPath;
ASKD.MainWindow window = new ASKD.MainWindow();
window.Show();
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => { // запустится когда все дети загрузятся
if (Application.Current.Properties["ArbitraryArgName"] != null)
{
CurrentPath = Application.Current.Properties["ArbitraryArgName"].ToString();
if (File.Exists(CurrentPath))
{
//делаю всякое
}
}
}));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question