public static void InitMuliLanguage() { //多语言 Xaml.CustomMaps.Add(typeof(TaskbarIcon), TaskbarIcon.ToolTipTextProperty); //中国人大多都会英语,老大大多不会中文。对国际友人好一点,默认显示英语 -。-## LanService.Init(new JsonDB(GetLangaugesFilePath()), true, "en"); }
public MainWindow() { string path = System.IO.Path.Combine(Environment.CurrentDirectory, "Languages"); LanService.Init(new JsonDB(path), true); InitializeComponent(); }
public static async Task Initlize() { //开机启动 #if UWP AutoStartupHelper.Initlize(AutoStartupType.Store, "LiveWallpaper"); #else AutoStartupHelper.Initlize(AutoStartupType.Win32, "LiveWallpaper"); #endif //多语言 Xaml.CustomMaps.Add(typeof(TaskbarIcon), TaskbarIcon.ToolTipTextProperty); //不能用Environment.CurrentDirectory,开机启动目录会出错 ApptEntryDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string path = Path.Combine(ApptEntryDir, "Res\\Languages"); LanService.Init(new JsonDB(path), true, "zh"); //配置相关 var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); AppDataDir = $"{appData}\\LiveWallpaper"; UWPRealAppDataDir = Path.Combine(ApplicationData.Current.LocalCacheFolder.Path, "Roaming\\LiveWallpaper"); SettingPath = $"{AppDataDir}\\Config\\setting.json"; //LocalWallpaperDir = $"{AppDataDir}\\Wallpapers"; //因为uwp store权限问题所以改为 %userprofile%\videos\LivewallpaperCache //string videoDir = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos); //LocalWallpaperDir = $"{videoDir}\\LivewallpaperCache"; AppDataPath = $"{AppDataDir}\\appData.json"; PurchaseDataPath = $"{AppDataDir}\\purchaseData.json"; await CheckDefaultSetting(); //应用程序数据 AppData = await JsonHelper.JsonDeserializeFromFileAsync <AppData>(AppDataPath); if (AppData == null) { AppData = new AppData(); await ApplyAppDataAsync(); } //加载壁纸 await Task.Run(() => { RefreshLocalWallpapers(); //if (AppData.Wallpaper != null) //{ WallpaperManager.MaximizedEvent += WallpaperManager_MaximizedEvent; var current = Wallpapers.FirstOrDefault(m => m.AbsolutePath == AppData.Wallpaper); if (current != null) { WallpaperManager.VideoAspect = Setting.Wallpaper.VideoAspect; WallpaperManager.Show(current); } WallpaperManager.MonitorMaxiemized(true); //} }); }
public static void InitMuliLanguage() { //多语言 Xaml.CustomMaps.Add(typeof(TaskbarIcon), TaskbarIcon.ToolTipTextProperty); //不能用Environment.CurrentDirectory,开机启动目录会出错 ApptEntryDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string path = Path.Combine(ApptEntryDir, "Res\\Languages"); LanService.Init(new JsonDB(path), true, "zh"); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; string path = Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "Languages"); LanService.Init(new JsonDB(path), true); }
public App() { //异常捕获 AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; //多语言初始化 string appDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string path = Path.Combine(appDir, "Assets\\Languages"); LanService.Init(new JsonDB(path), true, "zh"); //mvvm初始化 IocContainer container = new IocContainer(); container .Singleton <LocalServer>() .Singleton <WallpapersViewModel>() .Singleton <SettingViewModel>() .Singleton <AppMenuViewModel>(); Inputs = GetInputs(); AppManager appManager = new AppManager(); if (Inputs.ContainsKey("wallpaper")) { string saveDir = Inputs["wallpaper"]; SetSaveDir(appManager, saveDir); } container.Instance(appManager); EasyManager.Initialize(container, new StoreNavigator()); EasyManager.Associate <WallpapersView, WallpapersViewModel>(); EasyManager.Associate <SettingView, SettingViewModel>(); }
static JsonWindow() { string path = System.IO.Path.Combine(Environment.CurrentDirectory, "Data\\Languages"); LanService.Init(new JsonDB(path), true); }