private void testNewIP(string newIP) { BBServerConnection newServer = new BBServerConnection(newIP, 3000); if (newServer.Test()) { form.server.ip = this.ip.Text; Properties.Settings.Default.lastIP = form.server.ip; } else MessageBox.Show("Server is not connected. Try again later", "Change IP failed"); }
public MainForm() { this.Text = "Blotto Beats"; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MouseDown += this.mouseDown; this.MouseUp += this.mouseUp; this.MouseWheel += this.mouseWheel; this.Paint += this.paint; this.DoubleBuffered = true; this.BackColor = Color.Turquoise; this.TransparencyKey = Color.Turquoise; this.TopMost = Properties.Settings.Default.alwaysOnTop; size = 80; buttons = new List<Button>(); settings = new List<Setting>(); dragging = false; playing = false; progress = 0; score = 0; settingsDropped = false; songLen = 0; songPos = -1; backlog = new List<SongParameters>(); genres = new String[] { null, "Generic", "Classical", "Twelve-tone", "Jazz", "4-Chord Pop/Rock", null }; redditSongs = new List<SongParameters>[genres.Length]; redditThreads = new Thread[genres.Length]; for (int i = 0; i < redditSongs.Length; i++) { redditSongs[i] = new List<SongParameters>(); redditThreads[i] = new Thread(() => refreshReddit(i)); } generator = new Generator(); server = new BBServerConnection(Properties.Settings.Default.lastIP, 3000); player = new MediaPlayer.MediaPlayer(); curGenre = 0; timer = new System.Windows.Forms.Timer(); timer.Interval = 10; timer.Tick += this.tick; origPlayImg = new Bitmap("images/play.png"); origPauseImg = new Bitmap("images/pause.png"); origBackImg = new Bitmap("images/back.png"); origNextImg = new Bitmap("images/next.png"); origUpvoteImg = new Bitmap("images/upvote.png"); origDownvoteImg = new Bitmap("images/downvote.png"); origRedditImg = new Bitmap("images/reddit.png"); origSettingsImg = new Bitmap("images/settings.png"); origAdvSettingsImg = new Bitmap("images/advsettings.png"); origExportImg = new Bitmap("images/export.png"); lightColor = new SolidBrush(Properties.Settings.Default.lightColor); medColor = new SolidBrush(Properties.Settings.Default.medColor); darkColor = new SolidBrush(Properties.Settings.Default.darkColor); sliderColor = new SolidBrush(Properties.Settings.Default.sliderColor); downvoteColor = new SolidBrush(Properties.Settings.Default.downvoteColor); upvoteColor = new SolidBrush(Properties.Settings.Default.upvoteColor); textColor = new SolidBrush(Properties.Settings.Default.textColor); lightInline = new Pen(lightColor); lightInline.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; lightOutline = new Pen(lightColor); lightOutline.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; genre = new DropDownSetting(0, "Genre", this, new string[] { "Generic", "Classical", "Twelve-tone", "Jazz", "4-Chord Pop/Rock" }, size); tempo = new TextBoxSetting(1, "Tempo", this, 60, 200, size); seed = new TextBoxSetting(2, "Seed", this, int.MinValue, int.MaxValue, size); settings.Add(genre); settings.Add(tempo); settings.Add(seed); foreach (Setting setting in settings) setting.setVisible(settingsDropped); initButtons(); settingsForm = new AdvancedSettings(this); accountForm = new AccountManagement(this); if (Properties.Settings.Default.username == "null") accountForm.ShowDialog(); else new Thread(() => startUp()).Start(); }