public void ChangeLanguage() { SendData.isJapanese = !SendData.isJapanese; InvalidateOptionsMenu(); for (int i = 0; i < navView.Menu.Size(); i++) { navView.Menu.GetItem(i).SetTitle(Convert.LanguageDic[navView.Menu.GetItem(i).ToString()]); if (i < 2) { navView.Menu.GetItem(2).SubMenu.GetItem(i).SetTitle( Convert.LanguageDic[navView.Menu.GetItem(2).SubMenu.GetItem(i).ToString()]); } } if (SendData.isJapanese) { GetTypeLists.GetJapaneseLists(Assets); SaveController.GetSaveController().SetSavedLanguage("Japanese"); } else { GetTypeLists.GetEnglishLists(Assets); SaveController.GetSaveController().SetSavedLanguage("English"); } var frag = SupportFragmentManager.FindFragmentById(Resource.Id.fragmentContainer); var trans = SupportFragmentManager.BeginTransaction(); trans.Detach(frag).Attach(frag).Commit(); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.action_language: SendData.isJapanese = !SendData.isJapanese; if (SendData.isJapanese) { GetTypeLists.GetJapaneseLists(Assets); SupportActionBar.Title = "防衛"; SaveController.GetSaveController().SetSavedLanguage("Japanese"); } else { GetTypeLists.GetEnglishLists(Assets); SupportActionBar.Title = "Defense"; SaveController.GetSaveController().SetSavedLanguage("English"); } types = allTypes.defenseTypes; Convert.ConvertInsideTypes(leftSide, rightSide); Convert.ConvertTextViews(layouts); break; case Resource.Id.action_help: FragmentTransaction transaction = FragmentManager.BeginTransaction(); DialogHelp dialog = new DialogHelp(); dialog.Show(transaction, "Help"); break; } return(base.OnOptionsItemSelected(item)); }
protected override void OnResume() { base.OnResume(); SendData.SDKNum = (int)Build.VERSION.SdkInt; SaveController.Instance.SetContext(this); ConnectivityManager cm = (ConnectivityManager)GetSystemService(Context.ConnectivityService); if (cm.ActiveNetworkInfo != null) { if (cm.ActiveNetworkInfo.IsConnected) { SendData.isConnected = true; } } if (SaveController.GetSaveController().GetSavedLanguage() == "") { if (Locale.Default.GetDisplayLanguage(Locale.Default) == "Japanese") { SaveController.GetSaveController().SetSavedLanguage("Japanese"); } else { SaveController.GetSaveController().SetSavedLanguage("English"); } } if (SaveController.GetSaveController().GetSavedLanguage() == "English") { GetTypeLists.GetEnglishLists(Assets); SendData.isJapanese = false; } else if (SaveController.GetSaveController().GetSavedLanguage() == "Japanese") { GetTypeLists.GetJapaneseLists(Assets); SendData.isJapanese = true; } if (SaveController.GetSaveController().GetSavedHelp() == "" || SaveController.GetSaveController().GetSavedHelp() == "Show") { SendData.showHelp = true; } else { SendData.showHelp = false; } StartActivity(new Intent(Application.Context, typeof(StartActivity))); }