public void finish() { try { Logger.info("Main page finish " + ContentFrame == null ? "ContentFrame is null" : ContentFrame.ToString()); //throw new Exception(); if (ContentFrame != null) { Logger.info(ContentFrame.Content == null ? "ContentFrame.content is null" : ContentFrame.Content.ToString()); if (ContentFrame.Content == null) { Logger.info("Ручное перенаправление (contentframe=null)"); STARTING = false; ContentFrame.Content = null; Home home = new Home(); ContentFrame.Content = home; } else if (ContentFrame.Content is Home) { (ContentFrame.Content as Home).finish(); } else if (ContentFrame.Content is CransPage) { (ContentFrame.Content as CransPage).init(); } else { Logger.info("Ручное перенаправление"); STARTING = false; ContentFrame.Navigate(new Uri("/Home", UriKind.Relative)); } } else { Logger.info("ContentFrame null ???"); //throw new Exception("ContentFrame null ??? "); } STARTING = false; } catch (Exception e) { Logger.info("Ошибка в MainPage.finish " + e.ToString() + " " + e.StackTrace); try { Logger.info("Ручное перенаправление"); STARTING = false; ContentFrame.Content = null; Home home = new Home(); ContentFrame.Content = home; //ContentFrame.Navigate(new Uri("/Home", UriKind.Relative)); } catch (Exception ex) { Logger.info("Ошибка при перенаправлении " + ex.ToString()); } } }