protected override async Task ExecuteAsync(CommandLineApplication app) { var selectedIndex = 0; if (Verbose) { _logger.LogInformation($"Searching for subtitles using method '{Method}' with argument '{Search}' for language '{Language}'."); } var subtitles = await _apiClient.FindSubtitlesAsync(Method, Search, Language); if (subtitles.Length == 0) { OutputExtensions.WriteError($"No subtitles found."); return; } if (!First) { var consoleList = new ConsoleList("What subtitles do you want to download", subtitles.Select(x => x.SubFileName).ToArray()); selectedIndex = consoleList.ReadResult(); } var selectedSubtitles = subtitles[selectedIndex]; var outputFilePath = BuildOutputFilePath(Output, selectedSubtitles.SubFileName); if (Verbose) { OutputExtensions.WriteVerbose($"Downloading: '{selectedSubtitles.MovieName} ({selectedSubtitles.MovieYear})' to '{outputFilePath}'."); } await _apiClient.DownloadSubtitleAsync(selectedSubtitles, outputFilePath); }
private static void Engine_EngineStart(object sender, EventArgs e) { _rootConsole = new RootConsole(); SadConsole.Engine.ConsoleRenderStack.Add(_rootConsole); System.Console.WriteLine("Welcome to the RL..."); //_rootConsole.Print( 1, 1, "Welcome to SadConsole", Color.Aqua, Color.Black ); }
/// <summary>Connect your console with selected API.</summary> public bool ConnectTarget(int target = 0) { // We'll check again if the instance has been done, else you'll got an exception error. MakeInstanceAPI(GetCurrentAPI()); bool result = false; if (SetAPI.API == SelectAPI.TargetManager) { result = Common.TmApi.ConnectTarget(target); } if (SetAPI.API == SelectAPI.XboxNeighborhood) { result = Common.XboxApi.ConnectTarget(); } if (SetAPI.API == SelectAPI.PCAPI) { result = new ApplicationList(this).Show(); } if (SetAPI.API == SelectAPI.ControlConsole) { result = new ConsoleList(this).Show(); } return(result); }
/// <summary>Connect your console with selected API.</summary> public bool ConnectTarget(int target = 0) { // We'll check again if the instance has been done, else you'll got an exception error. MakeInstanceAPI(); bool result = false; result = new ConsoleList(this).Show(); return(result); }
private void ConsoleWriteLine(string line) { this.Dispatcher.Invoke(new Action(() => { var newLine = new ListBoxItem() { Content = line }; ConsoleList.Items.Add(newLine); ConsoleList.ScrollIntoView(newLine); })); }
private void Initialize() { BackButton = new ConsoleButton("Back"); AddWord = new ConsoleButton("Add new word"); Words = new ConsoleList("Words"); BackButton.OnClick += OnBackButtonClick; OnStart += LanguagePage_OnStart; AddWord.OnClick += AddWord_OnClick; Controls.Add(BackButton); Controls.Add(AddWord); Controls.Add(Words); }
private void Initialize() { Title = "Library Project"; ExitButton = new ConsoleButton("Exit"); SaveData = new ConsoleButton("Save"); Languages = new ConsoleList("Languages"); ExitButton.OnClick += OnExitButtonClick; OnStart += MainMenu_OnStart; SaveData.OnClick += SaveData_OnClick; Controls.Add(ExitButton); Controls.Add(SaveData); Controls.Add(Languages); }
/// <summary>Connect your console with selected API.</summary> public bool ConnectTarget(int target = 0) { // We'll check again if the instance has been done, else you'll got an exception error. MakeInstanceAPI(GetCurrentAPI()); bool result = false; if (SetAPI.API == SelectAPI.TMAPI) { result = Common.TmApi.Connect(target); } else if (SetAPI.API == SelectAPI.CCAPI) { result = new ConsoleList(this).Show(); } return(result); }
private void Initialize() { BackButton = new ConsoleButton("Back"); //AddWord = new ConsoleButton("Add new word"); WordText = new ConsoleLabel($" {Word}"); Translations = new ConsoleList("Translations"); BackButton.OnClick += OnBackButtonClick; OnStart += WordPage_OnStart; //AddWord.OnClick += AddWord_OnClick; //ConsoleButton addNewTranslation = new ConsoleButton(" Add new one"); //addNewTranslation.OnClick += AddNewTranslation_OnClick; //Translations.Elements.Add(addNewTranslation); Controls.Add(BackButton); Controls.Add(WordText); Controls.Add(Translations); //Controls.Add(AddWord); }
/// <summary> /// Worker to fetch all consoles /// </summary> private void getConsolesWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { StatusText = "Getting console data."; _watch.Reset(); _watch.Start(); string[] consoles = GetWebRequestResponse(APIFunction.GetConsoleIDs, "").Split(';'); _watch.Stop(); StatusText = "Fetched Console Information, took " + _watch.ElapsedMilliseconds + " milliseconds."; Dispatcher.CurrentDispatcher.Invoke(() => { foreach (string console in consoles) { Console c = JsonConvert.DeserializeObject <Console>(console); _dispatcher.Invoke(new System.Action(() => { ConsoleList.Add(c); })); } }); }
private void Initialize() { BackButton = new ConsoleButton("Back"); AddWord = new ConsoleButton("Add new word"); WordInput = new ConsoleInput("New word"); Translations = new ConsoleList("Translations"); BackButton.OnClick += OnBackButtonClick; OnStart += AddNewWordPage_OnStart; AddWord.OnClick += AddWord_OnClick; ConsoleButton addNewTranslation = new ConsoleButton(" Add new one"); addNewTranslation.OnClick += AddNewTranslation_OnClick; Translations.Elements.Add(addNewTranslation); Controls.Add(BackButton); Controls.Add(WordInput); Controls.Add(Translations); Controls.Add(AddWord); }
public void AnswerBoxCheck(ref Numpre[,] numpre, ref int checknum, ref int timeover) { int countblank, i_out, j_out; bool IsSameNum = false; countblank = 0; i_out = 0; j_out = 0; execbutton[0].PerformClick(); // それぞれのグループの左上だけを指定する for (int i = 0; i <= 6; i += 3) { for (int j = 0; j <= 6; j += 3) { // 指定した位置から順に1行目、2行目、3行目と数値判定を行う for (int k = i; k <= i + 2; k++) { for (int l = j; l <= j + 2; l++) { // checknumの効いていない空白があったら if (numpre[k, l].IsError == true && numpre[k, l].IsValid == false) { // とりあえず覚えておく countblank += 1; i_out = k; j_out = l; } // そのグループに既にchecknumがあったら if (numpre[k, l].Number == checknum) { // そのグループはもう終了 IsSameNum = true; continue; } } } // そのグループにchecknumがまだなく // 空白が一つ、かつその空白のIsValidがfalseであった場合 if (countblank == 1 && IsSameNum == false) { // そのマスにchecknumを入れる numpre[i_out, j_out].Number = checknum; int txtbxi = FindTextBoxIndexFromNumpreIndex(i_out, j_out); if (txtbxi == -1) { ConsoleList.Items.Add("エラー: Numpre[,]配列のインデックスが不正です"); ConsoleList.Update(); return; } else { txtbox[txtbxi].Text = checknum.ToString(); txtbox[txtbxi].Update(); ConsoleList.Items.Add("自動解答: ボックスの消去法により (" + (i_out + 1) + ", " + (j_out + 1) + ") は " + checknum); ConsoleList.Update(); timeover = 0; // で、もう一度最初から試行する AnswerHrizonCheck(ref numpre, ref checknum, ref timeover); } } IsSameNum = false; countblank = 0; } } // 何もせずにループを抜けたら // タイムアウトカウンタを増やす timeover += 1; }
public void AnswerVerticalCheck(ref Numpre[,] numpre, ref int checknum, ref int timeover) { int countblank, i_out, j_out; bool IsSameNum = false; countblank = 0; i_out = 0; j_out = 0; execbutton[0].PerformClick(); for (int i = 0; i <= 8; i++) { for (int j = 0; j <= 8; j++) { // checknumの効いていない空白があったら if (numpre[j, i].IsError == true && numpre[j, i].IsValid == false) { // とりあえず覚えておく countblank += 1; i_out = i; j_out = j; } // その列に既にchecknumがあったら if (numpre[j, i].Number == checknum) { // その列はもう終了 IsSameNum = true; continue; } } // その行で該当する空白がぴったり1個だった場合のみ if (countblank == 1 && IsSameNum == false) { // そのマスにchecknumを入れる numpre[j_out, i_out].Number = checknum; int txtbxi = FindTextBoxIndexFromNumpreIndex(j_out, i_out); if (txtbxi == -1) { ConsoleList.Items.Add("エラー: Numpre[,]配列のインデックスが不正です"); ConsoleList.Update(); return; } else { txtbox[txtbxi].Text = checknum.ToString(); txtbox[txtbxi].Update(); ConsoleList.Items.Add("自動解答: タテの消去法により (" + (j_out + 1) + ", " + (i_out + 1) + ") は " + checknum); ConsoleList.Update(); timeover = 0; // で、もう一度最初から試行する AnswerHrizonCheck(ref numpre, ref checknum, ref timeover); } } IsSameNum = false; countblank = 0; } // 何もせずにループを抜けたら // タイムアウトカウンタを増やす timeover += 1; }