public ConfigureGameForm(GameDto game, CarouselClient client) { InitializeComponent(); this._CarouselClient = client; this._Game = game; this._Game.Load(); this.ExePathLabel.Text = this._Game.ExePath; _BindingSource = new BindingSource(); _BindingSource.DataSource = this._Game.LocalFiles; this.GameFileDataTable.DataSource = _BindingSource; if (this.GameFileDataTable.RowCount >= 1) { for (int i = GameFileDataTable.ColumnCount - 1; i >= 0; i--) { if (i == GameFileDataTable.ColumnCount - 1) { GameFileDataTable.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } else { GameFileDataTable.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; } } } }
internal async Task Initialize() { try { // var worker = new ProgressWorker(); // await worker.Run((cts) => // { var cts = new CancellationTokenSource(); _Client = CarouselClient.CreateInstance(cts, () => { var prompt = new TextPrompt("Please enter your Google username"); prompt.ShowDialog(); return(prompt.TextResult); }).Result; // }); } catch (Exception) { MessageBox.Show("Error authorizing Google Drive API. Please check configuration files."); return; } using (var cts = new CancellationTokenSource()) { this.GamesListBox.DataSource = _Client.GetGamesList(); } }
/// <summary> /// uploads game's local files to remote directory /// </summary> /// <param name="client">carousel client</param> public async Task UploadLocalFiles(CarouselClient client) { client.UploadFiles(this.LocalFiles, this.Id); }
/// <summary> /// downloads each remote game file to its respective local path /// </summary> /// <param name="client">carousel client</param> private void DownloadRemoteFiles(CarouselClient client) { client.DownloadFiles(this.LocalFiles); }
/// <summary> /// backs up local and downloads remote files /// </summary> /// <param name="client">carousel client</param> public void SetupGame(CarouselClient client) { BackupLocalFiles(); DownloadRemoteFiles(client); }
public SettingsForm(CarouselClient client) { InitializeComponent(); _CarouselClient = client; }