public void Display_view_model() { var vm = new ViewModel { GameScore = 12, GameFinished = true }; var frames = new List<ListViewItem>(); for (var i = 12; i > 0; i--) { var lvm = new ListViewItem(i.ToString()); lvm.SubItems.Add(i.ToString()); lvm.SubItems.Add((i+1).ToString()); lvm.SubItems.Add((i + i + 1).ToString()); frames.Add(lvm); } vm.Frames = frames; var sut = new UI(); sut.Display(vm); sut.ShowDialog(); }
public void Receive_events() { var ui = new UI(); ui.On_Clear += () => MessageBox.Show("clearing requested"); ui.On_Pins += pins => MessageBox.Show(pins.ToString() + " pins submitted"); ui.ShowDialog(); }
public void Drop_number() { var ui = new UI(); ui.Number_dropped += () => MessageBox.Show("Drop number!"); ui.ShowDialog(); }
public void Press_operator() { var ui = new UI(); ui.Operator_pressed += req => { var opnum = (int) req.Item1[0]; ui.Display_result(new Tuple<IEnumerable<int>, int>(new[]{opnum}, req.Item2)); }; ui.ShowDialog(); }
public void Enter_number_and_display_stack() { var ui = new UI(); var list = new List<int>(); ui.Number_entered += n => { list.Add(n); ui.Display_result(new Tuple<IEnumerable<int>, int>(list, n*10)); }; ui.ShowDialog(); }
public void checkVersion() { try { WebClient client = new WebClient(); client.DownloadFile(VersionCheckURL, LocalFile); client.Dispose(); if (File.Exists(LocalFile)) { using (FileStream file = new FileStream("version.txt", FileMode.Open, FileAccess.Read, FileShare.Read)) { using (StreamReader reader = new StreamReader(file)) { onlineVersion = (string)reader.ReadLine().Trim(); reader.Close(); } file.Close(); } //EndofStream localVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(); if (localVersion != onlineVersion) { MessageBox.Show("A different version has been found!\n New Version: " + onlineVersion + "\n Current Version: " + localVersion, "Updater", MessageBoxButtons.OK); DownloadNewLoader(); } else { MessageBox.Show("Loader lastest version is already installed.", "Updater", MessageBoxButtons.OK); } } UI ui1 = new UI(); ui1.ShowDialog(); } catch (Exception) { MessageBox.Show("Connection has failed. \n Please try again later.","File Updater"); } }