public void Init(WindowID wndId) { bool bContain = LocalDataManager.Instance().m_UIFrame_Dict.ContainsKey(wndId.ToString()); if (!bContain) { ShowFrame(false); Debug.LogWarning(string.Format("该窗口{0}, 还没加入到UIFrame中", wndId.ToString())); return; } dbc.UIFrame frame = LocalDataManager.Instance().m_UIFrame_Dict[wndId.ToString()]; //没有Frame的窗口 if (frame.FrameType == 0) { ShowFrame(false); } //根据窗口类型显示不同的排版显示 //type = 1 顶栏显示 ,其他类型暂时没写 else if (frame.FrameType == 1) { //跟上一次的一样直接显示 if (m_LastFrame != null && m_LastFrame.BarContent.Equals(frame.BarContent)) { ShowFrame(true); } else { ShowFrame(GetFrameItemArray(frame)); } } m_LastFrame = frame; }
static void fetchInitData() { LoginApi.InitData().Then(initDataResponse => { var vs = initDataResponse.VS; var serverConfig = initDataResponse.config; if (vs.isNotEmpty()) { HttpManager.updateCookie($"VS={vs}"); } if (serverConfig.tinyGameUrl.isNotEmpty()) { LocalDataManager.saveTinyGameUrl(url: serverConfig.tinyGameUrl); } if (serverConfig.minVersionCode.isNotEmpty()) { if (!int.TryParse(serverConfig.minVersionCode, out var minVersionCode)) { return; } if (minVersionCode > 0 && minVersionCode > Config.versionCode) { // need update StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.ForceUpdate }); VersionManager.saveMinVersionCode(versionCode: minVersionCode); } } }).Catch(exception => { StoreProvider.store.dispatcher.dispatch(new NetworkAvailableStateAction { available = false }); Debuger.LogError(message: exception); }); }
private void LoadLocalData() { var data = LocalDataManager.Load(); if (data == null) { InitializeCategoryList(); this.ShoppingCartProducts = new List <string>(); this.Notifications = true; this.SelectedLocations = new List <Location>(); return; } foreach (var category in data.Categories) { category.Skip = 0; } this.CategoryList = new ObservableCollection <ProductCategory>(data.Categories); this.ShoppingCartProducts = data.ShoppingCartProducts; this.Notifications = data.Notifications; if (data.SelectedLocations != null) { this.SelectedLocations = data.SelectedLocations; } }
Widget _buildContent() { return(new Flexible( child: new Container( color: CColors.Background, child: new ListView( physics: new AlwaysScrollableScrollPhysics(), children: new List <Widget> { this.widget.viewModel.hasReviewUrl || this.widget.viewModel.anonymous ? _buildGapView() : new Container(), this.widget.viewModel.hasReviewUrl ? _buildCellView("评分", () => { AnalyticsManager.ClickSetGrade(); this.widget.actionModel.openUrl(obj: this.widget.viewModel.reviewUrl); }) : new Container(), this.widget.viewModel.anonymous ? _buildCellView("绑定 Unity ID", () => this.widget.actionModel.mainRouterPushTo(MainNavigatorRoutes.BindUnity)) : new Container(), _buildGapView(), _buildCellView("检查更新", () => { AnalyticsManager.ClickCheckUpdate(); VersionManager.checkForUpdates(CheckVersionType.setting); }), _buildGapView(), _buildCellView("清理缓存", () => { AnalyticsManager.ClickClearCache(); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog( message: "正在清理缓存" ) ); this.widget.actionModel.clearCache(); Window.instance.run(TimeSpan.FromSeconds(1), () => { CustomDialogUtils.hiddenCustomDialog(); CustomDialogUtils.showToast("缓存已清除", Icons.check_circle_outline); } ); }), _buildGapView(), _switchRow( CCommonUtils.isIPhone ? "帧率监测" : "帧率监测 (暂仅支持 TinyGame)", value: this.fpsLabelIsOpen, value => { LocalDataManager.setFPSLabelStatus(isOpen: value); this.fpsLabelIsOpen = value; this.setState(() => {}); FPSLabelPlugin.SwitchFPSLabelShowStatus(isOpen: value); } ), this.widget.viewModel.isLoggedIn ? _buildGapView() : new Container(), this.widget.viewModel.isLoggedIn ? this._buildLogoutBtn() : new Container() } ) ) )); }
async Task LoadUsers() { if (IsBusy) { return; } IsBusy = true; try { Users.Clear(); await Task.Run(() => { var users = new LocalDataManager(App.Password).List <User>(); var items = users.Select(i => new UserItem { Id = i.Id, Name = i.Name, PublicKey = i.PublicKey, Email = i.Email }); Users.ReplaceRange(items); }); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void SaveData() { List <Game> ga = Games.ToList(); LocalDataManager ldm = new LocalDataManager(); ldm.SaveGames(ga); }
public GameLoaderForm() { InitializeComponent(); Closing += OnClosing; folderGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; folderGridView.UserDeletingRow += delegate(object sender, DataGridViewRowCancelEventArgs args) { Game game = args.Row.DataBoundItem as Game; if (game != null && game.Status != GameStatus.Deactivated) { MessageBox.Show("You need to deactivate the game before you can delete it from GameLoader"); args.Cancel = true; } else { LocalDataManager ldm = new LocalDataManager(); ldm.SaveGames(Games.ToList()); } }; Games = new BindingList <Game>(LoadData()); BindingSource source = new BindingSource(Games, null); folderGridView.DataSource = source; LoadConfig(); }
private void BackgroundWorkerScanForGames(object sender, DoWorkEventArgs doWorkEventArgs) { workingProgress = WorkingProgress.ScanningForGames; var ldm = new LocalDataManager(); var cfg = ldm.LoadConfig(); DialogResult result = MessageBox.Show( "This is the first time you are running GameLoader, do you want it to check for installed games?", "Check for games", MessageBoxButtons.YesNo); List <string> fs = cfg.GamesFolders; if (result == DialogResult.Yes) { string[] paths = GameSuggestions.GetGameFolders(); string question = $"I found these paths: {Environment.NewLine}{string.Join(Environment.NewLine, paths)}{Environment.NewLine}Do you want to use them?{Environment.NewLine}You can add other folders to auto-discovery later if you want. "; result = MessageBox.Show(question, "Found paths", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { fs.AddRange(paths.Distinct()); } } ldm.SaveConfig(cfg); SearchFoldersForGames(fs); }
private async Task GetProductsAsync() { ShoppingCartProductList = new ObservableCollection <Product>(); var restService = new Tech4GamingApi(); List <string> toRemove = new List <string>(); foreach (var productId in _app.ShoppingCartProducts) { Product result = await GetProductByIdAsync(restService, productId); Console.WriteLine(result); if (result == null) { Console.WriteLine("Cannot find this product"); toRemove.Add(productId); continue; } this.ShoppingCartProductList.Add(result); } _app.RemoveDeprecatedProductsFromShoppingList(toRemove); UpdateShoppingListItemSource(); LocalDataManager.Save(_app.GetLocalDataToSave()); }
private void Start() { //on recupere le local data manager _localManager = FindObjectOfType <LocalDataManager>(); Repaint(); StartCoroutine(WaitReady()); }
private void OnNotificationSwitched(object sender, EventArgs e) { (Application.Current as App).Notifications = (sender as SwitchCell).On; Console.WriteLine((sender as SwitchCell).On); var data = (Application.Current as App).GetLocalDataToSave(); LocalDataManager.Save(data); }
private void Start() { dataManager = LocalDataManager.instance; _char = dataManager.GetCharacterInfo(dataManager.LocalCharacterID); LocalDataManager.instance.OnCorporationChange += OnCorpChange; dataManager.OnTimeChange += OnTimeChange; }
private void OnDestroy() { AssetDataManager.Instance.ApplyPattern(""); LocalDataManager.Serialize(AssetDataManager.Instance.AssetDatas); EventHandler.DestoryInstance(); AssetDataManager.DestoryInstance(); AssetDatabase.Refresh(); }
public override Widget build(BuildContext context) { return(new StoreConnector <AppState, ArticlesScreenViewModel>( converter: state => new ArticlesScreenViewModel { isLoggedIn = state.loginState.isLoggedIn, feedHasNew = state.articleState.feedHasNew, searchSuggest = state.articleState.searchSuggest, currentTabBarIndex = state.tabBarState.currentTabIndex, nationalDayEnabled = state.serviceConfigState.nationalDayEnabled }, builder: (context1, viewModel, dispatcher) => { var actionModel = new ArticlesScreenActionModel { pushToSearch = () => { dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Search }); AnalyticsManager.ClickEnterSearch("Home_Article"); }, pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Login }), pushToReality = () => { dispatcher.dispatch(new EnterRealityAction()); AnalyticsManager.AnalyticsClickEgg(1); }, pushToGame = () => { if (CCommonUtils.isIPhone) { dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Game }); } else { var url = LocalDataManager.getTinyGameUrl(); if (url.isEmpty() || url.Equals("no_game")) { CustomToast.show(new CustomToastItem( context: context, "暂无游戏", TimeSpan.FromMilliseconds(2000) )); return; } dispatcher.dispatch(new MainNavigatorPushToWebViewAction { url = url, landscape = true, fullscreen = true, showOpenInBrowser = false }); } } }; return new ArticlesScreen(viewModel: viewModel, actionModel: actionModel); } )); }
void InstantiateFish(int id, Vector2 pos, int mem) { FishData data = new FishData();//Masterからロード data = LocalDataManager.LoadFishData(0); GameObject f = Instantiate(_fishBase, pos, Quaternion.identity); f.GetComponent <FishBase>().InitData(data); f.GetComponent <FishBase>().Team = mem; }
/// <summary> /// Initializes the view model object. /// </summary> /// <param name="localDataManager">The LocalDataManager object.</param> /// <param name="navigation">The INavigation object for managing pages.</param> public MainPageViewModel(LocalDataManager localDataManager, INavigation navigation) { _localDataManager = localDataManager; _navigation = navigation; FindRecipesCommand = new Command(OpenSearchPage); IngredientsCommand = new Command(OpenIngredientsPage); RecipeBookCommand = new Command(OpenRecipeBookPage); PremiumPopupCommand = new Command(OpenUpgradeToPremiumPopup); }
void Awake() { //chercher si il existe des données ou si on est en mode simulation LocalDataManager lm = FindObjectOfType <LocalDataManager>(); if (null == lm) { StartSim(); } }
public RecipeListView( Task <List <Recipe> > loadTask, LocalDataManager localDataManager, string titleString, string noResultsString, bool containsSavedItems = false) { InitializeComponent(); BindingContext = new RecipeListViewModel(loadTask, localDataManager, Navigation, titleString, noResultsString, containsSavedItems); }
/// <summary> /// Initializes the ViewModel object. /// </summary> /// <param name="recipe">The recipe to be displayed.</param> /// <param name="localDataManager">The LocalDataManager object for marking recipes as saved.</param> public RecipeViewModel(Recipe recipe, LocalDataManager localDataManager) { _recipe = recipe; _localDataManager = localDataManager; OpenInBrowserCommand = new Command(OpenInBrowser); SaveCommand = new Command(ToggleSaved); PrepareCommand = new Command(OpenPremiumPopup); CheckIngredients(); }
private void resetApplicationStateToolStripMenuItem_Click(object sender, EventArgs e) { var dialogResult = MessageBox.Show("Are you sure you want to reset the application state? If you have any games currently loaded, you will have to reset them manually. ", "Reset application state", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { LocalDataManager.ResetApplication(); SetupGamesView(); LoadConfig(); } }
public ReadPage() { InitializeComponent(); try { var json = Uri.UnescapeDataString(new Uri(App.UriData).Query.Replace("?data=", string.Empty)); var message = JsonConvert.DeserializeObject <KriptalMessage>(json); var aes = new AesCrypto(); var rsa = new RsaCrypto(); var localDataManager = new LocalDataManager(App.Password); var privateKey = localDataManager.GetPrivateKey(); var textAesKey = rsa.DecryptWithPrivate(message.TextAesKey, privateKey); var textAesIv = rsa.DecryptWithPrivate(message.TextAesIv, privateKey); var text = aes.Decrypt(message.TextData, textAesKey, Convert.FromBase64String(textAesIv)); MessageText = text; if (!string.IsNullOrEmpty(message.BlockchainStampUrl)) { var blockchainUrl = rsa.DecryptWithPrivate(message.BlockchainStampUrl, privateKey); BlockchainReciptUrl = blockchainUrl; } if (message.FileName != string.Empty) { FileName = rsa.DecryptWithPrivate(message.FileName, privateKey); var fileAesKey = rsa.DecryptWithPrivate(message.FileAesKey, privateKey); var fileAesIv = rsa.DecryptWithPrivate(message.FileAesIv, privateKey); FileData = aes.Decrypt(message.FileData, fileAesKey, Convert.FromBase64String(fileAesIv)); HasAttachment = true; } else { HasAttachment = false; } var fromId = rsa.DecryptWithPrivate(message.FromId, privateKey); var user = localDataManager.Get <User>(u => u.Id == fromId); UserName = user.Name; App.UriData = string.Empty; BindingContext = this; } catch { DisplayAlert(AppResources.Title, AppResources.CantRead, AppResources.OK); } }
public void open() { sortType = LocalDataManager.getInvenSortType(invenType); cbSortType.value = !LocalDataManager.isInvenSortDirectionHigh(invenType); for (int i = 0; i < buttons.Length; ++i) { buttons[i].value = (buttons[i].name == sortType); buttons[i].collider.enabled = (buttons[i].name != sortType); } gameObject.SetActive(true); }
public void DeleteQuestionFromDatabase(string dataBaseName, string questionQuestionName) { QuestionDataBase dataBase = QuestionDataBases.Find(database => database.Name == dataBaseName); Question question = dataBase.Questions.First(q => q.QuestionName == questionQuestionName); int index = QuestionDataBaseNames.FindIndex(name => name == dataBase.Name); if (question != null) { LocalDataManager.DeleteQuestion(dataBase, question); PlayerPrefsManager.DeleteQuestionState(index, question); dataBase.Questions.Remove(question); } }
static int SaveData(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LocalDataManager obj = (LocalDataManager)ToLua.CheckObject <LocalDataManager>(L, 1); obj.SaveData(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void SetManager(LocalDataManager manager) { if (null != _manager) { _manager.OnNewShip -= OnNewShip; _manager.OnRemoveShip -= OnRemoveShip; } _manager = manager; if (null != _manager) { _manager.OnNewShip += OnNewShip; _manager.OnRemoveShip += OnRemoveShip; } }
private void LoadCacheContents() { if (cacheContents != null) { return; } var cacheData = LocalDataManager.Get <CacheData>(); if (cacheData.files == null) { cacheData.files = new CacheFileData[0]; } cacheContents = cacheData.files.ToDictionary(x => x.Source); }
static int SetString(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); LocalDataManager obj = (LocalDataManager)ToLua.CheckObject <LocalDataManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); obj.SetString(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// Use this for initialization void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } if (clearData) { SetFreshData(); } else { GetData(); } }
static int GetFloat(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); LocalDataManager obj = (LocalDataManager)ToLua.CheckObject <LocalDataManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); float o = obj.GetFloat(arg0, arg1); LuaDLL.lua_pushnumber(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// Initializes the RecipeListViewModel object. /// </summary> /// <param name="loadTask">The task to load the list of recipes to display.</param> /// <param name="localDataManager">The LocalDataManger object.</param> /// <param name="navigation">The INavigation object for managing pages.</param> /// <param name="titleString">The string to be displayed in the navigation bar.</param> /// <param name="noResultsString">The string to display if no recipes are returned.</param> /// <param name="containsSavedItems">Flag for whether the recipe list will contain saved recipe items.</param> public RecipeListViewModel( Task <List <Recipe> > loadTask, LocalDataManager localDataManager, INavigation navigation, string titleString, string noResultsString, bool containsSavedItems) { _localDataManager = localDataManager; _navigation = navigation; _containsSavedItems = containsSavedItems; TitleString = titleString; NoResultsString = noResultsString; OpenRecipeCommand = new Command(OpenRecipe); // Task to wait for recipe list to load, then show the result to the user. Task.Run(async() => { try { UserIngredients = await _localDataManager.GetIngredients(); var result = await loadTask; if (_containsSavedItems) { CalculateMissingIngredients(result); ////result.Sort(ObjectComparisons.SortByRecipeName); result.Sort(ObjectComparisons.SortByMissingIngredients); } RecipeResults = new ObservableCollection <Recipe>(result); SearchHasResults = RecipeResults.Count != 0; } catch (Exception e) { LoadError = true; SearchHasResults = true; // Set to true in order to hide NoResults Label. RecipeResults = new ObservableCollection <Recipe>(); } SearchComplete = true; OnPropertyChanged(nameof(RecipeResults)); }); }