// UWP Version: Get a file:// URI for the test page in app data (can be loaded by Anahaeim) // Ex: file:///C:/Users/<user>/AppData/Local/Packages/MUXControlsTestApp_6f07fta6qpts2/TempState/SimplePage.htm public static Uri GetTestPageUri(string testPageName) { string localAppDataPath = AppDataPaths.GetDefault().LocalAppData; string fullUri = @"file:///" + localAppDataPath + @"/" + testPageName; return(new Uri(fullUri)); }
private static string GetFolderPathCoreCurrent(SpecialFolder folder) { // While all of these give back real paths, most of them are not accessible // from an appcontainer currently (they will give access denied) switch (folder) { case SpecialFolder.ApplicationData: return(UserDataPaths.GetDefault().RoamingAppData); case SpecialFolder.CommonApplicationData: return(AppDataPaths.GetDefault().ProgramData); case SpecialFolder.LocalApplicationData: return(AppDataPaths.GetDefault().LocalAppData); case SpecialFolder.Cookies: return(AppDataPaths.GetDefault().Cookies); case SpecialFolder.Desktop: return(AppDataPaths.GetDefault().Desktop); case SpecialFolder.Favorites: return(AppDataPaths.GetDefault().Favorites); case SpecialFolder.History: return(AppDataPaths.GetDefault().History); case SpecialFolder.InternetCache: return(AppDataPaths.GetDefault().InternetCache); case SpecialFolder.MyMusic: return(UserDataPaths.GetDefault().Music); case SpecialFolder.MyPictures: return(UserDataPaths.GetDefault().Pictures); case SpecialFolder.MyVideos: return(UserDataPaths.GetDefault().Videos); case SpecialFolder.Recent: return(UserDataPaths.GetDefault().Recent); case SpecialFolder.System: return(SystemDataPaths.GetDefault().System); case SpecialFolder.Templates: return(UserDataPaths.GetDefault().Templates); case SpecialFolder.DesktopDirectory: return(UserDataPaths.GetDefault().Desktop); case SpecialFolder.Personal: return(UserDataPaths.GetDefault().Documents); case SpecialFolder.CommonDocuments: return(SystemDataPaths.GetDefault().PublicDocuments); case SpecialFolder.CommonMusic: return(SystemDataPaths.GetDefault().PublicMusic); case SpecialFolder.CommonPictures: return(SystemDataPaths.GetDefault().PublicPictures); case SpecialFolder.CommonDesktopDirectory: return(SystemDataPaths.GetDefault().PublicDesktop); case SpecialFolder.CommonVideos: return(SystemDataPaths.GetDefault().PublicVideos); case SpecialFolder.UserProfile: return(UserDataPaths.GetDefault().Profile); case SpecialFolder.SystemX86: return(SystemDataPaths.GetDefault().SystemX86); case SpecialFolder.Windows: return(SystemDataPaths.GetDefault().Windows); // The following aren't available on WinRT. Our default behavior // is string.Empty for paths that aren't available. // // case SpecialFolder.Programs: // case SpecialFolder.MyComputer: // case SpecialFolder.SendTo: // case SpecialFolder.StartMenu: // case SpecialFolder.Startup: // case SpecialFolder.ProgramFiles: // case SpecialFolder.CommonProgramFiles: // case SpecialFolder.AdminTools: // case SpecialFolder.CDBurning: // case SpecialFolder.CommonAdminTools: // case SpecialFolder.CommonOemLinks: // case SpecialFolder.CommonStartMenu: // case SpecialFolder.CommonPrograms: // case SpecialFolder.CommonStartup: // case SpecialFolder.CommonTemplates: // case SpecialFolder.Fonts: // case SpecialFolder.NetworkShortcuts: // case SpecialFolder.PrinterShortcuts: // case SpecialFolder.CommonProgramFilesX86: // case SpecialFolder.ProgramFilesX86: // case SpecialFolder.Resources: // case SpecialFolder.LocalizedResources: default: return(string.Empty); } }
private void checkout_Button_Click(object sender, RoutedEventArgs e) { string str = (DataContext as MainViewModel).Receipt(); File.WriteAllText($"{AppDataPaths.GetDefault().LocalAppData}\\receipt.txt", str); }