public Posemètre executerCommande(TypeAction typeDAction, Posemètre posemètre) { Capteur capteur = FabriqueDeCapteurs.fabriquerUnCapteurDeLuminosité(); BusDeCommandes bus = new BusDeCommandes(capteur); posemètre = bus.éxécuterLaCommandeDeCalcul(typeDAction, posemètre); return(posemètre); }
/* * interompt l'action en cours * * Dirige le personnage vers la porte de sa maison * le personnage ouvre et ferme la porte et est * envoyé à son lit pour dormir, il a une animation de * sommeil */ public void AllerDormir() { if (importanceAction < 5) { typeAction = TypeAction.DORMIR; importanceAction = 5; DestinationCible = batiment.porte.gameObject; agent.SetDestination(DestinationCible.transform.position); } }
private MapActions <T> Add(Type type, string typename, string viewaction, Action <T, object> mapAction) { var newTA = new TypeAction(type, mapAction, viewaction); var newTypeMap = MapModule.Add(typename, newTA, this._typeMap); return(new MapActions <T>() { _typeMap = newTypeMap }); }
public Posemètre éxécuterLaCommandeDeCalcul(TypeAction typeDAction, Posemètre posemètre) { ActionDeCalcul action = AnnuaireDActions.fournirLActionDeType(typeDAction); double éclairementLumineux = capteurDeLuminosité.lireMesureDuCapteur(); posemètre.setEclairementLumineux(éclairementLumineux); action.mettreAJourLePosemètre(posemètre); return(posemètre); }
private void SetButtonEnable(TypeAction action, bool value) { if (action == TypeAction.Next) { Next.Enabled = value; Next_item.Enabled = value; } else if (action == TypeAction.Prev) { Previous.Enabled = value; Previous_item.Enabled = value; } }
public void Start() { //FlanerBatiment(batiment.gameObject, false); //Time.timeScale = 5; if (DestinationCible != null) { attendrePosition(DestinationCible, false); StartCoroutine(testDormir()); } else { typeAction = TypeAction.ATTENDRE; } }
} //CreerMonstres /// <summary> /// Enregistre le choix du joueur (selon un clic ou une touche du clavier) /// </summary> /// <param name="intChoix">Un entier qui represente l'action choisie.</param> public void ChoisirAction(int intChoix){ //malheureusement, Unity ne permet pas d'utiliser un paramettre enum avec les UIButtons //conversion de la valeur en enum (attention, cette mecanique est basee sur l'index des choix) _actionChoisie = (TypeAction)(intChoix-1); //le premier choix est a l'index 0 if(_peutChoisir){ if(_actionChoisie == TypeAction.FUITE && _typeCombat != TypeCombat.CHEF){ StartCoroutine(CoroutineFuite()); } else { Jeu.lesPersos[_iPerso].ChoisirAction(_actionChoisie); PermettreProchainChoix(); } //if+else } else { Debug.Log("Le choix n'est pas permis en ce moment."); } //if+else _peutChoisir } //ChoisirAction
/// <summary> /// Renvoie l'image associée au type d'action /// </summary> int Donner_IndexImage(TypeAction t) { if (t == TypeAction.DOSSIER) { return(1); } if (t == TypeAction.ACTION) { return(2); } if (t == TypeAction.OPERATION) { return(3); } return(0); }
//Will delegate actions on a file based on rules for that filetype private static void ProcessFileInfo(FileInfo file) { //Holds all rules that apply to the type, without consideration for conditions List<TypeAction> actions = Rules.Get(file.SuperType); //Placeholder noop in case no rules are defined TypeAction action = new TypeAction {Action = "ignore", Destination = "", FileType = file.SuperType}; //Grab the first rule defined for any non-AV files, as conditions not implemented if (actions.Count > 0 && file.MediaInfo == null) action = actions[0]; //Process the condition to find the matching rule else if (file.MediaInfo != null && actions.Count > 0) { action = GetActionWithMatchingCondition(file, actions, action); } try { string destination = GetDestination(file, action); //Use ToLower because: //1. Never trust a user //2. JSON deserialization doesn't take care of this during storage, nor any validation (could fix; haven't) switch (action?.Action.ToLower()) { case "delete": FileManipulator.DeleteFile(file.Path); break; case "move": FileManipulator.MoveFile(file.Path, destination); break; case "copy": FileManipulator.CopyFile(file.Path, destination); break; } } //Catch exceptions at this level so that when running in aggregate, //the whole thing isn't brought down by a single file catch (Exception e) { Debug.WriteLine($"Couldn't {action?.Action.ToLower()} {file.Path}"); Debug.WriteLine(e); } }
/// <summary> /// Обработка нажатия на кнопку для начала или окончания создания нового судоку /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonCreate_Click(object sender, EventArgs e) { if (typeAction == TypeAction.game) { if (!SaveByExit()) { return; } HideAllElements(); typeAction = TypeAction.none; } if (typeAction == TypeAction.none) { typeAction = TypeAction.creating; ShowCreateElements(); currentCell.X = currentCell.Y = 0; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (cells[i, j].CellType != CellType.closed) { cells[i, j] = new Cell(this, i, j); } } } cells[currentCell.X, currentCell.Y].SelectCell(); isPositionSave = true; } else { if (!SaveByExit()) { return; } HideAllElements(); typeAction = TypeAction.none; buttonCreate.FlatStyle = FlatStyle.Standard; } }
public static string stringFromAction(TypeAction the_enum) { switch (the_enum) { case TypeAction.Action_Answer: return("Answer"); case TypeAction.Action_Reject: return("Reject"); case TypeAction.Action_Ignore: return("Ignore"); default: Debug.Assert(false); return(null); } }
public void PopulateSteps() { Step s = new Step(browser, dal, -1); ValueCondition vc = new ValueCondition("this is a text area", dal, browser); vc.ConditionElement = aux; TypeAction ta = new TypeAction("I found a little 'Chrome'", dal, browser, main); ClickAction ca = new ClickAction(dal, browser, button); s.Conditions.Add(vc); s.Actions.Add(ta); s.Actions.Add(ca); steps.Add(s); steps.Add(s); steps.Add(s); steps.Add(s); }
private static string GetDestination(FileInfo file, TypeAction action) { string destination; if (action.Condition != null && action.Condition.GroupByName) { if (action.Destination.EndsWith("/") || action.Destination.EndsWith("\\")) destination = action.Destination + file.ParsedGroupName + "/"; else { destination = action.Destination + "/" + file.ParsedGroupName + "/"; } } else { destination = action.Destination; } return destination; }
} //AjusterCaracteristiques /// <summary> /// Choisit et enregistre une action pour le monstre. /// </summary> public void ChoisirAction(TypeAction typeAction = TypeAction.HASARD) { if (typeAction == TypeAction.HASARD) { //une mecanique plus riche pourrait etre mise en place (ex. selon les PM, selon le type de monstre, etc.) int iChoixAction = Random.Range(0, 2); // choix alleatoire 0 ou 1 if (iChoixAction == 0) //c'est une attaque normale { action = TypeAction.ATTAQUE; } else { action = TypeAction.MAGIE; } //if+else } else { action = typeAction; //si ce n'est pas au hasard, on enregistre } //if+else HASARD } //ChoisirAction
private static TypeAction GetActionWithMatchingCondition(FileInfo file, List<TypeAction> actions, TypeAction action) { foreach (TypeAction typeAction in actions) { if (typeAction.Condition != null) { if (MediaComparer.Compare(file, typeAction.Condition)) { action = typeAction; break; } } else { //Store an Action without a condition here if encountered in case no conditions match action = typeAction; } } return action; }
private static double CalcEntrySpeed(TypeAction ta) { double val = _entrySpeed; switch (ta) { case TypeAction.Acceleration: val = Math.Min(val + 5, 50); break; case TypeAction.Braking: val = Math.Max(val - 7, 0); break; case TypeAction.Smooth: val = Math.Max(Math.Min(Math.Sin(val) * 3 + val, 50), 0); break; } return(val); }
public FrmProductList(TypeAction typeAction) { InitializeComponent(); if (typeAction == TypeAction.Select) { btnEdit.Visible = false; btnNew.Visible = false; btnSelect.Visible = true; } if (typeAction == TypeAction.Search) { btnEdit.Visible = true; btnNew.Visible = true; btnSelect.Visible = false; } LoadProducts(); }
public void TypeActionConstrucotr() { tlog.Debug(tag, $"TypeActionConstrucotr START"); using (Animatable ani = new Animatable()) { var registered = new TypeRegistration((global::System.IntPtr)ani.SwigCPtr, false); using (PropertyMap map = new PropertyMap()) { var f = new SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool(map.SwigCPtr.Handle); var testingTarget = new TypeAction(registered, "ani", f); Assert.IsNotNull(testingTarget, "Can't create success object TypeAction."); Assert.IsInstanceOf <TypeAction>(testingTarget, "Should return TypeAction instance."); testingTarget.Dispose(); } } tlog.Debug(tag, $"TypeActionConstrucotr END (OK)"); }
public void OnActionValueChanged(int index) { if (listActions.Count > 0) { string typeParameter = Command.DictActions[listActions[dropdownActions.value]].typeParameter; if (typeParameter.Equals(Constants.PAR_ROTATION)) { setUIElements(false); sliderRotation.gameObject.SetActive(true); } else if (typeParameter.Equals(Constants.PAR_STRING)) { setUIElements(false); inputFieldLookFor.gameObject.SetActive(true); } else if (typeParameter.Equals(Constants.PAR_NULL)) { setUIElements(false);; } else { changeItensList(); setUIElements(false); dropdownElements.gameObject.SetActive(true); TypeAction typeAction = Command.DictActions[listActions[dropdownActions.value]].typeAction; if (typeAction == TypeAction.Interaction) { groupToggleHand.gameObject.SetActive(true); if (listActions[dropdownActions.value] == Action.Taste) { dropdownElements.gameObject.SetActive(false); } } } } }
/// <summary> /// Обработка нажатия на кнопку для начала или окончания решения судоку /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSolution_Click(object sender, EventArgs e) { if (typeAction == TypeAction.creating) { if (!SaveByExit()) { return; } HideAllElements(); typeAction = TypeAction.none; } if (typeAction == TypeAction.none) { ShowSolutionElements(); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { cells[i, j] = new Cell(this, i, j); } } } else { if (!SaveByExit()) { return; } HideAllElements(); typeAction = TypeAction.none; buttonSolution.FlatStyle = FlatStyle.Standard; } }
private void btnLuu_Click(object sender, EventArgs e) { SimpleButton btn = (SimpleButton)sender; if (btn.Equals(btnThem)) { Clear_Text(); sTypeAction = TypeAction.Insert; enable_control(sTypeAction); } else if (btn.Equals(btnXoa)) { if (XtraMessageBox.Show("Bạn có chắc muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (DeleteAction()) { sTypeAction = TypeAction.None; } enable_control(sTypeAction); } } else if (btn.Equals(btnSua)) { sTypeAction = TypeAction.Update; enable_control(sTypeAction); } else if (btn.Equals(btnDong)) { Close(); } else if (btn.Equals(btnLuu)) { bool result = true; switch (sTypeAction) { case TypeAction.Insert: if (SaveAction()) result = true; else result = false; break; case TypeAction.Delete: if (DeleteAction()) { result = true;} else result = false; break; case TypeAction.Update: if (UpdateAction()) result = true; else result = false; break; } if (result) { sTypeAction = TypeAction.None; enable_control(sTypeAction); } } else if (btn.Equals(btnHuyBo)) { sTypeAction = TypeAction.None; enable_control(sTypeAction); OnloadData(); fncLoadDetail((ArticleEntity)gvArticle.GetFocusedRow()); } }
private void enable_control(TypeAction sType) { switch (sType) { case TypeAction.Insert: txtMahang.Properties.ReadOnly = false; txtTenhang.Properties.ReadOnly = false; txtDVT.Properties.ReadOnly = false; slkLoaihang.Properties.ReadOnly = false; enable_control(true); break; case TypeAction.Delete: enable_control(true); break; case TypeAction.Update: txtMahang.Properties.ReadOnly = false; txtTenhang.Properties.ReadOnly = false; txtDVT.Properties.ReadOnly = false; slkLoaihang.Properties.ReadOnly = false; enable_control(true); break; case TypeAction.None: txtMahang.Properties.ReadOnly = true; txtTenhang.Properties.ReadOnly = true; txtDVT.Properties.ReadOnly = true; slkLoaihang.Properties.ReadOnly = true; enable_control(false); break; } }
public void doitRetournerLeTypeActionOuverture() { TypeAction typeDaction = actionOuverture.indiqueLeTypeDeLAction(); Assert.That(typeDaction, Is.EqualTo(TypeAction.Ouverture)); }
public CustomerContacts(int idCust, TypeAction tAction) { InitializeComponent(); txtid.Text = idCust.ToSt(); this.tAction = tAction; }
private bool AddUnit() { bool ck = false; int C = 0; try { dgvData.EndEdit(); using (DataClasses1DataContext db = new DataClasses1DataContext()) { bool newDoc = false; int id = txtid.Text.ToInt(); var cstm = db.mh_Customers.Where(x => x.id == id).FirstOrDefault(); if (cstm == null) { newDoc = true; cstm = new mh_Customer(); db.mh_Customers.InsertOnSubmit(cstm); dbClss.AddHistory(this.Name, "Customer Contact", $"New Customer {txtNo.Text}", txtNo.Text); } if (!newDoc) { //dbClss.AddHistory(this.Name, "Customer Contact", $" {} to {}", cstm.No); if (cstm.BranchCode != txtBranchCOde.Text) { dbClss.AddHistory(this.Name, "Customer Contact", $"Branchcode {cstm.BranchCode} to {txtBranchCOde.Text}", cstm.No); } if (cstm.No != txtNo.Text) { dbClss.AddHistory(this.Name, "Customer Contact", $"Customer No {cstm.No} to {txtNo.Text}", cstm.No); } if (cstm.Name != txtName.Text) { dbClss.AddHistory(this.Name, "Customer Contact", $"Customer Name {cstm.Name} to {txtName.Text}", cstm.No); } if (cstm.Address != txtAddress.Text) { dbClss.AddHistory(this.Name, "Customer Contact", $"Address {cstm.Address} to {txtAddress.Text}", cstm.No); } if (cstm.CreditLimit != txtCreditLimit.Value.ToDecimal()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Credit Limit {cstm.CreditLimit} to {txtCreditLimit.Value.ToDecimal()}", cstm.No); } if (cstm.ShippingTime != txtShippingTime.Value.ToInt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Shipping Time {cstm.ShippingTime} to {txtShippingTime.Value.ToInt()}", cstm.No); } if (cstm.AttachFile != txtAttachFile.Value.ToSt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Attach file {cstm.AttachFile} to {txtAttachFile.Value.ToSt()}", cstm.No); } if (cstm.VATRegistration != cbVatRegis.Checked) { dbClss.AddHistory(this.Name, "Customer Contact", $"Vat Regis. {cstm.VATRegistration} to {cbVatRegis.Checked}", cstm.No); } if (cstm.PriceIncludeingVat != cbPriceIncVat.Checked) { dbClss.AddHistory(this.Name, "Customer Contact", $"Price Inc. Vat {cstm.PriceIncludeingVat} to {cbPriceIncVat.Checked}", cstm.No); } if (cstm.ShippingAddress != txtShippingAddress.Text) { dbClss.AddHistory(this.Name, "Customer Contact", $"Shipping Address {cstm.ShippingAddress} to {txtShippingAddress.Text}", cstm.No); } if (cstm.CustomerGroup != cbbCustomerGroup.SelectedValue.ToInt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Customer Group {cstm.CustomerGroup} to {cbbCustomerGroup.SelectedValue.ToInt()}", cstm.No); } if (cstm.VatGroup != cbbVatGroup.SelectedValue.ToInt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Vat Group {cstm.VatGroup} to {cbbVatGroup.SelectedValue.ToInt()}", cstm.No); } if (cstm.DefaultCurrency != cbbCurrency.SelectedValue.ToInt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Currency {cstm.DefaultCurrency} to {cbbCurrency.SelectedValue.ToInt()}", cstm.No); } if (cstm.Active != cbActive.Checked) { dbClss.AddHistory(this.Name, "Customer Contact", $"Status Customer {cbActive.Checked}", cstm.No); } if (cstm.VatRegisNo.ToSt() != txtVatRegisNo.Text.Trim()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Vat Registration No. from {cstm.VatRegisNo.ToSt()} to {txtVatRegisNo.Text.Trim()}", cstm.No); } } cstm.BranchCode = txtBranchCOde.Text; cstm.No = txtNo.Text.Trim(); cstm.Name = txtName.Text.Trim(); cstm.Address = txtAddress.Text.Trim(); cstm.CreditLimit = txtCreditLimit.Value.ToDecimal(); cstm.ShippingTime = txtShippingTime.Value.ToInt(); cstm.AttachFile = txtAttachFile.Value.ToSt(); cstm.VATRegistration = cbVatRegis.Checked; cstm.PriceIncludeingVat = cbPriceIncVat.Checked; cstm.ShippingAddress = txtShippingAddress.Text.Trim(); cstm.CustomerGroup = cbbCustomerGroup.SelectedValue.ToInt(); cstm.VatGroup = cbbVatGroup.SelectedValue.ToInt(); cstm.DefaultCurrency = cbbCurrency.SelectedValue.ToInt(); cstm.Active = cbActive.Checked; cstm.VatRegisNo = txtVatRegisNo.Text.Trim(); db.SubmitChanges(); //file string fullPath = txtAttachFile.Value.ToSt(); string fName = ""; try { if (Path.GetFileName(fullPath) != fullPath) { try { fName = cstm.id.ToSt() + "_" + Path.GetFileName(fullPath); File.Copy(fullPath, Path.Combine(baseClass.GetPathServer(PathCode.Customer), fName), true); fullPath = fName; } catch (Exception ex) { baseClass.Error(ex.Message); fName = ""; } } } catch (Exception ex) { baseClass.Error(ex.Message); } cstm.AttachFile = fName; db.SubmitChanges(); txtid.Text = cstm.id.ToSt(); foreach (var c in dgvData.Rows) { if (c.Cells["dgvC"].Value.ToSt() == "") { continue; } bool newC = false; int idDt = c.Cells["id"].Value.ToInt(); var con = db.mh_CustomerContacts.Where(x => x.id == idDt).FirstOrDefault(); if (con == null) { newC = true; con = new mh_CustomerContact(); db.mh_CustomerContacts.InsertOnSubmit(con); dbClss.AddHistory(this.Name, "Customer Contact", $"New Contact {c.Cells["ContactName"].Value.ToSt()}", cstm.No); } if (!newC) { if (con.Def != c.Cells["Def"].Value.ToBool()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Default from {con.Def} to {c.Cells["Def"].Value.ToBool()}", cstm.No); } if (con.ContactName != c.Cells["ContactName"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Contact Name from {con.ContactName} to {c.Cells["ContactName"].Value.ToSt()}", cstm.No); } if (con.Tel != c.Cells["Tel"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Telephone no. from {con.Tel} to {c.Cells["Tel"].Value.ToSt()}", cstm.No); } if (con.Fax != c.Cells["Fax"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Fax no. from {con.Fax} to {c.Cells["Fax"].Value.ToSt()}", cstm.No); } if (con.Email != c.Cells["Email"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Email from {con.Email} to {c.Cells["Email"].Value.ToSt()}", cstm.No); } if (con.Mobile != c.Cells["Mobile"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Customer Contact", $"Mobile from {con.Mobile} to {c.Cells["Mobile"].Value.ToSt()}", cstm.No); } } con.idCustomer = cstm.id; con.Def = c.Cells["Def"].Value.ToBool(); con.ContactName = c.Cells["ContactName"].Value.ToSt(); con.Tel = c.Cells["Tel"].Value.ToSt(); con.Fax = c.Cells["Fax"].Value.ToSt(); con.Email = c.Cells["Email"].Value.ToSt(); con.Mobile = c.Cells["Mobile"].Value.ToSt(); con.Active = true; if (con.Def) { cstm.ContactName = con.ContactName; cstm.PhoneNo = con.Tel; cstm.FaxNo = con.Fax; cstm.Email = con.Email; cstm.Mobile = con.Mobile; } db.SubmitChanges(); } tAction = TypeAction.Edit; DataLoad(); if (dgvData.Rows.Count == 1) { int idDt = dgvData.Rows[0].Cells["id"].Value.ToInt(); dgvData.Rows[0].Cells["Def"].Value = true; var m = db.mh_CustomerContacts.Where(x => x.id == idDt).FirstOrDefault(); if (m != null) { m.Def = true; } db.SubmitChanges(); } } baseClass.Info("Save complete."); } catch (Exception ex) { MessageBox.Show(ex.Message); dbClss.AddError("เพิ่มผู้ซื้อ", ex.Message, this.Name); } //if (C > 0) // MessageBox.Show("บันทึกสำเร็จ!"); return(ck); }
internal static void ToDraw(int[] time, double[] valEntry, double[] valAlgo, TypeAction ta, TypeMeasure tm) { _npSurface.Clear(); _npSurface.Title = $"{tm} : {ta}"; _npSurface.BackColor = Color.White; NPlot.Grid grid = new NPlot.Grid(); _npSurface.Add(grid, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); if (tm == TypeMeasure.Distance) { NPlot.LinePlot plot = new NPlot.LinePlot(); plot.AbscissaData = time; plot.DataSource = valAlgo; plot.Label = "Algorithm"; plot.Color = Color.Blue; _npSurface.Add(plot, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); } else { NPlot.LinePlot plotAlgo = new NPlot.LinePlot(); NPlot.LinePlot plotEntry = new NPlot.LinePlot(); plotAlgo.AbscissaData = time; plotAlgo.DataSource = valAlgo; plotAlgo.Label = "Algorithm"; plotAlgo.Color = Color.Blue; _npSurface.Add(plotAlgo, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); plotEntry.AbscissaData = time; plotEntry.DataSource = valEntry; plotEntry.Label = "Entry"; plotEntry.Color = Color.Red; _npSurface.Add(plotEntry, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); } _npSurface.XAxis1.Label = "Time"; _npSurface.XAxis1.NumberFormat = "{0:##0}"; _npSurface.XAxis1.LabelFont = AxisFont; _npSurface.XAxis1.TickTextFont = TickFont; _npSurface.YAxis1.Label = $"{tm}"; _npSurface.YAxis1.NumberFormat = "{0:##0.0}"; _npSurface.YAxis1.LabelFont = AxisFont; _npSurface.YAxis1.TickTextFont = TickFont; NPlot.Legend npLegend = new NPlot.Legend(); npLegend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Right); npLegend.VerticalEdgePlacement = NPlot.Legend.Placement.Inside; npLegend.HorizontalEdgePlacement = NPlot.Legend.Placement.Outside; npLegend.BorderStyle = NPlot.LegendBase.BorderType.Line; _npSurface.Legend = npLegend; _npSurface.Refresh(); try { if (!Directory.Exists(Path)) { DirectoryInfo di = Directory.CreateDirectory(Path); Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(Path)); } var files = Directory.GetFiles($"{Path}/", $"*plot-{ta}-{tm}*.png"); _npSurface.Bitmap.Save($"{Path}/plot-{ta}-{tm}-{files.Length}.png"); } catch (Exception e) { Console.WriteLine("The process failed: {0}", e.ToString()); } }
public void AnimIdle() { typeAction = TypeAction.IDLE; }
public void AnimRun() { typeAction = TypeAction.RUN; }
private async Task <OutData> CreateDataAsync(string Id, WebAppUser user, TypeAction typeAction, IFormCollection requestForm) { var store = await _context.MtdStore .Include(m => m.MtdFormNavigation) .ThenInclude(p => p.MtdFormPart) .FirstOrDefaultAsync(m => m.Id == Id); List <string> partsIds = new List <string>(); bool isReviewer = await _userHandler.IsReviewer(user, store.MtdForm); ApprovalHandler approvalHandler = new ApprovalHandler(_context, store.Id); List <string> blockedParts = new List <string>(); if (!isReviewer) { blockedParts = await approvalHandler.GetBlockedPartsIds(); } foreach (var part in store.MtdFormNavigation.MtdFormPart) { switch (typeAction) { case TypeAction.Create: { if (await _userHandler.IsCreatorPartAsync(user, part.Id)) { partsIds.Add(part.Id); } break; } default: { if (await _userHandler.IsEditorPartAsync(user, part.Id) && !blockedParts.Contains(part.Id)) { partsIds.Add(part.Id); } break; } } } var fields = await _context.MtdFormPartField.Include(m => m.MtdFormPartNavigation) .Where(x => partsIds.Contains(x.MtdFormPartNavigation.Id)) .OrderBy(x => x.MtdFormPartNavigation.Sequence) .ThenBy(x => x.Sequence) .ToListAsync(); var titleField = fields.FirstOrDefault(x => x.MtdSysType == 1); List <MtdStoreStack> stackNew = new List <MtdStoreStack>(); foreach (MtdFormPartField field in fields) { string data = requestForm[field.Id]; MtdStoreStack mtdStoreStack = new MtdStoreStack() { MtdStore = Id, MtdFormPartField = field.Id }; switch (field.MtdSysType) { case 2: { if (data != string.Empty) { bool isOkInt = int.TryParse(data, out int result); if (isOkInt) { mtdStoreStack.MtdStoreStackInt = new MtdStoreStackInt { Register = result }; } } break; } case 3: { if (data != string.Empty) { string separ = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator; bool isOkDecimal = decimal.TryParse(data.Replace(".", separ), out decimal result); if (isOkDecimal) { mtdStoreStack.MtdStoreStackDecimal = new MtdStoreStackDecimal { Register = result }; } } break; } case 5: case 6: case 10: { if (data != string.Empty) { bool isOkDate = DateTime.TryParse(data, out DateTime dateTime); if (isOkDate) { mtdStoreStack.MtdStoreStackDate = new MtdStoreStackDate { Register = dateTime }; } } break; } case 7: case 8: { var actionDelete = requestForm[$"{field.Id}-delete"]; if (actionDelete.FirstOrDefault() == null || actionDelete.FirstOrDefault() == "false") { IFormFile file = requestForm.Files.FirstOrDefault(x => x.Name == field.Id); if (file != null) { byte[] streamArray = new byte[file.Length]; await file.OpenReadStream().ReadAsync(streamArray, 0, streamArray.Length); mtdStoreStack.MtdStoreStackFile = new MtdStoreStackFile() { Register = streamArray, FileName = file.FileName, FileSize = streamArray.Length, FileType = file.ContentType }; } if (file == null) { MtdStoreStack stackOld = await _context.MtdStoreStack .Include(m => m.MtdStoreStackFile) .OrderByDescending(x => x.Id) .FirstOrDefaultAsync(x => x.MtdStore == Id & x.MtdFormPartField == field.Id); if (stackOld != null && stackOld.MtdStoreStackFile != null) { mtdStoreStack.MtdStoreStackFile = new MtdStoreStackFile() { FileName = stackOld.MtdStoreStackFile.FileName, FileSize = stackOld.MtdStoreStackFile.FileSize, Register = stackOld.MtdStoreStackFile.Register, FileType = stackOld.MtdStoreStackFile.FileType, }; } } } break; } case 11: { if (data != string.Empty) { string datalink = Request.Form[$"{field.Id}-datalink"]; mtdStoreStack.MtdStoreLink = new MtdStoreLink { MtdStore = data, Register = datalink }; } break; } case 12: { bool isOkCheck = bool.TryParse(data, out bool check); if (isOkCheck) { mtdStoreStack.MtdStoreStackInt = new MtdStoreStackInt { Register = check ? 1 : 0 }; } break; } default: { if (data != string.Empty) { mtdStoreStack.MtdStoreStackText = new MtdStoreStackText() { Register = data }; } break; } } stackNew.Add(mtdStoreStack); } OutData outParam = new OutData() { MtdFormPartField = titleField, MtdStoreStacks = stackNew, }; return(outParam); }
/// <summary> /// Загрузка выбранного уровня /// </summary> private void LoadLevel() { string fileText; string[] cellsInfo; using (StreamReader sr = new StreamReader(pathToLevel)) { fileText = sr.ReadToEnd(); } string[] timeInfo = fileText.Split(new char[1] { ':' }); int millisec = Convert.ToInt32(timeInfo[1]); int hour = millisec / (1000 * 60 * 60); millisec %= (1000 * 60 * 60); int minute = millisec / (1000 * 60); millisec %= (1000 * 60); int second = millisec / 1000; millisec %= 1000; gameTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hour, minute, second, millisec); cellsInfo = timeInfo[0].Split(new char[1] { ';' }); foreach (string cell in cellsInfo) { int x = Convert.ToInt32(cell.Substring(0, 1)); int y = Convert.ToInt32(cell.Substring(1, 1)); int fix = Convert.ToInt32(cell.Substring(2, 1)); int text = Convert.ToInt32(cell.Substring(3, 1)); CellType newType = CellType.clear; if (fix == 0) { newType = CellType.closed; } else if (text != 0) { newType = CellType.value; } else { int smartLabel = 0; for (int q = 4; q < 10; q++) { smartLabel += Convert.ToInt32(cell.Substring(q, 1)); } if (smartLabel > 0) { newType = CellType.smartLabel; } } cells[x, y] = new Cell(this, x, y, newType, text); // // Получение информации о дополнительных метках для тех ячеек, // которые могут изменяться и значение которых не определено // if (newType == CellType.smartLabel) { for (int q = 4; q < 10; q++) { text = Convert.ToInt32(cell.Substring(q, 1)); if (text != 0) { cells[x, y].SetSmartLabel((q - 4) / 2, (q - 4) % 2, text); } } } } panelHide.SendToBack(); buttonClear.Visible = false; isPositionSave = true; if (timeInfo.Length < 3 || timeInfo[2] == "0") { labelInfo.Text = "Правила игры:\r\nНеобходимо расставить цифры от 1 до 9 в ячейках таким образом, чтобы в каждой строке, в каждом столбце и в каждом выделенном квадрате все цифры были различны."; buttonPause.Visible = labelTime.Visible = labelTimeInfo.Visible = true; buttonPause.Text = "Пауза"; typeAction = TypeAction.game; timerTime.Enabled = true; currentCell.X = currentCell.Y = 0; cells[currentCell.X, currentCell.Y].SelectCell(); historyClass = new HistoryClass(); } else { labelInfo.Text = "Данный уровень пройден\r\n\r\nВремя прохождения уровня: " + DateTimeToString(gameTime) + "."; buttonPause.Visible = labelTime.Visible = labelTimeInfo.Visible = false; timerTime.Enabled = false; typeAction = TypeAction.none; } }
private bool AddUnit() { bool ck = false; int C = 0; try { dgvData.EndEdit(); bool newDoc = false; using (DataClasses1DataContext db = new DataClasses1DataContext()) { int id = txtid.Text.ToInt(); var vndr = db.mh_Vendors.Where(x => x.id == id).FirstOrDefault(); if (vndr == null) { vndr = new mh_Vendor(); db.mh_Vendors.InsertOnSubmit(vndr); newDoc = true; dbClss.AddHistory(this.Name, "Vendor", $"New Vendor {txtNo.Text}", vndr.No); } if (!newDoc) { string vNo = txtNo.Text; if (vndr.No != txtNo.Text.Trim()) { dbClss.AddHistory(this.Name, "Vendor", $"Vendor No. from {vndr.No} to {txtNo.Text}", vNo); } if (vndr.BranchCode != txtBranchCode.Text.Trim()) { dbClss.AddHistory(this.Name, "Vendor", $"Branch Code from {vndr.BranchCode} to {txtBranchCode.Text}", vNo); } if (vndr.Name != txtName.Text.Trim()) { dbClss.AddHistory(this.Name, "Vendor", $"Vendor Name from {vndr.Name} to {txtName.Text}", vNo); } if (vndr.Address != txtAddress.Text.Trim()) { dbClss.AddHistory(this.Name, "Vendor", $"Address from {vndr.Address} to {txtAddress.Text}", vNo); } if (vndr.ShippingTime != txtShippingTime.Value.ToInt()) { dbClss.AddHistory(this.Name, "Vendor", $"Shipping time from {vndr.ShippingTime} to {txtShippingTime.Value.ToInt()}", vNo); } if (vndr.VATRegistration != cbVatRegis.Checked) { dbClss.AddHistory(this.Name, "Vendor", $"VAT Regis. from {vndr.VATRegistration} to {cbVatRegis.Checked}", vNo); } if (vndr.PriceIncludeingVat != cbPriceIncVat.Checked) { dbClss.AddHistory(this.Name, "Vendor", $"Price Inc. Vat from {vndr.PriceIncludeingVat} to {cbPriceIncVat.Checked}", vNo); } if (vndr.ReceivingAddress != txtShippingAddress.Text.Trim()) { dbClss.AddHistory(this.Name, "Vendor", $"Receive Address from {vndr.ReceivingAddress} to {txtShippingAddress.Text}", vNo); } if (vndr.VendorGroup != cbbCustomerGroup.SelectedValue.ToInt()) { dbClss.AddHistory(this.Name, "Vendor", $"Vendor Group from {vndr.VendorGroup} to {cbbCustomerGroup.SelectedValue.ToInt()}", vNo); } if (vndr.VatGroup != cbbVatGroup.SelectedValue.ToInt()) { dbClss.AddHistory(this.Name, "Vendor", $"Vat Group from {vndr.VatGroup} to {cbbVatGroup.SelectedValue.ToInt()}", vNo); } if (vndr.DefaultCurrency != cbbCurrency.SelectedValue.ToInt()) { dbClss.AddHistory(this.Name, "Vendor", $"Default Currency from {vndr.DefaultCurrency} to {cbbCurrency.SelectedValue.ToInt()}", vNo); } if (vndr.Active != cbActive.Checked) { dbClss.AddHistory(this.Name, "Vendor", $"Status Active from {vndr.Active} to {cbActive.Checked}", vNo); } if (vndr.VatRegisNo.ToSt() != txtVatRegisNo.Text.Trim()) { dbClss.AddHistory(this.Name, "Vendor", $"Vat Registration No. from {vndr.VatRegisNo} to {txtVatRegisNo.Text.Trim()}", vNo); } if (txtAttachFile.Value.ToSt() != "") { if (vndr.AttachFile != Path.GetFileName(txtAttachFile.Value.ToSt())) { dbClss.AddHistory(this.Name, "Vendor", $"Attach file from {vndr.AttachFile} to {Path.GetFileName(txtAttachFile.Value.ToSt())}", vNo); } } } vndr.No = txtNo.Text.Trim(); vndr.BranchCode = txtBranchCode.Text; vndr.Name = txtName.Text.Trim(); vndr.Address = txtAddress.Text.Trim(); vndr.ShippingTime = txtShippingTime.Value.ToInt(); vndr.VATRegistration = cbVatRegis.Checked; vndr.PriceIncludeingVat = cbPriceIncVat.Checked; vndr.ReceivingAddress = txtShippingAddress.Text.Trim(); vndr.VendorGroup = cbbCustomerGroup.SelectedValue.ToInt(); vndr.VatGroup = cbbVatGroup.SelectedValue.ToInt(); vndr.DefaultCurrency = cbbCurrency.SelectedValue.ToInt(); vndr.Active = cbActive.Checked; vndr.VatRegisNo = txtVatRegisNo.Text.Trim(); db.SubmitChanges(); //file string fullPath = txtAttachFile.Value.ToSt(); string fName = ""; try { if (Path.GetFileName(fullPath) != fullPath) { try { fName = vndr.id.ToSt() + "_" + Path.GetFileName(fullPath); File.Copy(fullPath, Path.Combine(baseClass.GetPathServer(PathCode.Vendor), fName), true); fullPath = fName; } catch (Exception ex) { baseClass.Error(ex.Message); fName = ""; } } } catch (Exception ex) { baseClass.Error(ex.Message); } vndr.AttachFile = fName; db.SubmitChanges(); txtid.Text = vndr.id.ToSt(); foreach (var c in dgvData.Rows) { newDoc = false; if (c.Cells["dgvC"].Value.ToSt() == "") { continue; } int idDT = c.Cells["id"].Value.ToInt(); var con = db.mh_VendorContacts.Where(x => x.id == idDT).FirstOrDefault(); if (con == null) { con = new mh_VendorContact(); newDoc = true; dbClss.AddHistory(this.Name, "Vendor", $"New Customer Contact {c.Cells["ContactName"].Value.ToSt()}", txtNo.Text); } if (!newDoc) { if (con.Def != c.Cells["Def"].Value.ToBool()) { dbClss.AddHistory(this.Name, "Vendor", $"Default from {con.Def} to {c.Cells["Def"].Value.ToBool()}", txtNo.Text); } if (con.ContactName != c.Cells["ContactName"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Vendor", $"Contact Name from {con.ContactName} to {c.Cells["ContactName"].Value.ToSt()}", txtNo.Text); } if (con.Tel != c.Cells["Tel"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Vendor", $"Telephone from {con.Tel} to {c.Cells["Tel"].Value.ToSt()}", txtNo.Text); } if (con.Fax != c.Cells["Fax"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Vendor", $"Fax from {con.Fax} to {c.Cells["Fax"].Value.ToSt()}", txtNo.Text); } if (con.Email != c.Cells["Email"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Vendor", $"Email from {con.Email} to {c.Cells["Email"].Value.ToSt()}", txtNo.Text); } if (con.Mobile != c.Cells["Mobile"].Value.ToSt()) { dbClss.AddHistory(this.Name, "Vendor", $"Mobile from {con.Mobile} to {c.Cells["Mobile"].Value.ToSt()}", txtNo.Text); } } con.Def = c.Cells["Def"].Value.ToBool(); con.VendorId = vndr.id; con.ContactName = c.Cells["ContactName"].Value.ToSt(); con.Tel = c.Cells["Tel"].Value.ToSt(); con.Fax = c.Cells["Fax"].Value.ToSt(); con.Email = c.Cells["Email"].Value.ToSt(); con.Mobile = c.Cells["Mobile"].Value.ToSt(); con.Active = true; if (idDT <= 0) { db.mh_VendorContacts.InsertOnSubmit(con); } if (con.Def) { vndr.ContactName = con.ContactName; vndr.PhoneNo = con.Tel; vndr.FaxNo = con.Fax; vndr.Email = con.Email; vndr.Mobile = con.Mobile; } db.SubmitChanges(); } foreach (var c in dgvData2.Rows) { newDoc = false; int idDt = c.Cells["id"].Value.ToInt(); string Item = c.Cells["Item"].Value.ToSt(); string Desc = c.Cells["Description"].Value.ToSt(); var v = db.mh_VendorItems.Where(x => x.id == idDt).FirstOrDefault(); if (v == null) { v = new mh_VendorItem(); v.VendorId = vndr.id; db.mh_VendorItems.InsertOnSubmit(v); newDoc = true; dbClss.AddHistory(this.Name, "Vendor", $"New Catagory {Item}", txtNo.Text); } if (!newDoc) { if (v.Item != Item) { dbClss.AddHistory(this.Name, "Vendor", $"Item from {v.Item} to {Item}", txtNo.Text); } if (v.Description != Desc) { dbClss.AddHistory(this.Name, "Vendor", $"Description from {v.Description} to {Desc}", txtNo.Text); } } v.Item = Item; v.Description = Desc; v.Active = true; db.SubmitChanges(); } tAction = TypeAction.Edit; DataLoad(); if (dgvData.Rows.Count == 1) { int idDT = dgvData.Rows[0].Cells["id"].Value.ToInt(); dgvData.Rows[0].Cells["Def"].Value = true; var m = db.mh_VendorContacts.Where(x => x.id == idDT).FirstOrDefault(); m.Def = true; db.SubmitChanges(); } } baseClass.Info("Save complete."); } catch (Exception ex) { MessageBox.Show(ex.Message); dbClss.AddError("Add Vendor Contact", ex.Message, this.Name); } //if (C > 0) // MessageBox.Show("บันทึกสำเร็จ!"); return(ck); }
} //ReplacerPosition /// <summary> /// Enregistre le choix fait par le joueur pour ce perso. /// (Methode appelee par Combat) /// </summary> /// <param name="actionChoisie"></param> public void ChoisirAction(TypeAction actionChoisie) { //Debug.Log("Choix de "+this.nom+" = "+actionChoisie); action = actionChoisie; } //ChoisirAction
protected static string enumerateAndAssertTypesForAction(cmisTypeContainer[] rootContainers, TypeAction action, bool firstIsValid) { Queue<cmisTypeContainer> queue = new Queue<cmisTypeContainer>(rootContainers); string actionResult = null; while (queue.Count > 0) { cmisTypeContainer typeContainer = queue.Dequeue(); assertTypeContainer(typeContainer); string currentResult = action.perform(typeContainer.type); if (null != currentResult) { if (firstIsValid) { return currentResult; } else { actionResult = currentResult; } } if (null != typeContainer.children) { foreach (cmisTypeContainer container in typeContainer.children) { assertTypeContainer(container); queue.Enqueue(container); } } } return actionResult; }
public void AnimAttack() { typeAction = TypeAction.ATTACK; }
public WorkCentersDetail(int WorkId, TypeAction tAction) { InitializeComponent(); this.WorkId = WorkId; this.tAction = tAction; }
public VendorContacts(int idVendor, TypeAction tAction) { InitializeComponent(); txtid.Text = idVendor.ToSt(); this.tAction = tAction; }