public virtual bool Check() { if (this.VisualsDisplayHistory == null) { throw new CheckFailedException(this.GetType(), typeof(VisualsDisplayHistory)); } if (this.SceneManager == null) { throw new CheckFailedException(this.GetType(), typeof(ISceneManager)); } if (this.Display1 == null) { throw new CheckFailedException(this.GetType(), typeof(IGraphSceneDisplay <IVisual, IVisualEdge>)); } if (this.Display2 == null) { throw new CheckFailedException(this.GetType(), typeof(IGraphSceneDisplay <IVisual, IVisualEdge>)); } if (this.Backend == null) { throw new CheckFailedException(this.GetType() + "needs a Backend"); } Display1.Check(); Display2.Check(); return(true); }
private void Display2_TextChanged(object sender, EventArgs e) { if (autoscroll2) { Display2.SelectionStart = Display2.Text.Length; Display2.ScrollToCaret(); } }
private void Display_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Visible = false; } Display1.SetBounds(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, Display1.Font.Height * 7); Display2.SetBounds(this.ClientRectangle.X, this.ClientRectangle.Y + Display1.Height, this.ClientRectangle.Width, this.ClientRectangle.Height - Display1.Height); }
private void AllBtn_Click(object sender, EventArgs e) { Button btn = sender as Button; // MessageBox.Show(btn.Name); Testing if the buttons have proper name and are used as senders properly switch (btn.Name) { case "BtnDel": if (Display.Text.Length > 0) { Display.Text = Display.Text.Substring(0, Display.Text.Length - 1); //Will delete one character from display } break; case "BtnC": //Will clear op and display C = clear op = ""; Display.ResetText(); Display2.ResetText(); break; case "BtnCE": //Will clear display CE = Clear Entry Display.ResetText(); break; case "BtnPoint": //Decimal if (!Display.Text.Contains(".")) //case there already is { Display.Text += "."; } break; case "BtnNegate": if (Display.Text.Length > 0) { if (!Display.Text.Contains("-")) //if it's positive it will a minus at end { Display.Text = "-" + Display.Text; } else if (Display.Text.Contains("-")) //if it's negative will remove the minus { Display.Text = Display.Text.Substring(1, Display.Text.Length - 1); } } break; default: if (op == "=") { op = ""; Display.ResetText(); } Display.Text += btn.Text; // adds stuff on display break; } }
private void Clear() { VisualsDisplayHistory?.Clear(); SceneManager?.Clear(); ContentViewManager.Clear(); Display1.Clear(); Display2.Clear(); }
private void DisplayText2(object sender, EventArgs e) { if (type2.SelectedIndex == 0) { Display2.AppendText(RxString2); } else if (type2.SelectedIndex == 1) { Display2.AppendText(DecWrite2()); } else { Display2.AppendText(HexWrite2()); } }
public override void Dispose() { Clear(); if (_contentViewManager != null) { this.ContentViewManager.Dispose(); } Mesh.RemoveDisplay(Display1); Mesh.RemoveDisplay(Display2); Display1.Dispose(); Display1 = null; Display2.Dispose(); Display2 = null; }
public Display() { InitializeComponent(); this.Text = "Dictionary Server"; Display1.SetBounds(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, ClientRectangle.Height * 1 / 3); Display2.SetBounds(this.ClientRectangle.X, this.ClientRectangle.Y + Display1.Height, this.ClientRectangle.Width, this.ClientRectangle.Height - Display1.Height); UpdateTimer.Interval = 1000; UpdateTimer.Tick += new EventHandler(UpdateDisplay); UpdateTimer.Tag = 0; UpdateTimer.Start(); ThreadPool.QueueUserWorkItem(delegate { Program.Init(); }, null); ThreadPool.QueueUserWorkItem(delegate { Program.WaitForConnections(); }, null); Display1.SetBounds(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, Display1.Font.Height * 7); Display2.SetBounds(this.ClientRectangle.X, this.ClientRectangle.Y + Display1.Height, this.ClientRectangle.Width, this.ClientRectangle.Height - Display1.Height); }
private void initializeDeck() { List <List <int> > intDeck = FileReader.ReadFile(DeckAddress); //Creating Cards and setting them to the decks for (int i = 0; i < intDeck.Count; i++) { Card newCard = new Card(intDeck[i]); if (intDeck[i][1] == 1) { Deck1.Add(newCard); } else if (intDeck[i][1] == 2) { Deck2.Add(newCard); } else if (intDeck[i][1] == 3) { Deck3.Add(newCard); } } //Shuffling Decks ShuffleDecks(); //Turning 4 cards from each deck for (int i = 0; i < 4; i++) { Display1.Add(Deck1[0]); Deck1.RemoveAt(0); Display2.Add(Deck2[0]); Deck2.RemoveAt(0); Display3.Add(Deck3[0]); Deck3.RemoveAt(0); } }
private void button2_Click_1(object sender, EventArgs e) { Display2.Clear(); }
private void clear2_Click(object sender, EventArgs e) { Display2.Clear(); }
public void ClrTypeMappingValueAnnotationTryCreateObjectInstance() { this.InitializeOperationDefinitions(); EdmToClrEvaluator ev = new EdmToClrEvaluator(this.operationDefinitions); var edmModel = this.GetParserResult(ClrTypeMappingTestModelBuilder.ValueAnnotationClassTypeBasicTest(), this.operationDeclarationModel); var value = ev.Evaluate(this.GetValueAnnotations(edmModel, edmModel.FindType("NS1.Person"), "TVDisplay").Single().Value); var isObjectPopulated = true; var isObjectInitialized = true; object createdObjectInstance = null; TryCreateObjectInstance tryCreateObjectInstance = (IEdmStructuredValue edmValue, Type clrType, EdmToClrConverter converter, out object objectInstance, out bool objectInstanceInitialized) => { objectInstance = createdObjectInstance; objectInstanceInitialized = isObjectPopulated; return(isObjectInitialized); }; ev.EdmToClrConverter = new EdmToClrConverter(tryCreateObjectInstance); Assert.IsNull((Display2)ev.EdmToClrConverter.AsClrValue(value, typeof(Display2)), "The returned object should be null."); isObjectPopulated = false; isObjectInitialized = true; ev.EdmToClrConverter = new EdmToClrConverter(tryCreateObjectInstance); Assert.IsNull((Display2)ev.EdmToClrConverter.AsClrValue(value, typeof(Display2)), "The returned object should be null."); isObjectPopulated = true; isObjectInitialized = false; ev.EdmToClrConverter = new EdmToClrConverter(tryCreateObjectInstance); Assert.IsTrue(CompareObjects((Display2)ev.EdmToClrConverter.AsClrValue(value, typeof(Display2)), new Display2() { X = 10, Y = 20, Origin = new Display1() { X = 10, Y = 20 } }), "The returned object has incorrect values."); isObjectPopulated = false; isObjectInitialized = false; ev.EdmToClrConverter = new EdmToClrConverter(tryCreateObjectInstance); Assert.IsTrue(CompareObjects((Display2)ev.EdmToClrConverter.AsClrValue(value, typeof(Display2)), new Display2() { X = 10, Y = 20, Origin = new Display1() { X = 10, Y = 20 } }), "The returned object has incorrect values."); createdObjectInstance = new Display2() { X = 0, Y = 1, Origin = new Display1 { X = 3, Y = 4 } }; isObjectPopulated = true; isObjectInitialized = true; ev.EdmToClrConverter = new EdmToClrConverter(tryCreateObjectInstance); Assert.IsTrue(CompareObjects((Display2)ev.EdmToClrConverter.AsClrValue(value, typeof(Display2)), createdObjectInstance), "The returned object has incorrect values."); ev.EdmToClrConverter = new EdmToClrConverter((IEdmStructuredValue edmValue, Type clrType, EdmToClrConverter converter, out object objectInstance, out bool objectInstanceInitialized) => { if (clrType == typeof(Display2)) { objectInstance = new Display2() { X = 0, Y = 1, Origin = new Display1 { X = 3, Y = 4 } }; objectInstanceInitialized = false; return(true); } else if (clrType == typeof(Display1)) { objectInstance = new Display1 { X = 3, Y = 4 }; objectInstanceInitialized = false; return(true); } else { objectInstance = null; objectInstanceInitialized = false; return(false); } }); Assert.IsTrue(CompareObjects((Display2)ev.EdmToClrConverter.AsClrValue(value, typeof(Display2)), new Display2() { X = 10, Y = 20, Origin = new Display1() { X = 10, Y = 20 } }), "The returned object has incorrect values."); isObjectPopulated = false; isObjectInitialized = true; createdObjectInstance = new DisplayCoordination(); ev.EdmToClrConverter = new EdmToClrConverter(tryCreateObjectInstance); Coordination actual = (Coordination)ev.EdmToClrConverter.AsClrValue(value, typeof(Coordination)); Coordination expected = new Coordination() { X = 10, Y = 20 }; Assert.AreEqual(expected.X, actual.X, "The returned object has incorrect values. X"); Assert.AreEqual(expected.Y, actual.Y, "The returned object has incorrect values. X"); }
private void Operation_Click(object sender, EventArgs e) { Button opr = sender as Button; switch (opr.Text) { case "+": if (Display.Text.Length > 0) { if (op == "" || op == "=") { op = "+"; prevop = op; preveq = Display.Text; Display2.Text = preveq + op; Display.ResetText(); } } else { op = "+"; multi_eq(); //this will do the actual calculations } break; case "-": if (Display.Text.Length > 0) { if (op == "" || op == "=") { op = "-"; prevop = op; preveq = Display.Text; Display2.Text = preveq + op; Display.ResetText(); } } else { op = "-"; multi_eq(); } break; case "÷": if (Display.Text.Length > 0) { if (op == "" || op == "=") { op = "÷"; prevop = op; preveq = Display.Text; Display2.Text = preveq + op; Display.ResetText(); } } else { op = ""; multi_eq(); } break; case "x": if (Display.Text.Length > 0) { if (op == "" || op == "=") { op = "x"; prevop = op; preveq = Display.Text; Display2.Text = preveq + op; Display.ResetText(); } } else { op = "x"; multi_eq(); } break; case "=": if (Display.Text.Length > 0) { op = ""; multi_eq(); Display2.ResetText(); Display.Text = answer.ToString(); } break; } }
private void UpdateDisplay(object sender, EventArgs e) { UpdateTimer.Tag = int.Parse(UpdateTimer.Tag.ToString()) + 1; try { if (!Program.Loading) { if (!File.Exists(Program.userlog) || (!File.ReadAllText(Program.userlog).Contains(DateTime.Now.ToLongDateString()) && DateTime.Now.Hour == 7)) { Program.Init(); File.AppendAllText(Program.userlog, DateTime.Now.ToLongDateString() + Environment.NewLine + Environment.NewLine); while (!Program.IPlistfree) { Thread.Sleep(1); } Program.IPlistfree = false; Program.UserList.Clear(); Program.IPlistfree = true; } if (int.Parse(UpdateTimer.Tag.ToString()) >= 100) { UpdateTimer.Tag = 0; while (!Program.IPlistfree) { Thread.Sleep(1); } Program.IPlistfree = false; List <string> temp1 = Program.RecentIPList.ToList(); List <string> temp2 = Program.BanList.ToList(); Program.IPlistfree = true; foreach (string item in temp1) { if (!temp2.Contains(item) && temp1.Count(x => x == item) >= 100) { Program.BanList.Add(item); //Credentials stored separately on a local machine for obvious reasons. string email = File.ReadAllText(@"C:\Users\alexf\Google Drive\Computer\Documents\emailcredentials.txt").Split('\t')[0]; string password = File.ReadAllText(@"C:\Users\alexf\Google Drive\Computer\Documents\emailcredentials.txt").Split('\t')[1]; SmtpClient client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential(email, password), EnableSsl = true }; MailMessage message = new MailMessage(email, email); message.Subject = "Scraping Attempt Detected"; message.Body = "IP: " + item + Environment.NewLine + "Blocked"; client.SendAsync(message, null); } } while (!Program.IPlistfree) { Thread.Sleep(1); } Program.IPlistfree = false; Program.RecentIPList.Clear(); Program.IPlistfree = true; } Display1.Clear(); Display1.AppendText("Server Version: " + Program.version + Environment.NewLine); Display1.AppendText("Server URL: " + "http://" + Program.OwnIPAddress + ":" + Program.Port + "/" + Environment.NewLine); TimeSpan uptime = DateTime.Now.Subtract(Program.starttime); Display1.AppendText("Server Uptime: " + (uptime.Days == 1 ? uptime.Days + " day " : (uptime.Days > 1 ? uptime.Days + " days " : "")) + (uptime.Hours == 1 ? uptime.Hours + " hour " : (uptime.Hours > 1 ? uptime.Hours + " hours " : "")) + (uptime.Minutes == 1 ? uptime.Minutes + " minute " : (uptime.Minutes > 1 ? uptime.Minutes + " minutes " : "")) + (uptime.Seconds == 1 ? uptime.Seconds + " second " : (uptime.Seconds > 1 ? uptime.Seconds + " seconds " : "")) + Environment.NewLine); Display1.AppendText("Total Connections: " + Program.totalconnections + Environment.NewLine); Display1.AppendText("Unique Connections: " + Program.uniqueconnections + Environment.NewLine); Display1.AppendText("Waiting for connections..."); while (!Program.IPlistfree) { Thread.Sleep(1); } Program.IPlistfree = false; foreach (string line in Program.UserList.ToList()) { if (Display2.Lines.Contains(line)) { continue; } Display2.SelectionStart = 0; Display2.SelectionLength = 0; Display2.SelectedText = (line + '\n'); Display2.Update(); } Program.IPlistfree = true; } } catch { } }