protected virtual void doDelete(DataRow dataRow) { if (canDelete(dataRow, false)) { ToolMsg.confirm(this, MessageCollection.T_MSG_COMMIT_DELETE, delegate() { _doDelete(dataRow); }, null); } }
protected bool startSave() { try { FinishDataEditing(); if (_checkLevel) { DataRow row = ToolRow.getFirstRealRow(_tableSchema); double amount = (double)ToolCell.isNull(row[TableDUMMY.AMOUNT], 0.0); double onhand = (double)ToolCell.isNull(_curMatRecord[TableDUMMY.ONHAND], 0.0); if ((amount - onhand) > ConstValues.minPositive) { ToolMsg.show(this, MessageCollection.T_MSG_INVALID_QUANTITY, null); return(false); } } DataRow _rowActiveUnit = this.BindingContext.getBindingItemRecord(cUnit); // if (_rowActiveUnit != null) { switch (handler.converCol(handler.column)) { case TableDUMMY.AMOUNT: ToolCell.set(handler.row, TableSTLINE.AMOUNT, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.AMOUNT]); // if (_rowActiveUnit != null) { ToolCell.set(handler.row, TableSTLINE.UNIT, _rowActiveUnit[TableDUMMY.UNIT]); ToolCell.set(handler.row, TableSTLINE.UNITREF, _rowActiveUnit[TableDUMMY.UNITREF]); ToolCell.set(handler.row, TableSTLINE.UINFO1, _rowActiveUnit[TableDUMMY.UNITCF01]); ToolCell.set(handler.row, TableSTLINE.UINFO2, _rowActiveUnit[TableDUMMY.UNITCF02]); } // return(true); case TableDUMMY.PRICE: ToolCell.set(handler.row, TableSTLINE.PRICE, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.PRICE]); return(true); case TableDUMMY.DISCPER: ToolCell.set(handler.row, TableSTLINE.DISCPER, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.DISCPER]); return(true); case TableDUMMY.TOTAL: ToolCell.set(handler.row, TableSTLINE.TOTAL, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.TOTAL]); return(true); } } } catch (Exception exc) { ToolMobile.setException(exc); } return(false); }
private void menuItem2_Click(object sender, EventArgs e) { if (ToolMsg.confirm(environment, MessageCollection.T_MSG_COMMIT_EXIT)) { environment.getTopForm().DialogResult = DialogResult.Cancel; this.Close(); } }
protected override bool userCancelAllow() { ToolMsg.confirm(this, MessageCollection.T_MSG_COMMIT_EXIT, () => { this.userCancelDone(); }, null); return(false); }
public object done() { Action startJob_ = () => { log.exceuteInContext = _done; log.show(); }; Action askFirm_ = () => { string firms_ = CurrentVersion.ENV.getFirms(); if (firms_ == string.Empty) { startJob_.Invoke(); } else { List <string> lNr = new List <string>(); List <string> lDesc = new List <string>(); string[] arr_ = ToolString.explodeList(firms_); // for (int i = 0; i < arr_.Length; i += 2) { lNr.Add(arr_[i]); lDesc.Add(arr_[i + 1]); } // ToolMsg.askList(null, lDesc.ToArray(), (s, e) => { int nr_ = XmlFormating.helper.parseInt(lNr[e.Which]); int port_ = CurrentVersion.getPortByFirmNr(nr_); CurrentVersion.ENV.setEnv(CurrentVersion.ENV.PORT, XmlFormating.helper.format(port_)); startJob_.Invoke(); } ); } }; ToolMsg.confirm(null, string.Format("{0} - {1}", MessageCollection.T_MSG_COMMIT_BEGIN, MessageCollection.T_MSG_DATA_RECEIVING), () => { askFirm_(); //log.exceuteInContext = _done; //log.show(); }, null); return(null); }
protected override void OnResume() { base.OnResume(); if (inited) { var firmName_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_FIRMNAME) ?? ""; var agentId_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_AGENT_ID) ?? ""; firmName_ = ToolString.left(firmName_, 15); var newLabel_ = string.Format( "{0} - {1} ({2})", ToolMobile.Name, string.IsNullOrEmpty(firmName_) ? "*" : firmName_, string.IsNullOrEmpty(agentId_) ? "000" : agentId_ ); var oldLabel_ = this.Title; if (oldLabel_ != newLabel_) { this.Title = newLabel_; } } /////////////////////////////////////////////////////////////////////////////////////////// //var _nfcAdapter = Android.Nfc.NfcAdapter.DefaultAdapter; //// Create an intent filter for when an NFC tag is discovered. When //// the NFC tag is discovered, Android will u //var tagDetected = new IntentFilter(Android.Nfc.NfcAdapter.ActionTagDiscovered); //var filters = new[] { tagDetected }; //// When an NFC tag is detected, Android will use the PendingIntent to come back to this activity. //// The OnNewIntent method will invoked by Android. //var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop); //var pendingIntent = PendingIntent.GetActivity(this, 0, intent, 0); //_nfcAdapter.EnableForegroundDispatch(this, pendingIntent, filters, null); if (errMessageOnResume != null) { var err = errMessageOnResume; errMessageOnResume = null; ToolMsg.show(this, err, null); } }
//void onSaved() //{ // try // { // if (CurrentVersion.ENV.getEnvBool("SENDONSAVE", false)) // { // var a = environment.toActivity("tool.data.export", null); // if (a != null) // a.done(); // } // } // catch (Exception exc) // { // environment.getExceptionHandler().setException(exc); // } //} //user need cancel public void cancel(Form pForm) { ToolMsg.confirm(pForm, MessageCollection.T_MSG_COMMIT_CLOSE, () => { environment.docEnd(); if (pForm != null) { pForm.Close(); } }, null); }
void cBtnDesc_Click(object sender, EventArgs e) { if (descList != null && descList.Length > 0) { ToolMsg.askList(this, descList, delegate(object s, DialogClickEventArgs a) { if (a.Which >= 0 && a.Which < descList.Length) { string val_ = descList[a.Which]; ToolColumn.setColumnValue(userAdapter.getDataSet().Tables[TableKSLINES.TABLE], TableKSLINES.LINEEXP, val_); } }); } }
void _setException(Exception exc, String msg, object[] vars, Action pAction) { try { { var agg_ = exc as AggregateException; if (agg_ != null && agg_.InnerExceptions != null && agg_.InnerExceptions.Count > 0) { log.set(exc.ToString()); foreach (Exception e in agg_.InnerExceptions) { setException(e); } return; } } if (msg != null && msg != string.Empty) { string text = ToolException.unwrap(exc); #if DEBUG Console.WriteLine(exc.ToString()); #endif log.set(text); log.set(exc.ToString()); if (exc.InnerException != null) { log.set(exc.InnerException.ToString()); } // log.flush(); if (showUser) { ToolMsg.show(null, text, pAction); } } } catch (Exception err) { } }
/////////////////////////////////////////////////////////////////////////////////////////// #region Start void MobFormMain_Creating(object sender, EventArgs e) { addActivityExt(this);//dontwait resume //ToolMobile.setContext(this); // MobEnvironment.startEnv(); // if (inited) { if (ToolMobile.getEnvironment() == null) { ToolMsg.show(this, "Cant start", delegate() { Close(); }); } } }
protected override void returnData(DataRow pRow) { reset(); if (pRow != null) { string barcode = pRow[TableDUMMY.VALUE].ToString().Trim(); if (barcode != string.Empty) { var p = new PARSER(barcode, CurrentVersion.ENV.getEnvString("WEIGHTBARCODE", "")); barcode = p.CODE1; IPagedSource ps = reference.getPagedSource(); ps.getBuilder().reset(); ps.getBuilder().beginWhereGroup(); ps.getBuilder().addParameterValue(TableITEMS.BARCODE1, barcode, SqlTypeRelations.equal, SqlTypeRelations.boolOr); if (CurrentVersion.ENV.getEnvBool("BARCODEMULTI", false)) { ps.getBuilder().addParameterValue(TableITEMS.BARCODE2, barcode, SqlTypeRelations.equal, SqlTypeRelations.boolOr); ps.getBuilder().addParameterValue(TableITEMS.BARCODE3, barcode, SqlTypeRelations.equal, SqlTypeRelations.boolOr); } ps.getBuilder().endWhereGroup(); DataTable matTab = ps.getAll(); if (matTab != null && matTab.Rows.Count > 0) { DataRow matRow = matTab.Rows[0]; DataRow matRowExt = selectUnit(matRow, barcode, p.WEIGHT); base.returnData(matRowExt); } else { ToolMobile.playAlarmAndVibrate(); ToolMsg.show(this, MessageCollection.T_MSG_INVALID_BARCODE, null); } } } }
void cBtnUnit_Click(object sender, EventArgs e) { try { List <string> list = new List <string>(); foreach (DataRow r in _tableSchema.Rows) { list.Add(r[TableDUMMY.UNIT].ToString()); } ToolMsg.askList(this, list.ToArray(), delegate(object s, DialogClickEventArgs a) { this.BindingContext.setBindingItemPosition(cUnit, a.Which); }); } catch (Exception exc) { ToolMobile.setException(exc); } }