public static Page GetPage(ApplicationPages page) { Page result = null; using (_pageLocker.GetUpgradeableReadLock()) { if (!_pages.ContainsKey(page)) { using (_pageLocker.GetWriteLock()) { if (!_pages.ContainsKey(page)) { switch (page) { case ApplicationPages.UserFormPage: _pages[page] = (result = new UserFormPage { DataContext = new UserFormViewModel() }); break; case ApplicationPages.IssuePage: _pages[page] = (result = new IssuePage { DataContext = new IssueViewModel() }); break; case ApplicationPages.TimeOverPage: _pages[page] = (result = new TimeOverPage()); break; case ApplicationPages.ResultPage: _pages[page] = (result = new ResultPage { DataContext = new ResultViewModel() }); break; } } } } else { result = _pages[page]; } } return(result); }
public static Page GetPage(ApplicationPages page) { Page result = null; using (_pageLocker.GetUpgradeableReadLock()) { if (!_pages.ContainsKey(page)) { using (_pageLocker.GetWriteLock()) { if (!_pages.ContainsKey(page)) { switch (page) { case ApplicationPages.UserFormPage: _pages[page] = (result = new UserFormPage {DataContext = new UserFormViewModel()}); break; case ApplicationPages.IssuePage: _pages[page] = (result = new IssuePage {DataContext = new IssueViewModel()}); break; case ApplicationPages.TimeOverPage: _pages[page] = (result = new TimeOverPage()); break; case ApplicationPages.ResultPage: _pages[page] = (result = new ResultPage {DataContext = new ResultViewModel()}); break; } } } } else result = _pages[page]; } return result; }