public void CorsEnableAll(Object s, EventArgs e) { HttpApplication app = s as HttpApplication; app.Context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:8080"); app.Context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS"); app.Context.Response.AddHeader("Access-Control-Allow-Headers", "*"); app.Context.Response.AddHeader("Access-Control-Allow-Credentials", "true"); _eventHandler?.Invoke(this, null); }
public void Do() { //MyEvent?.Invoke(); //MyEvent(); handler(); handler?.Invoke(); }
private void BtnDone_Click(object sender, EventArgs e) { ClientID = dh.ClientID(cmbNameSurname.Text, cmbCell.Text, cmbPhoneNumber.Text); double deposit; foreach (Trophee item in lstTrophee) { double mountType = dh.ReturnMountType(dh.SelectAnimalType(item.Animaltype), dh.SelectMountType(item.Mounttype)); dh.Insert(item.Invoicenumber, item.Number, item.Amount, item.Remarks, mountType, item.Total, item.Date, item.Deposit, item.Discount); } int InvoiceNumber = int.Parse(lblInvoice.Text); double credit; deposit = CalculateTotalPrice / 2; double CTotal = dh.GetCredit(ClientID); if (CalculateTotalPrice >= CTotal) { CTotal = CalculateTotalPrice - CTotal; } else { credit = CTotal; credit = CTotal - CalculateTotalPrice; CTotal = 0; dh.UpdateCredit(credit, ClientID); } dh.InsertFaktuur(InvoiceNumber, ClientID, CalculateTotalPrice, CTotal, deposit, txtClientNumber.Text, txtClientName.Text, cmbHandler.Text); this.Close(); MyEventHandler?.Invoke(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); _show += new MyEventHandler(Cat); _show += new MyEventHandler(Dog); _show += new MyEventHandler(Mouse); _show += new MyEventHandler(Mouse); _show.Invoke(); //Aufrufen der drangehängten Methoden //Beispiel 2: Like a WinForm - Button Button b1 = new Button(); b1.KlickEvent += MeineKlickLogik; b1.KlickEvent += Logger; b1.Klick(); //b1.KlickEvent = null; // absolut verboten b1.KlickEvent -= Logger; b1.Klick(); Console.ReadLine(); }
public void Jugar() { Randomizar(); List <Point> nacen = null; List <Point> mueren = null; while (!@stop) { Turno(ref nacen, ref mueren); MyFireUpdater.Invoke(nacen, mueren); System.Threading.Thread.Sleep(10);//1 es el mejor valor aqui xD } }
public DelegateTest() { MyEventHandler myDelegate = new MyEventHandler(SomeFunctions.BuyTicket); myDelegate(); Console.WriteLine("******"); myDelegate += SomeFunctions.BuyDrink; myDelegate(); Console.WriteLine("******"); myDelegate -= SomeFunctions.BuyTicket; myDelegate(); Console.WriteLine("******"); Console.WriteLine(myDelegate.ToString()); Console.WriteLine("******"); myDelegate.Invoke(); }
private void BtnAddUser_Click(object sender, EventArgs e) { double amount; double credit; double cred1; int deposit; amount = double.Parse(txtSurname.Text); dh.MakePayment(dateTimePicker1.Value.Date, publicid, cmbPaymentType.Text, amount); Outstanding = dh.GetOutstanding(publicid); if (chbDeposit.Checked == true) { deposit = 1; MySecondEventHandler?.Invoke(); } else if (chbDeposit.Checked == true && Check1 == 1 || chbDeposit.Checked == false && Check1 == 1) { deposit = 1; } else { deposit = 0; } if (amount > Outstanding) { credit = amount - Outstanding; Outstanding = 0; cred1 = dh.GetCredit(CID); credit = cred1 + credit; dh.UpdateCredit(credit, CID); dh.CalculateOutstanding(publicid, Outstanding, deposit); MyEventHandler?.Invoke(); this.Close(); } else { Outstanding = Outstanding - amount; dh.CalculateOutstanding(publicid, Outstanding, deposit); MyEventHandler?.Invoke(); this.Close(); } }
private void BtnHandleEvenet_Click(object sender, RoutedEventArgs e) { TaskUtil task = new TaskUtil(); uint days; if (uint.TryParse(TxtBoxNumberOfDays.Text, out days)) { if (DateTimePickerStartDate.SelectedDate != null && DateTimePickerStartDate.SelectedDate >= DateTime.Now) { task.StartDate = DateTimePickerStartDate.SelectedDate.Value; task.EndDate = task.StartDate.AddDays(days); } else { MessageBox.Show("Въведи валидна дата"); return; } if (currentMechanic.CanBeAdded(task)) { using (var context = new InsuranceManager.DataAccess.DataContext()) { var mechanic = context.Mechanics.Include(m => m.Tasks).SingleOrDefault(m => m.Id == currentMechanic.Id); var taskDb = new InsuranceManager.Models.Task { StartDate = task.StartDate, EndDate = task.EndDate }; mechanic?.Tasks?.Add(taskDb); context.SaveChanges(); ChangeAccidentProp(); } myEventHandler?.Invoke(); } else { MessageBox.Show("Две събития се препокриват"); return; } } else { MessageBox.Show("Въведи валидна продължителност"); return; } }
private void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { ForegroundWindowChanged?.Invoke(); }