private void exampleToolStripMenuItem_Click(object sender, EventArgs e) { SUBSTRATE sub = new SUBSTRATE(); sub.bgcolor = 0x111111; sub.fgpencolor = 0x00AA00; sub.fgbrushcolor = 0x002200; sub.selectedcolor = 0x00FF00; sub.viewaxis = 1; sub.viewgrid = 1; sub.width = 100.0f; sub.height = 100.0f; sub.orgx = 45; sub.orgy = 45; sub.dierows = 19; sub.diecols = 19; sub.diewidth = 4.5f; sub.dieheight = 4.5f; sub.diepitchwidth = 5.0f; sub.diepitchheight = 5.0f; SubstrateLib.regen(_id, sub); // sub 전달하여 개별 die 정보 자동 생성 for (int row = 0; row < sub.dierows; row++) { for (int col = 0; col < sub.diecols; col++) { DIE die = new DIE(); SubstrateLib.die(_id, row, col, ref die); die.color = 0x005500; SubstrateLib.update(_id, row, col, die); //개별 die 정보 사용자 변경후 저장 } } SubstrateLib.render(_id, SubstrateLib.DimParameter.DimAll); // 화면 새로 그리기 }
public UInt32 RollDice(DIE dieType, UInt32 dieQty, MODE rollMode) { UInt32 retval = 0; UInt32[] dieRollVals = new UInt32[dieQty]; for (UInt32 i = 0; i < dieQty; i++) { dieRollVals[i] = RollDie(dieType); if (rollMode == MODE.REROLL_ONES && dieRollVals[i] == 1) { while (dieRollVals[i] == 1) { dieRollVals[i] = RollDie(dieType); } } retval += dieRollVals[i]; } if (rollMode == MODE.HIGHEST_ONLY) { retval = dieRollVals.Max(); } if (rollMode == MODE.LOWEST_ONLY) { retval = dieRollVals.Min(); } return(retval); }
UInt32 RollDie(DIE dieType) { UInt32 retval = 0; Random rnd = new Random(); switch (dieType) { case DIE.D4: retval = (UInt32)rnd.Next(1, (int)DIE.D4); break; case DIE.D6: retval = (UInt32)rnd.Next(1, (int)DIE.D6); break; case DIE.D8: retval = (UInt32)rnd.Next(1, (int)DIE.D8); break; case DIE.D10: retval = (UInt32)rnd.Next(1, (int)DIE.D10); break; case DIE.D12: retval = (UInt32)rnd.Next(1, (int)DIE.D12); break; case DIE.D20: retval = (UInt32)rnd.Next(1, (int)DIE.D20); break; case DIE.D100: retval = (UInt32)rnd.Next(1, (int)DIE.D100); break; } return(retval); }
private async void BtnGuardarBOMSDetalles_Clicked(object sender, EventArgs e) { string connectionString = ConfigurationManager.AppSettings["ipServer"]; try { var BOMDIDV = bomID; var PartNOV = PartNo.Text; var DIEV = DIE.Text; var ItemV = Item.Text; var DescriptionV = Descripcion.Text; var UnitV = Unit.Text; var UsageV = Usage.Text; var CostV = Costo.Text; var ExtV = Ext.Text; if (string.IsNullOrEmpty(PartNOV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el PartNo", "Aceptar"); PartNo.Focus(); return; } if (string.IsNullOrEmpty(DIEV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el DIE", "Aceptar"); DIE.Focus(); return; } if (string.IsNullOrEmpty(ItemV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el Item", "Aceptar"); Item.Focus(); return; } if (string.IsNullOrEmpty(DescriptionV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar la Descripcion", "Aceptar"); Descripcion.Focus(); return; } if (string.IsNullOrEmpty(UnitV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el Unit", "Aceptar"); Unit.Focus(); return; } if (string.IsNullOrEmpty(UsageV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el Usage", "Aceptar"); Usage.Focus(); return; } if (string.IsNullOrEmpty(CostV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el Cost", "Aceptar"); Costo.Focus(); return; } if (string.IsNullOrEmpty(ExtV)) { await DisplayAlert("Validacion", "Asegurarse de Ingresar el Ext", "Aceptar"); Ext.Focus(); return; } HttpClient client = new HttpClient(); client.BaseAddress = new Uri(connectionString); var BOMSDetalles = new BOMDetalles() { BOMDetalleID = 0, BOMID = BOMDIDV, PartNo = PartNOV, DIE = DIEV, Item = ItemV, Description = DescriptionV, Unit = UnitV, Usage = Convert.ToDecimal(UsageV), Cost = Convert.ToDecimal(CostV), Ext = Convert.ToDecimal(ExtV) }; //Convetir a Json var json = JsonConvert.SerializeObject(BOMSDetalles); StringContent stringContent = new StringContent(json, Encoding.UTF8, "application/json"); //Ejecutar el api el introduces el metodo var request = await client.PostAsync("/api/BOMDetalle/registrar", stringContent); if (request.IsSuccessStatusCode) { var responseJson = await request.Content.ReadAsStringAsync(); var respuesta = JsonConvert.DeserializeObject <Request>(responseJson); //Status if (respuesta.status) { await MaterialDialog.Instance.AlertAsync(message : "El Detalle del BOM se registro correctamente", title : "Registro", acknowledgementText : "Aceptar"); } else { await MaterialDialog.Instance.AlertAsync(message : "El Detalle del BOM no pudo registrarse correctamente", title : "Registro", acknowledgementText : "Aceptar"); } } else { await MaterialDialog.Instance.AlertAsync(message : "Error", title : "Error", acknowledgementText : "Aceptar"); } } catch (Exception ex) { await MaterialDialog.Instance.AlertAsync(message : ex.Message, title : "Error", acknowledgementText : "Aceptar"); } await Navigation.PushAsync(new Ingenieria.Ingenieria()); }
public static extern void update(IntPtr id, int row, int col, DIE die);
public static extern void die(IntPtr id, int row, int col, ref DIE die);