// Downloads and saves all new images. public void DownloadImages(string subReddits) { if (!downloading) { InfoLabel.Text = "Getting new images..."; downloading = true; var process = Task.Factory.StartNew(() => { try { List <string> posts; if (subReddits.Contains("imgur")) { posts = ir.getImageURLsImgurAlbum(subReddits); } else { posts = ir.getImageURLs(subReddits); }; images = new List <string>(); foreach (string s in posts) { if (!sm.IsImageDownloaded(s)) { if ((s.Contains(".jpg") || s.Contains(".jpeg"))) { images.Add(s); } else if (s.Contains(".png")) { images.Add(s); } } } int counter = 0; InfoLabel.Invoke(new Action(delegate() { InfoLabel.Text = "Starting downloads..."; })); foreach (string s in images) { if ((s.Contains(".jpg") || s.Contains(".jpeg"))) { if (TryToDownload(s, ".jpg")) { counter++; } } else if (s.Contains(".png")) { if (TryToDownload(s, ".png")) { counter++; } } if (currentImage == 0 && counter > 0) { pictureBox1.Invoke(new Action(delegate() { pictureBox1.Image = Image.FromFile(sm.Images[0].LocalPath); })); } InfoLabel.Invoke(new Action(delegate() { InfoLabel.Text = "Completed\n" + counter + " of " + images.Count; })); } } finally { sm.SetLastNumber(counter); InfoLabel.Invoke(new Action(delegate() { InfoLabel.Text = "Done!"; })); downloading = false; } }); } }
public override int GetHashCode() { return(InfoLabel.GetHashCode() ^ InfoKey.GetHashCode()); }
private static void ShowButton(InfoLabel button, string text) { button.gameObject.SetActive(true); button.Text = text; }
private void GameLoop() { VariableClass.CanPlay = true; while (true) { if (VariableClass.BattleCount == 0 && VariableClass.GameReady && VariableClass.OpPlayer.Ready) { MessageBox.Show("Przegrałeś :("); Thread.Sleep(3000); Environment.Exit(0); this.Close(); } byte[] data; try { data = VariableClass.ReceiveAll(VariableClass.Client.Client); } catch { continue; } if (data == null) { continue; } string ret = Encoding.ASCII.GetString(data); Debug.WriteLine(ret); if (ret.CompareTo("ready") == 0 && VariableClass.MePlayer.Ready) { VariableClass.GameReady = true; Debug.WriteLine("Prawda ret==ready"); InfoLabel.Invoke(new Action(() => InfoLabel.Text = "Gra się rozpoczeła")); GenerateOpBoard(); VariableClass.OpPlayer.Ready = true; VariableClass.MyMove = true; InfoLabel.Invoke(new Action(() => InfoLabel.Text = "Twój ruch")); continue; } else { if (ret.CompareTo("ready") == 0 && !VariableClass.MePlayer.Ready) { VariableClass.OpPlayer.Ready = true; VariableClass.MyMove = false; if (InfoLabel.InvokeRequired) { InfoLabel.Invoke(new Action(() => InfoLabel.Text = "Przeciwnik jest juz gotowy")); } else { InfoLabel.Text = "Przeciwnik jest juz gotowy"; } continue; } } string[] rearray = ret.Split(';'); if (rearray.Length == 2) { SendCordInfo(rearray); continue; } if (rearray.Length == 3) { if (rearray[2].CompareTo("hit") == 0) { VariableClass.OpPlayer.Board[Int32.Parse(rearray[0]), Int32.Parse(rearray[1])].BattleState = State.Hit; VariableClass.OpPlayer.Board[Int32.Parse(rearray[0]), Int32.Parse(rearray[1])].Button.BackColor = Color.Red; } if (rearray[2].CompareTo("fail") == 0) { VariableClass.OpPlayer.Board[Int32.Parse(rearray[0]), Int32.Parse(rearray[1])].BattleState = State.Empty; VariableClass.OpPlayer.Board[Int32.Parse(rearray[0]), Int32.Parse(rearray[1])].Button.BackColor = Color.Blue; VariableClass.MyMove = false; InfoLabel.Invoke(new Action(() => InfoLabel.Text = "Ruch przeciwnika")); } } } }
void ReleaseDesignerOutlets() { if (BottomView != null) { BottomView.Dispose(); BottomView = null; } if (CancelButton != null) { CancelButton.Dispose(); CancelButton = null; } if (CountryCombobox != null) { CountryCombobox.Dispose(); CountryCombobox = null; } if (CountryLabel != null) { CountryLabel.Dispose(); CountryLabel = null; } if (EmailLabel != null) { EmailLabel.Dispose(); EmailLabel = null; } if (EmailTF != null) { EmailTF.Dispose(); EmailTF = null; } if (InfoLabel != null) { InfoLabel.Dispose(); InfoLabel = null; } if (LogoImageView != null) { LogoImageView.Dispose(); LogoImageView = null; } if (SendButton != null) { SendButton.Dispose(); SendButton = null; } if (ServiceTF != null) { ServiceTF.Dispose(); ServiceTF = null; } if (TopView != null) { TopView.Dispose(); TopView = null; } }
public Form1() { InitializeComponent(); InfoLabel.Hide(); }
/// Method that updates View of login form public void UpdateView(string info, Color color) { InfoLabel.ForeColor = color; InfoLabel.Text = info; InfoLabel.Update(); }
private InfoLabel _InfoLabel; //Label to print info on main form #region Initialization public FormMain() { InitializeComponent(); _InfoLabel = new InfoLabel(lbInfo); }
private void Cargarbutton_MouseUp(object sender, MouseEventArgs e) { InfoLabel.ResetText(); this.Cursor = Cursors.AppStarting; CambiarFondoBoton(sender, e); Stream myStream = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = @Directory.GetCurrentDirectory().ToString() + "\\Tableros"; openFileDialog1.Filter = "All files (*.*)|*.*|xml (*.xml)|*.xml"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; TextBox auxb; Elementos.TableroSudoku tableroAux = tablero; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { if ((myStream = openFileDialog1.OpenFile()) != null) { using (myStream) { InfoLabel.Text = "Cargando tablero."; tablero = new Elementos.TableroSudoku(); tablero.CargarTablero(myStream); myStream.Close(); InfoLabel.Text = "Comprobando..."; WaitSeconds(0.2); tablero.ResolverTablero(); if (tablero.TableroLleno() != true && tablero.ComprobarTablero() != true) { MessageBox.Show("El tablero cargado no se pudo resolver. Seleccione otro tablero."); } else { InfoLabel.Text = "Tablero cargado."; } tablero.LimpiarTablero(); LimpiarTablero(); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { auxb = (TextBox)tableroSudoku.GetControlFromPosition(j, i); if (tablero.BuscarCasilla(i, j).Estatico == true) { auxb.ReadOnly = true; } } } MostrarCasillas(); MostrarFondos(); } } } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } this.Cursor = Cursors.Default; }
public Form1() { InitializeComponent(); TextBox aux; InfoLabel.BackColor = Color.Transparent; this.Controls.Add(tableroSudoku); InfoLabel.ResetText(); this.tableroSudoku.BackColor = System.Drawing.SystemColors.InactiveCaption; this.tableroSudoku.BackgroundImage = Properties.Resources.fondo_tablero; this.tableroSudoku.ColumnCount = 9; this.tableroSudoku.RowCount = 9; this.tableroSudoku.Padding = new Padding(6, 9, 6, 5); this.tableroSudoku.Location = new Point(32, 32); this.tableroSudoku.AutoSize = true; this.tableroSudoku.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { aux = new System.Windows.Forms.TextBox(); //this.Controls.Add(aux); this.tableroSudoku.Controls.Add(aux, j, i); aux.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; aux.Font = new System.Drawing.Font("Calibri", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); if (j % 3 == 2 && i % 3 != 2) { aux.Margin = new Padding(2, 2, 4, 2); } else if (j % 3 == 0 && i % 3 != 2) { aux.Margin = new Padding(4, 2, 2, 2); } else if (j % 3 == 2 && i % 3 == 2) { aux.Margin = new Padding(2, 2, 4, 6); } else if (j % 3 == 0 && i % 3 == 2) { aux.Margin = new Padding(4, 2, 2, 6); } else if (i % 3 == 2) { aux.Margin = new Padding(2, 2, 2, 6); } else { aux.Margin = new System.Windows.Forms.Padding(2); } aux.MaxLength = 1; aux.Name = "textBox" + i.ToString() + j.ToString(); aux.Size = new System.Drawing.Size(37, 37); aux.TabIndex = 35; aux.Location = new Point(50, 50); aux.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; aux.BackColor = Color.Silver; } } tablero = new Elementos.TableroSudoku(); foreach (Control auxc in tableroSudoku.Controls) { auxc.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Tecla_Valida); auxc.MouseClick += new MouseEventHandler(CambiarColorCasillasActual); } }