public void performwindowchanges() { Task<bool> t = Task.Run(async () => { string authUrl ="url"; string data = await NetworkUtility.GetInstance().GetHttpRequestAsync(authUrl, 1); return true; }); t.ContinueWith(async (t1) => { if (t1.Result) { string status = await Applicationmeth.GetUserDetails(); if (status == "Success") this.Dispatcher.Invoke(() => { InitializeMainwindow();//facing issue in this method }); } }); } Private void InitializeMainwindow() { screenWindow = new ScreenWindowControl(); Application.Current.MainWindow = screenWindow; screenWindow.Show();//HERE IAM GETTING EXCEPTION AS Must create DependencySource on same Thread as the DependencyObject. this.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)