/// <summary> /// 预置数据读取 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public IList <T> Read <T>() { string filePath = MakeInitDataFilePath(typeof(T)); var instance = FileDbHelper.Read <T>(filePath); return(instance); }
public static WeChatConfig GetWeChatConfig() { var myAppPath = MyAppPath.Resolve(); var appData = myAppPath.AppData; var typeFilePathHelper = TypeFilePathHelper.Resolve(); var filePath = typeFilePathHelper.AutoGuessTypeFilePath(appData, typeof(WeChatConfig)); var fileDbHelper = FileDbHelper.Resolve(); var weChatConfigs = fileDbHelper.Read <WeChatConfig>(filePath); return(weChatConfigs.FirstOrDefault()); }
/// <summary> /// 预置数据保存 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> public void Save <T>(IList <T> list) { string filePath = MakeInitDataFilePath(typeof(T)); FileDbHelper.Save(filePath, list); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _design.ApplyTheme(); Kp2aLog.Log("FileSelect.OnCreate"); Kp2aLog.Log("FileSelect:apptask="+Intent.GetStringExtra("KP2A_APPTASK")); if (Intent.Action == Intent.ActionSend) { AppTask = new SearchUrlTask { UrlToSearchFor = Intent.GetStringExtra(Intent.ExtraText) }; } else { //see PasswordActivity for an explanation if (Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory)) { AppTask = new NullTask(); } else { AppTask = AppTask.GetTaskInOnCreate(savedInstanceState, Intent); } } _dbHelper = App.Kp2a.FileDbHelper; if (ShowRecentFiles()) { _recentMode = true; SetContentView(Resource.Layout.file_selection); _fileSelectButtons = new view.FileSelectButtons(this); ((ListView)FindViewById(Android.Resource.Id.List)).AddFooterView( _fileSelectButtons); } else { SetContentView(Resource.Layout.file_selection_no_recent); _fileSelectButtons = (view.FileSelectButtons)FindViewById(Resource.Id.file_select); #if NoNet ImageView imgView = FindViewById(Resource.Id.imglogo) as ImageView; if (imgView != null) { imgView.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic_keepass2android_nonet)); } #endif } Button openFileButton = (Button)FindViewById(Resource.Id.start_open_file); EventHandler openFileButtonClick = (sender, e) => { Intent intent = new Intent(this, typeof(SelectStorageLocationActivity)); intent.PutExtra(FileStorageSelectionActivity.AllowThirdPartyAppGet, true); intent.PutExtra(FileStorageSelectionActivity.AllowThirdPartyAppSend, false); intent.PutExtra(SelectStorageLocationActivity.ExtraKeyWritableRequirements, (int) SelectStorageLocationActivity.WritableRequirements.WriteDesired); intent.PutExtra(FileStorageSetupDefs.ExtraIsForSave, false); StartActivityForResult(intent, RequestCodeSelectIoc); }; openFileButton.Click += openFileButtonClick; //OPEN URL Button openUrlButton = (Button)FindViewById(Resource.Id.start_open_url); openUrlButton.Visibility = ViewStates.Gone; //EventHandler openUrlButtonClick = (sender, e) => ShowFilenameDialog(true, false, false, "", GetString(Resource.String.enter_filename_details_url), Intents.RequestCodeFileBrowseForOpen); //CREATE NEW Button createNewButton = (Button)FindViewById(Resource.Id.start_create); EventHandler createNewButtonClick = (sender, e) => { //ShowFilenameDialog(false, true, true, Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path), "", Intents.RequestCodeFileBrowseForCreate) Intent i = new Intent(this, typeof (CreateDatabaseActivity)); this.AppTask.ToIntent(i); StartActivityForResult(i, 0); }; createNewButton.Click += createNewButtonClick; /*//CREATE + IMPORT Button createImportButton = (Button)FindViewById(Resource.Id.start_create_import); createImportButton.Click += (object sender, EventArgs e) => { openButton.Visibility = ViewStates.Gone; createButton.Visibility = ViewStates.Visible; enterFilenameDetails.Text = GetString(Resource.String.enter_filename_details_create_import); enterFilenameDetails.Visibility = enterFilenameDetails.Text == "" ? ViewStates.Gone : ViewStates.Visible; // Set the initial value of the filename EditText filename = (EditText)FindViewById(Resource.Id.file_filename); filename.Text = Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path); };*/ FillData(); RegisterForContextMenu(ListView); if (savedInstanceState != null) { AppTask = AppTask.CreateFromBundle(savedInstanceState); _recentMode = savedInstanceState.GetBoolean(BundleKeyRecentMode, _recentMode); } }