private void btn_CalcularTransformador_Click(object sender, EventArgs e) { double Pr; Double Vp, Vs; Pr = Convert.ToDouble(tb_Potencia.Text) * 0.8; Vp = Convert.ToDouble(tb_Vp.Text); Vs = Convert.ToDouble(tb_Vs.Text); calculobobina bobina1 = new calculobobina(Vp, Vs, Pr); bobina1.Corriente_primaria(); bobina1.Corriente_secundaria(); bobina1.Seccion_nucle(); bobina1.Numero_espiras_primaria(); bobina1.Numero_espiras_secundaria(); bobina1.Numero_Alambre_Primario(); bobina1.Numero_Alambre_Secundario(); lb_NoEspirasPrimaria.Text = bobina1.Np.ToString(); lb_NoEspirasSecundaria.Text = bobina1.Ns.ToString(); lb_NoAlambrePrimario.Text = bobina1.Num_A_P.ToString(); lb_NoAlambreSecundario.Text = bobina1.Num_A_S.ToString(); lb_PotenciaReal.Text = Pr.ToString(); }
public async Task <ActionResult <Pr> > PostPr(Pr pr) { _context.Pr.Add(pr); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPr", new { id = pr.ID }, pr)); }
public async Task <IActionResult> PutPr(int id, Pr pr) { if (id != pr.ID) { return(BadRequest()); } _context.Entry(pr).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public string print([FromBody] Pr pStr) { // if (string.IsNullOrEmpty(pStr)) // return null;//new Status(-1, "Невірні вхідні дані"); string output = JsonConvert.SerializeObject(pStr); return(http.RequestAsync("http://znp.vopak.local:8088/Print", HttpMethod.Post, output, 5000, "application/json")); }
private void listBox_Products_MouseDoubleClick(object sender, MouseEventArgs e) { if (listBox_Products.SelectedItem != null) { Product P = BoughtProducts[listBox_Products.SelectedIndex]; foreach (Product Pr in listOfProducts) { if (Pr.ProductID == P.ProductID) { Pr.IncreaseQuantity(P.Quantity); } } listBox_Products.Items.Remove(listBox_Products.SelectedItem); BoughtProducts.Remove(P); } }
private void button3_Click(object sender, EventArgs e) { if (presetBox.SelectedIndex >= 0) { string selectedPreset = presetBox.SelectedItem.ToString(); string selectedPresetName = selectedPreset.Split('|')[0].Trim(); PresetClass prclass = new PresetClass(); Preset preset = prclass.GetByName(selectedPresetName); Preset p = Pr.GetByName(selectedPresetName); if (!Pr.PresetIsNull(p)) { // Remove the preset file in case it's an user preset! if (Pr.PresetIsNull(preset)) { // It only exists inside the Pr class, which means it's a user element if (MessageBox.Show($"Are you sure you want to remove {selectedPresetName}?", "Remove?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { // Remove it from the list presetBox.Items.RemoveAt(presetBox.SelectedIndex); Pr.Presets.Remove(p); File.Delete(UserPresets); foreach (var pre in Pr.Presets) { if (pre.isUsermade) { // Print to file File.AppendAllText(UserPresets, pre.ToSaveableString()); } } // Remove from file } } else { MessageBox.Show("Can't remove this built in preset!", "Can't remove!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show($"An error occured when trying to remove a preset! Seems like the preset does not exist! ({selectedPresetName})!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btn_RemoveProd_shop_Click(object sender, EventArgs e) { if (listBox_Products.SelectedItem != null) { Product P = BoughtProducts[listBox_Products.SelectedIndex]; foreach (Product Pr in listOfProducts) { if (Pr.ProductID == P.ProductID) { Pr.IncreaseQuantity(P.Quantity); } } listBox_Products.Items.Remove(listBox_Products.SelectedItem); BoughtProducts.Remove(P); } UpdateList(); }
private void btn_Clear_Click(object sender, EventArgs e) { for (int i = 0; i < listBox_Products.Items.Count; i++) { Product P = BoughtProducts[i]; foreach (Product Pr in listOfProducts) { if (Pr.ProductID == P.ProductID) { Pr.IncreaseQuantity(P.Quantity); } } } BoughtProducts = new List <Product>(); listBox_Products.Items.Clear(); UpdateList(); }
/// <summary> /// Starts the Anticheat. /// </summary> public async static void Start(this AnticheatEngine ac) { while (true) { await Task.Delay(1000); if (AntiCheat.PrA != null) { foreach (Process pr in PrA) { Pr.Kill(); } if (AntiCheat.Pr != null) { Pr.Kill(); } } } }
public Complex[] engine(Complex[] input) { Complex [] output = new Complex[input.Length]; for (int i = 0; i < input.Length; i++) { output[i] = new Complex(0, 0); } int groups = 1; int butterflies = (int)Math.Pow(2, stadies - 1); for (int i = 0; i < stadies; i++) //номер стадии { for (int j = 0; j < groups; j++) //номер группы { for (int k = 0; k < butterflies; k++) // номер элемента { int index = butterflies * 2 * j + k; int index1 = index + butterflies; Complex a = input[index]; Complex b = input[index1]; Pr variable = butterfly(a, b, w[k * groups]); input[index] = variable.a; input[index1] = variable.b; } } groups *= 2; butterflies /= 2; } for (int i = 0; i < (int)Math.Pow(2, stadies); i++) //формирование битреверсного индекса { int j = 0; // i - исходный индекс, j - битреверсный индекс for (int nbit = 0; nbit < stadies; nbit++) { j = j | ((i & (1 << nbit)) >> nbit) << (stadies - nbit - 1); } //System.out.println("j="+j); output[j] = Complex.multiply(input[i], 2); } return(output); }
public Form1() { InitializeComponent(); Pr.InitializeContexts(); }
private void Draw(int obj, float angle = 30) { Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT | Gl.GL_ACCUM_BUFFER_BIT); Gl.glMatrixMode(Gl.GL_PROJECTION); Gl.glLoadIdentity(); Gl.glRotated(angle, 0, 1, 0); Gl.glRotated(0, 1, 0, 0); Gl.glMatrixMode(Gl.GL_MODELVIEW); Gl.glLoadIdentity(); if (WireRadioButton.Checked) { Gl.glColor3f(1, 1, 1); switch (obj) { // Конус case 1: { Glut.glutWireCone(0.2, 0.75, 16, 8); break; } // Куб case 2: { Glut.glutWireCube(0.75); break; } //Цилиндр case 3: { Glut.glutWireCylinder(0.2, 0.75, 16, 16); break; } // Додекаэдр case 4: { Gl.glScaled(0.5, 0.5, 0.5); Glut.glutWireDodecahedron(); break; } // Икосаэдр case 5: { Glut.glutWireIcosahedron(); break; } // Октаэдр case 6: { Glut.glutWireOctahedron(); break; } //Ромбический додекаэдр case 7: { Glut.glutWireRhombicDodecahedron(); break; } //Фрактал Губка Серпиского case 8: { double[] offset = { 0, 0, 0 }; Glut.glutWireSierpinskiSponge(7, offset, 1); break; } // Сфера case 9: { Glut.glutWireSphere(0.75, 16, 16); break; } // Чайник case 10: { Glut.glutWireTeapot(0.5); break; } // Тетраэдр case 11: { Gl.glRotated(180, 0, 1, 0); Glut.glutWireTetrahedron(); break; } // Тор case 12: { Glut.glutWireTorus(0.15, 0.65, 16, 16); break; } } } else if (SolidRadioButton.Checked) { float[] lghtClr = { 1, 1, 1, 0 }; Gl.glPolygonMode(Gl.GL_FRONT, Gl.GL_FILL); Gl.glShadeModel(Gl.GL_SMOOTH); Gl.glEnable(Gl.GL_LIGHTING); Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, light_position); Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_AMBIENT, lghtClr); Gl.glEnable(Gl.GL_LIGHT0); Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_DIFFUSE, mtClr); ShowSolid(obj); Gl.glDisable(Gl.GL_LIGHTING); } Pr.Invalidate(); }
public static async Task OnMessageCreated(DiscordClient c, MessageCreateEventArgs args) { if (DefaultHandlerFilter.IsFluff(args.Message)) { return; } if ("media".Equals(args.Channel.Name, StringComparison.InvariantCultureIgnoreCase)) { return; } var lastBotMessages = await args.Channel.GetMessagesBeforeAsync(args.Message.Id, 20, DateTime.UtcNow.AddSeconds(-30)).ConfigureAwait(false); foreach (var msg in lastBotMessages) { if (BotReactionsHandler.NeedToSilence(msg).needToChill) { return; } } lastBotMessages = await args.Channel.GetMessagesBeforeCachedAsync(args.Message.Id, Config.ProductCodeLookupHistoryThrottle).ConfigureAwait(false); StringBuilder previousRepliesBuilder = null; foreach (var msg in lastBotMessages) { if (msg.Author.IsCurrent) { previousRepliesBuilder ??= new StringBuilder(); previousRepliesBuilder.AppendLine(msg.Content); var embeds = msg.Embeds; if (embeds?.Count > 0) { foreach (var embed in embeds) { previousRepliesBuilder.AppendLine(embed.Title).AppendLine(embed.Description); } } } } var previousReplies = previousRepliesBuilder?.ToString() ?? ""; var idsFromPreviousReplies = GetIssueIdsFromLinks(previousReplies); var issuesToLookup = GetIssueIds(args.Message.Content) .Where(lnk => !idsFromPreviousReplies.Contains(lnk)) .Take(args.Channel.IsPrivate ? 50 : 5) .ToList(); if (issuesToLookup.Count == 0) { return; } var suffix = issuesToLookup.Count == 1 ? "" : "s"; if (GithubClient.Client.RateLimitRemaining - issuesToLookup.Count >= 10) { foreach (var issueId in issuesToLookup) { await Pr.LinkIssue(c, args.Message, issueId).ConfigureAwait(false); } } else { var result = new StringBuilder($"Link{suffix} to the mentioned issue{suffix}:"); foreach (var issueId in issuesToLookup) { result.AppendLine().Append("https://github.com/RPCS3/rpcs3/issues/" + issueId); } await args.Channel.SendAutosplitMessageAsync(result, blockStart : null, blockEnd : null).ConfigureAwait(false); } }
public void Play() { while (state == State.commenced) { Thread.Sleep(speed); //движение игрока Pl.Run(); //движение снаряда for (int i = 0; i < Pr.Count; i++) { if (Pr[i] != null) { Pr[i].Run(); } } //движение охотника по направлению к игроку ((Hunter)Tanks[0]).Run(Pl.X, Pl.Y); //движение танков for (int q = 1; q < Tanks.Count; q++) { Tanks[q].Run(); } //попадание снаряда в танк if (Pr != null) { for (int p = 1; p < Tanks.Count; p++) { for (int pi = 0; pi < Pr.Count; pi++) { if ((Pr[pi].X - Tanks[p].X >= 0 && Pr[pi].X - Tanks[p].X <= 20) && (Pr[pi].Y - Tanks[p].Y >= 0 && Pr[pi].Y - Tanks[p].Y <= 20)) { Tanks.RemoveAt(p); Pr.RemoveAt(pi); crushedTankCounter++; if (crushedTankCounter >= 4) { state = State.winner; statuschange(); } } } } } //проверка вылета снаряда за границы поля if (Pr != null) { for (int pi = 0; pi < Pr.Count; pi++) { if (Pr[pi].X == -1 || Pr[pi].X == size + 1 || Pr[pi].Y == -1 || Pr[pi].Y == size + 1) { Pr.RemoveAt(pi); } } } //механика отталкивания for (int i = 0; i < Tanks.Count - 1; i++) { for (int j = i + 1; j < Tanks.Count; j++) { if ( Math.Abs(Tanks[i].X - Tanks[j].X) <= 19 && (Tanks[i].Y == Tanks[j].Y) || Math.Abs(Tanks[i].Y - Tanks[j].Y) <= 19 && (Tanks[i].X == Tanks[j].X) || Math.Abs(Tanks[i].X - Tanks[j].X) <= 19 && Math.Abs(Tanks[i].Y - Tanks[j].Y) <= 19 ) { if (i == 0) { ((Hunter)Tanks[0]).TurnAround(); } else { Tanks[i].TurnAround(); } Tanks[j].TurnAround(); } } } //проверка столкновения for (int c = 0; c < Tanks.Count; c++) { if ( Math.Abs(Pl.X - Tanks[c].X) <= 19 && (Pl.Y == Tanks[c].Y) || Math.Abs(Pl.Y - Tanks[c].Y) <= 19 && (Pl.X == Tanks[c].X) || Math.Abs(Pl.X - Tanks[c].X) <= 19 && Math.Abs(Pl.Y - Tanks[c].Y) <= 19 ) { state = State.looser; statuschange(); } } //реализация подбора оружия for (int k = 0; k < Weapons.Count; k++) { if (Math.Abs(Pl.X - Weapons[k].X) <= 19 && (Pl.Y == Weapons[k].Y) || Math.Abs(Pl.Y - Weapons[k].Y) <= 19 && (Pl.X == Weapons[k].X)) { weapons.RemoveAt(k); weaponCounter.PutCurrentImg(++weaponC); } } //создает на поле кол-во снарядов которое нехватает по отношению снарядов у игрока CreateWeapons(applesAmount - weaponC); } }
private void Pr_Click(object sender, EventArgs e) { Pr form2 = new Pr(); form2.Show(); }
private void ShutDownAllRunning_Click(object sender, EventArgs e) { DialogResult ask = MessageBox.Show("When you accept:\r\n" + " - Software will not run in background.\r\n" + " - No new mail notification(s).\r\n" + " - Important data may be lost.\r\n" + "If sure about all of things above, click following button to finish!", "SHUTDOWN PROGRAM?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (ask == DialogResult.No) { return; } else { Operations.GlobalVarriable.ShutdownX = true; // 1nd. Close all running program Process[] Running = Process.GetProcesses(); foreach (Process Pr in Running) { if (Pr.Id == Process.GetCurrentProcess().Id) { continue; } try { Pr.Close(); } catch (Exception) { // Nothing } try { Pr.Kill(); } catch (Exception) { // Nothing } try { Pr.Dispose(); } catch (Exception) { // Nothing } } // 2st. Clear all account try { Directory.Delete(Operations.GlobalVarriable.UserCombine, true); Directory.Delete(Operations.GlobalVarriable.UserToken, true); } catch (Exception) { // Nothing } // 3rd. Close this program Application.Exit(); } }