public override bool Equals(Object obj) { // Check for null values and compare run-time types. if (obj == null || GetType() != obj.GetType()) { return(false); } Resolucao res = (Resolucao)obj; return(Value.Equals(res.Value)); }
public ActionResult EnviarParaCorrecao(int idResolucao) { var resolucao = new Resolucao { Id = idResolucao, IdAluno = Convert.ToInt32(User.Identity.Name) }; using (var client = new WebClient()) { client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); try { client.UploadString(APIUrl.EnviarTarefaParaCorrecao(), "PUT", JsonConvert.SerializeObject(resolucao)); return(RedirectToAction("Index")); } catch (WebException ex) { ModelState.AddModelError(string.Empty, ex.Message); return(RedirectToAction("Index")); } } }
private void GuyGame_Shown(Object sender, EventArgs e) { //CHECK IF QRES AND GAME WAS FOUND bool filesOk = true; string errors = ""; if (!File.Exists(game.StartInfo.FileName)) { errors += "Game not found.\n"; filesOk = false; } if (!File.Exists(proc.StartInfo.FileName)) { errors += "Process not found.\n"; filesOk = false; } if (!filesOk) { errors += "\nERROR: Missing files to run the game, try to reinstall!\n"; MessageBox.Show(errors, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); return; } //GET THE CURRENT WIDTH AND HEIGHT IN PIXELS AND SAVE proc.StartInfo.Arguments = currentArgument; startQres(saveResolution); //FILE, GET LAST SELECTED RESOLUTION string lastRes = ""; Resolucao lastResObj = null; try { lastRes = File.ReadAllText(resFileName); } catch (Exception) { //fileNotFound } //GET THE AVAILABLE MODES OS WIDHT AN HEIGHT proc.StartInfo.Arguments = listArgument; startQres(addResolutionsArray); for (int i = 0; i < resolutionsX.Count; i++) { string val = resolutionsX[i] + "x" + resolutionsY[i]; string text = val; //check current resolution with list if (val.Equals(currX + "x" + currY)) { text += " (current)"; } Resolucao res = new Resolucao(i, val, text); if (resolutionsXY.FindIndex(res.Equals) < 0) { int x = -1; int y = -1; Int32.TryParse(resolutionsX[i], out x); Int32.TryParse(resolutionsY[i], out y); if (x >= MIN_WIDTH && y >= MIN_HEIGHT) { resolutionsXY.Add(res); //save lastSeleted resolution obj if (val.Equals(lastRes)) { lastResObj = res; } } } } resolutionsXY.Reverse(); comboBox1.DataSource = resolutionsXY; comboBox1.DisplayMember = "Text"; comboBox1.ValueMember = "Index"; if (lastResObj != null) { comboBox1.SelectedItem = lastResObj; //set lastSelected resolution } }
public void PainelSim() { Diretorios_Salvar.SalvarDadosTeste(opcoesSelecionadas, Diretorios_Salvar.arquivoOpcoes); Resolucao.MudaResolucao(); Start(); }