public override void UpdateFrame(float dt) { if (ticker60Fps.isTime (dt)) { nowMode = master.WingmanCommand; if (nowMode == ActionMode.Follow) { Follow (); } base.UpdateFrame (dt); } }
public override void Delete() { ActionMode = ActionMode.Delete; }
//there is an interval to wait for before the update will be done protected IEnumerator waitForNewUpdate(float delay, float timeelapsed, ActionMode action) { yield return new WaitForSeconds(delay); if (currentAction != ActionMode.STOPPED) timeelapsed += delay; //print("timeelapsed: "+timeelapsed); if (continueCallingUpdate) singleton.updateRecording(action); }
//this starts the recording of objects, which have been marked for recoring previously or while recording in progress public void record() { //markPredefinedObjects4Recording(); //mark the game objects from the public gui list for recording if (currentMode == ViewMode.LIVE) { if (currentAction == ActionMode.STOPPED) { //remove a previous recording foreach (KeyValuePair<GameObject, Object2PropertiesMapping> entry in gOs2propMappings) { //GameObject go = entry.Key; Object2PropertiesMapping propMapping = entry.Value; propMapping.clearStates(); } //reset everything to standard values recorderPosition = 0; recorderPositionStep = 1; orgRecorderPositionStep = 1; //set new action currentAction = ActionMode.RECORD; continueCallingUpdate = true; updateRecording(currentAction); sendCallback2All("__EZR_record", null); } else { if (showWarnings) Debug.LogWarning("EZReplayManager WARNING: Ordered to record when recorder was not in stopped-state. Will not start recording."); } } else { if (showWarnings) Debug.LogWarning("EZReplayManager WARNING: Ordered to record when recorder was in replay mode. Will not start recording."); } }
public GameObject GetDisk(int round, ActionMode mode) { GameObject newDisk = null; if (free.Count > 0) { newDisk = free[0].gameObject; free.Remove(free[0]); } else { newDisk = GameObject.Instantiate <GameObject>(diskPre, Vector3.zero, Quaternion.identity); newDisk.AddComponent <DiskData>(); } int seed = 0; if (round == 1) { seed = 150; } if (round == 2) { seed = 300; } int randomColor = Random.Range(seed, round * 499); if (randomColor > 500) { round = 2; } else if (randomColor > 300) { round = 1; } else { round = 0; } DiskData diskdata = newDisk.GetComponent <DiskData>(); if (round == 0) { diskdata.color = Color.yellow; diskdata.speed = 4.0f; newDisk.GetComponent <Renderer>().material.color = Color.yellow; } else if (round == 1) { diskdata.color = Color.red; diskdata.speed = 6.0f; newDisk.GetComponent <Renderer>().material.color = Color.red; } else if (round == 2) { diskdata.color = Color.blue; diskdata.speed = 8.0f; newDisk.GetComponent <Renderer>().material.color = Color.blue; } float randomX = Random.Range(-1f, 1f) < 0 ? -1 : 1; diskdata.direction = new Vector3(randomX, 1, 0); //若选择物理模式,则添加刚体组件 if (mode == ActionMode.PHYSICS) { newDisk.AddComponent <Rigidbody>(); } beUsed.Add(diskdata.GetInstanceID(), diskdata); newDisk.name = newDisk.GetInstanceID().ToString(); return(newDisk); }
public bool OnCreateActionMode(ActionMode mode, IMenu menu) { CreateContextMenu(menu); return(true); }
public void Drop() { action = GetActionMode(action, ActionMode.Drop); }
public static Image <Bgr, byte> GetLayoutImage(Model model, ActionMode mode) { //Stopwatch sw = new Stopwatch(); //sw.Start(); Image <Bgr, byte> img = null; if (model.Gerber is GerberFile) { if (model.Gerber.Visible) { switch (mode) { case ActionMode.Render: DrawColor(model); break; case ActionMode.Rotation: DrawColor(model); break; case ActionMode.Update_Color_Gerber: DrawColor(model); break; case ActionMode.Draw_Cad: break; case ActionMode.Select_Pad: break; default: break; } } //Console.WriteLine(sw.ElapsedMilliseconds); if (model.Gerber.Visible) { img = model.ImgGerberProcessedBgr.Copy(); if (model.Gerber.SelectPad != Rectangle.Empty) { HightLightSelectPad(img, model); } } else { img = new Image <Bgr, byte>(model.ImgGerberProcessedBgr.Size); } foreach (CadFile item in model.Cad) { if (item.Visible) { int x = item.X; int y = item.Y; double angle = item.Angle * Math.PI / 180.0; Color cl = item.Color; foreach (CadItem caditem in item.CadItems) { Point ct = Point.Round(caditem.Center); string txt = caditem.Name; ct.X += x; ct.Y += y; Point newCtRotate = ImageProcessingUtils.PointRotation(ct, new Point(item.CenterRotation.X + item.X, item.CenterRotation.Y + item.Y), angle); MCvScalar color = new MCvScalar(cl.B, cl.G, cl.R); if (item.SelectCenter != Rectangle.Empty) { Rectangle bound = new Rectangle(newCtRotate.X, newCtRotate.Y, 1, 1); if (item.SelectCenter.Contains(bound)) { color = new MCvScalar(255, 255, 255); } } if (model.ShowComponentCenter) { CvInvoke.Circle(img, newCtRotate, 3, color, -1); } if (model.ShowLinkLine) { if (caditem.Name != "UNDEFINE") { for (int i = 0; i < caditem.PadsIndex.Count; i++) { CvInvoke.Line(img, newCtRotate, model.Gerber.PadItems[caditem.PadsIndex[i]].Center, new MCvScalar(0, 255, 0), 1); } } } if (model.ShowComponentName) { newCtRotate.X += 5; CvInvoke.PutText(img, txt, newCtRotate, Emgu.CV.CvEnum.FontFace.HersheyDuplex, 0.5, color, 1, Emgu.CV.CvEnum.LineType.Filled); } } } } if (model.Gerber.Visible) { HightLightMarkPoint(img, model); } } return(img); }
public override void Ignore() { ActionMode = ActionMode.Ignor; }
public override void View() { ActionMode = ActionMode.View; }
public override void Update() { ActionMode = ActionMode.Update; }
public override void OK() { ActionMode = ActionMode.OK; }
public override void Search() { ActionMode = ActionMode.Search; }
public override void Insert() { ActionMode = ActionMode.Insert; }
public override void Edit() { ActionMode = ActionMode.Edit; }
// Called when the action mode is created; StartActionMode() was called public bool OnCreateActionMode(ActionMode mode, IMenu menu) { Activity.MenuInflater.Inflate(Resource.Menu.menu_locations_context, menu); return(true); }
// Called each time the action mode is shown. Always called after onCreateActionMode, but // may be called multiple times if the mode is invalidated. public bool OnPrepareActionMode(ActionMode mode, IMenu menu) { return(false); // false if nothing is done }
/// <remarks/> public System.IAsyncResult BeginGetActionsForForm(string statusid, string mezzotype, ActionMode mode, object target, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetActionsForForm", new object[] { statusid, mezzotype, mode, target}, callback, asyncState); }
void Update() { AnimRefresh(animator, move, action, speed); action = GetActionMode(action, action); move = GetMoveMode(speed, action); }
/// <remarks/> public System.IAsyncResult BeginGetActionsListForDocument(string statusid, ActionMode mode, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetActionsListForDocument", new object[] { statusid, mode}, callback, asyncState); }
public void OnDestroyActionMode(ActionMode mode) { Logger.Debug("onDestroyActionMode"); actionMode = null; inbox.ClearSelection(); }
public SerializedObject[] GetActionsForForm(string statusid, string mezzotype, ActionMode mode, object target) { object[] results = this.Invoke("GetActionsForForm", new object[] { statusid, mezzotype, mode, target}); return ((SerializedObject[])(results[0])); }
public bool OnPrepareActionMode(ActionMode mode, IMenu menu) { return(OnPrepareActionModeImpl(menu)); }
/// <remarks/> public void GetActionsForFormAsync(string statusid, string mezzotype, ActionMode mode, object target) { this.GetActionsForFormAsync(statusid, mezzotype, mode, target, null); }
protected override void OnLoad(EventArgs e) { if (!string.IsNullOrEmpty(DetailsViewID) && !string.IsNullOrEmpty(GridViewID)) throw new InvalidOperationException("Too many controls defined"); if (string.IsNullOrEmpty(DetailsViewID) && string.IsNullOrEmpty(GridViewID)) throw new InvalidOperationException("GridView or DetailsView ID is missing"); if (Items == null) Items = new Dictionary<string, StateContainer>(); _actionMode = string.IsNullOrEmpty(DetailsViewID) ? (string.IsNullOrEmpty(GridViewID) ? ActionMode.None : ActionMode.List) : ActionMode.Edit; switch (_actionMode) { case ActionMode.Edit: _detailView = (DetailsView)Parent.FindControl(DetailsViewID); if (_detailView != null) { _stateName = GetTableName(_detailView); if (!Items.ContainsKey(_stateName)) Items.Add(_stateName, new StateContainer()); } break; case ActionMode.List: _gridView = (GridView)Parent.FindControl(GridViewID); if (_gridView != null) { _stateName = GetTableName(_gridView); if (!Items.ContainsKey(_stateName)) Items.Add(_stateName, new StateContainer()); _gridView.PageIndexChanged += GridViewPagerIndexChanged; _gridView.Sorted += GridViewSorted; if (_gridView.BottomPagerRow != null && _gridView.BottomPagerRow.Cells[0].FindControl("GridViewPager") != null) { _pageSizer = (DropDownList) _gridView.BottomPagerRow.Cells[0].FindControl("GridViewPager").TemplateControl.FindControl( "DropDownListPageSize"); if (_pageSizer != null) _pageSizer.SelectedIndexChanged += PageSizeChanged; } if (!string.IsNullOrEmpty(FilterRepeaterID)) { FilterRepeater filterRepeater = (FilterRepeater)FindControl(Parent.Controls, FilterRepeaterID); if (filterRepeater != null) { List<UserControl> filterControls = GetFilterControls(filterRepeater); _filters = new List<DropDownList>(); foreach (UserControl ctl in filterControls) { DropDownList listbox = ctl.FindControl("DropDownList1") as DropDownList; if (listbox != null) { _filters.Add(listbox); listbox.SelectedIndexChanged += FilterSelectedIndexChanged; } } if (_filters.Count > 0) { Button btnClear = new Button(); btnClear.Text = "Снять все фильтры"; btnClear.Click += ClearFilters; btnClear.CssClass = "dropdown"; Controls.Add(btnClear); } } } } break; } if (!string.IsNullOrEmpty(RecentName) && _stateName != RecentName) Items[RecentName].Reset(); RecentName = _stateName; base.OnLoad(e); }
/// <remarks/> public void GetActionsForFormAsync(string statusid, string mezzotype, ActionMode mode, object target, object userState) { if ((this.GetActionsForFormOperationCompleted == null)) { this.GetActionsForFormOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetActionsForFormOperationCompleted); } this.InvokeAsync("GetActionsForForm", new object[] { statusid, mezzotype, mode, target}, this.GetActionsForFormOperationCompleted, userState); }
//replays a recording. public void play(int speed, bool playImmediately, bool backwards, bool exitOnFinished) { #if IS_UNLICENSED speed = 0; #endif //switch to correct mode if (currentMode != ViewMode.REPLAY) { switchModeTo(ViewMode.REPLAY); } if (speed >= minSpeedSliderValue && speed <= maxSpeedSliderValue) speedSliderValue = speed; else speedSliderValue = 0; //revert playing direction if neccessary if ((backwards && orgRecorderPositionStep > 0) || (!backwards && orgRecorderPositionStep < 0)) { orgRecorderPositionStep *= -1; } //set playing speed setReplaySpeed(speedSliderValue); if (currentAction == ActionMode.STOPPED || currentAction == ActionMode.PAUSED) { if (currentAction != ActionMode.PAUSED) stop(); if (playImmediately) currentAction = ActionMode.PLAY; this.exitOnFinished = exitOnFinished; continueCallingUpdate = playImmediately; updateRecording(currentAction); sendCallback2All("__EZR_play", null); } else if (showHints) print("EZReplayManager HINT: Ordered to play when not in stopped or paused state."); }
public SerializedObject[] GetActionsListForDocument(string statusid, ActionMode mode) { object[] results = this.Invoke("GetActionsListForDocument", new object[] { statusid, mode}); return ((SerializedObject[])(results[0])); }
public static void SetAction(DependencyObject obj, ActionMode cmdParam) { obj.SetValue(CmdActionProperty, cmdParam); }
/// <remarks/> public void GetActionsListForDocumentAsync(string statusid, ActionMode mode) { this.GetActionsListForDocumentAsync(statusid, mode, null); }
public bool OnPrepareActionMode(ActionMode mode, IMenu menu) { return(false); }
/// <remarks/> public void GetActionsListForDocumentAsync(string statusid, ActionMode mode, object userState) { if ((this.GetActionsListForDocumentOperationCompleted == null)) { this.GetActionsListForDocumentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetActionsListForDocumentOperationCompleted); } this.InvokeAsync("GetActionsListForDocument", new object[] { statusid, mode}, this.GetActionsListForDocumentOperationCompleted, userState); }
// Called when the user exits the action mode public void OnDestroyActionMode(ActionMode mode) { Adapter.DeselectAllItems(); Editing = false; }
/// <summary> /// /// </summary> /// <param name="_actMode"></param> /// <returns></returns> public bool SetActionMode(ActionMode _actMode ) { ActMode = _actMode; ActSetTime = DateTime.Now; return true; }
/// <summary> /// 获得飞碟 /// </summary> /// <param name="round"></param> /// <returns></returns> public GameObject GetDisk(int round, ActionMode mode) { GameObject newDisk = null; if (free.Count > 0) { newDisk = free[0].gameObject; free.Remove(free[0]); } else { newDisk = GameObject.Instantiate <GameObject>(diskPrefab, Vector3.zero, Quaternion.identity); newDisk.AddComponent <DiskData>(); } //根据round生成不同的飞碟 switch (round) { case 0: { newDisk.GetComponent <DiskData>().color = Color.blue; newDisk.GetComponent <DiskData>().speed = 6.0f; float RanX = Random.Range(-2f, 2f) < 0 ? -1 : 1; newDisk.GetComponent <DiskData>().direction = new Vector3(RanX, 1.5f, 0); newDisk.GetComponent <Renderer>().material.color = Color.blue; break; } case 1: { newDisk.GetComponent <DiskData>().color = Color.red; newDisk.GetComponent <DiskData>().speed = 8.0f; float RanX = Random.Range(-2f, 2f) < 0 ? -1 : 1; newDisk.GetComponent <DiskData>().direction = new Vector3(RanX, 1.2f, 0); newDisk.GetComponent <Renderer>().material.color = Color.red; break; } case 2: { newDisk.GetComponent <DiskData>().color = Color.black; newDisk.GetComponent <DiskData>().speed = 10.0f; float RanX = Random.Range(-2f, 2f) < 0 ? -1 : 1; newDisk.GetComponent <DiskData>().direction = new Vector3(RanX, 0.9f, 0); newDisk.GetComponent <Renderer>().material.color = Color.black; break; } } if (mode == ActionMode.PHYSICS) { newDisk.AddComponent <Rigidbody>(); } if (mode == ActionMode.KINEMATIC) { Destroy(newDisk.GetComponent <Rigidbody>()); } used.Add(newDisk.GetComponent <DiskData>()); newDisk.name = newDisk.GetInstanceID().ToString(); return(newDisk); }
/// <summary> /// /// </summary> /// <returns></returns> public bool update() { ActModeCnt++; if (ActModeOld != ActMode) { ActModeOld = ActMode; ActModeCnt = 0; } switch (ActMode) { // case ActionMode.None: ActMode = ActionMode.CheckPoint; break; // case ActionMode.CheckPoint: break; case ActionMode.EmergencyStop: break; } return true; }
public void setMode(ActionMode m) { this.gameObject.AddComponent<CCActionManager>(); mode = m; }
// Actions on items selected public bool OnCreateActionMode(ActionMode mode, IMenu menu) { parent.MenuInflater.Inflate(Resource.Menu.stops_select_menu, menu); mode.Title = parent.Resources.GetString(Resource.String.action_desciption_select_lines); return(true); }
public void Pick() { action = GetActionMode(action, ActionMode.Pick); }
public void OnDestroyActionMode(ActionMode mode) { linesToDelete.Clear(); }
public override void Reset() { mode = ActionMode.None; }
private void UpdateSubtitle(ActionMode mode) { mode.Subtitle = $"({this.ListView.CheckedItemCount})"; }
public RegistryEventArgs(TValue e, ActionMode actionMode) { Value = e; Mode = actionMode; }
private void btnSave_Click(object sender, EventArgs e) { int stt = this.CheckNumber(txtSTT); if (actionMode == ActionMode.Add) { if (DataTier.sttNhatKyChungExisted(this.cboYear.Text, stt.ToString())) { MessageBox.Show( "Số thứ tự này đã tồn tại trong cơ sở dữ liệu, mời bạn chọn số thứ tự khác.", "Số thứ tự bị trùng", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSTT.Focus(); return; } } string soChungTu = this.CheckRequiredField(txtSoChungTu); string description = this.CheckRequiredField(txtDescription); string soTKDUNo = this.CheckRequiredField(txtSoTKDUNo); decimal tienNo = this.CheckMoney(txtTienNo); string soTKDUThue = null; decimal tienThue = 0; if (cbxThueGTGT.Checked) { soTKDUThue = this.CheckRequiredField(txtSoTKDUGTGT); tienThue = this.CheckMoney(txtTienNoGTGT); } string soTKDUCo = this.CheckRequiredField(txtSoTKDUCo); decimal tienCo = this.CheckMoney(txtTienCo); if (!this.HasError()) { int result = 0; if (actionMode == ActionMode.Add) { result = this.tbl_NhatKyChungTableAdapter.Insert( stt, dtpNgayGhiSo.Value, soChungTu, dtpNgayChungTu.Value, soTKDUNo, tienNo, soTKDUThue, tienThue, soTKDUCo, tienCo, description); } else if (actionMode == ActionMode.Edit) { result = this.tbl_NhatKyChungTableAdapter.Update( stt, dtpNgayGhiSo.Value, soChungTu, dtpNgayChungTu.Value, soTKDUNo, tienNo, soTKDUThue, tienThue, soTKDUCo, tienCo, description); } if (result > 0) { this.ClearForm(); this.tbl_NhatKyChungTableAdapter.Fill(this.eMSDBDataSet.tbl_NhatKyChung, int.Parse(cboYear.Text)); this.SelectRowByID(nhatKyID.ToString()); this.dgvTheoDoiChuyenTien.Enabled = true; this.btnCancel.Visible = false; actionMode = ActionMode.Add; } else { MessageBox.Show( "Lưu dữ liệu không thành công, bạn hãy thử lại sau.", "Lưu dữ liệu không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void OnDestroyActionMode(ActionMode mode) { OnDestroyActionModeImpl(); _actionMode.Dispose(); _actionMode = null; }
public void OnItemCheckedStateChanged(ActionMode mode, int position, long id, bool @checked) { personGridViewAdapter.SetChecked(position, @checked); }
public override void OnActionModeStarted(ActionMode mode) { base.OnActionModeStarted(mode); }
private void btnSave_Click(object sender, EventArgs e) { decimal soDuThangTruoc = this.CheckMoney(txtSoDuThangTruoc); decimal tienDienNganHang = this.CheckMoney(txtTienDienNganHang); decimal nopMoi = this.CheckMoney(txtNopMoi); decimal tongCoTK = this.CheckMoney(txtTongCoTK); decimal traCtyDien = this.CheckMoney(txtTraCtyDien); decimal lePhiChuyenTien = this.CheckMoney(txtLePhiChuyenTien); decimal traSoTaiChinh = this.CheckMoney(txtTraSoTaiChinh); decimal conDu = this.CheckMoney(txtConDu); if (!this.HasError()) { int result = 0; if (actionMode == ActionMode.Add) { chuyenTienID = Guid.NewGuid(); result = this.tbl_TheoDoiChuyenTienTableAdapter.Insert( chuyenTienID, dtpNgayChuyenTien.Value, soDuThangTruoc, tienDienNganHang, nopMoi, tongCoTK, traCtyDien, lePhiChuyenTien, traSoTaiChinh, conDu, true, null); } else if (actionMode == ActionMode.Edit) { result = this.tbl_TheoDoiChuyenTienTableAdapter.Update( chuyenTienID, dtpNgayChuyenTien.Value, soDuThangTruoc, tienDienNganHang, nopMoi, tongCoTK, traCtyDien, lePhiChuyenTien, traSoTaiChinh, conDu); } if (result > 0) { this.ClearForm(); this.tbl_TheoDoiChuyenTienTableAdapter.Fill(this.eMSDBDataSet.tbl_TheoDoiChuyenTien, int.Parse(cboYear.Text)); this.SelectRowByID(chuyenTienID.ToString()); this.dgvTheoDoiChuyenTien.Enabled = true; this.btnCancel.Visible = false; actionMode = ActionMode.Add; } else { MessageBox.Show( "Lưu dữ liệu không thành công, bạn hãy thử lại sau.", "Lưu dữ liệu không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public bool OnActionItemClicked(ActionMode mode, IMenuItem item) { var listView = FragmentManager.FindFragmentById <GroupListFragment>(Resource.Id.list_fragment).ListView; var checkedItemPositions = listView.CheckedItemPositions; List <IStructureItem> checkedItems = new List <IStructureItem>(); for (int i = 0; i < checkedItemPositions.Size(); i++) { if (checkedItemPositions.ValueAt(i)) { checkedItems.Add(((PwGroupListAdapter)ListAdapter).GetItemAtPosition(checkedItemPositions.KeyAt(i))); } } //shouldn't happen, just in case... if (!checkedItems.Any()) { return(false); } Handler handler = new Handler(); switch (item.ItemId) { case Resource.Id.menu_delete: DeleteMultipleItems task = new DeleteMultipleItems((GroupBaseActivity)Activity, App.Kp2a.GetDb(), checkedItems, new GroupBaseActivity.RefreshTask(handler, ((GroupBaseActivity)Activity)), App.Kp2a); task.Start(); break; case Resource.Id.menu_move: var navMove = new NavigateToFolderAndLaunchMoveElementTask(checkedItems.First().ParentGroup, checkedItems.Select(i => i.Uuid).ToList(), ((GroupBaseActivity)Activity).IsSearchResult); ((GroupBaseActivity)Activity).StartTask(navMove); break; case Resource.Id.menu_copy: var copyTask = new CopyEntry((GroupBaseActivity)Activity, App.Kp2a, (PwEntry)checkedItems.First(), new GroupBaseActivity.RefreshTask(handler, ((GroupBaseActivity)Activity))); ProgressTask pt = new ProgressTask(App.Kp2a, Activity, copyTask); pt.Run(); break; case Resource.Id.menu_navigate: NavigateToFolder navNavigate = new NavigateToFolder(checkedItems.First().ParentGroup, true); ((GroupBaseActivity)Activity).StartTask(navNavigate); break; case Resource.Id.menu_edit: GroupEditActivity.Launch(Activity, checkedItems.First().ParentGroup, (PwGroup)checkedItems.First()); break; default: return(false); } listView.ClearChoices(); ((BaseAdapter)ListAdapter).NotifyDataSetChanged(); if (_mode != null) { mode.Finish(); } return(true); }
public void Attach(IBAL <BmsTransaction> balTransaction, IBAL <BmsHospital> balHospital, IBAL <BmsBloodInventory> balInventory, TextBlock applicationStatus, ActionMode mode = ActionMode.ADD, object value = null) { try { this.balTransaction = balTransaction; this.balInventory = balInventory; this.balHospital = balHospital; this.applicationStatus = applicationStatus; switch (mode) { case ActionMode.ADD: { txbTransactionID.Visibility = System.Windows.Visibility.Hidden; txtTransactionID.Visibility = System.Windows.Visibility.Hidden; txtTransactionID.Text = "-1"; var hospitalList = balHospital.GetAll().Where(c => c.City == MainWindow.CurrentAdminSystem.City); foreach (var item in hospitalList) { txtHospitalID.Items.Add(item.HospitalID); } var inentoryList = balInventory.GetAll().Where(c => c.BloodBankID == MainWindow.CurrentAdminSystem.BloodBankID); foreach (var item in inentoryList) { txtBloodInventoryID.Items.Add(item.BloodInventoryID); } txtCreationDate.Text = DateTime.Now.ToShortDateString(); btnAdd = new Button(); btnAdd.Name = "btnAdd"; btnAdd.Click += btnAdd_Click; btnAdd.Content = "Transaction"; stackButtons.Children.Add(btnAdd); btnReset = new Button(); btnReset.Name = "btnReset"; btnReset.Click += btnReset_Click; btnReset.Content = "Reset"; stackButtons.Children.Add(btnReset); } break; case ActionMode.UPDATE: { PopulateFields((BmsTransaction)value); EditableFields(); btnUpdate = new Button(); btnUpdate.Name = "btnUpdate"; btnUpdate.Click += btnUpdate_Click; btnUpdate.Content = "Edit"; stackButtons.Children.Add(btnUpdate); } break; case ActionMode.DELETE: { EditableFields(); PopulateFields((BmsTransaction)value); btnDelete = new Button(); btnDelete.Name = "btnDelete"; btnDelete.Click += btnDelete_Click; btnDelete.Content = "Delete"; stackButtons.Children.Add(btnDelete); } break; } } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } }
//stopping is essential to all other actions for resetting settings before switching public void stop() { continueCallingUpdate = false; currentAction = ActionMode.STOPPED; timeelapsed = 0.0f; if (orgRecorderPositionStep < 0) recorderPosition = maxPositions; else recorderPosition = 0; surplus = 0.0f; execRecorderAction(); sendCallback2All("__EZR_stop", null); }
public bool OnActionItemClicked(ActionMode mode, IMenuItem item) { AlertBox.Create("Delete", "Are you sure", activity); return(true); }
//halt a replay public void pause() { if (currentMode == ViewMode.REPLAY) { currentAction = ActionMode.PAUSED; setReplaySpeed(minSpeedSliderValue); sendCallback2All("__EZR_pause", null); } else if (showWarnings) Debug.LogWarning("EZReplayManager WARNING: Ordered to pause when recorder was not in replay mode. Will not pause."); }
public bool OnActionItemClicked(ActionMode mode, IMenuItem item) { return(false); }
//update recording/replaying position and start timer to next update protected void updateRecording(ActionMode action) { float updateStartingTime = Time.realtimeSinceStartup; bool mayBeNull = false; float interval = recordingInterval; if (currentAction != ActionMode.STOPPED && action == currentAction) { //if action has not changed sinds last update if (currentMode == ViewMode.REPLAY) { interval = playingInterval; } //execute current recorder action execRecorderAction(); float updateEndingTime = Time.realtimeSinceStartup; if ((updateEndingTime - updateStartingTime) < interval) { // if updating didn't take longer than the current interval //substract surplus during more than one frame cycle to come to zero surplus float surplusToEliminate = 0.0f; if (surplus > 0.0f) { //if there is interval surplus.. //..it has to be eliminated surplusToEliminate = (interval - (updateEndingTime - updateStartingTime)); if (surplusToEliminate > surplus) surplusToEliminate = surplus; } //determine interval to next update interval -= (updateEndingTime - updateStartingTime) - surplusToEliminate; mayBeNull = true; if (surplusToEliminate > 0.0f) { surplus -= surplusToEliminate; if (surplus < 0.0f) surplus = 0.0f; } } else { //if updating took longer than the interval surplus += (updateEndingTime - updateStartingTime) - interval; //..add to surplus //update immediately interval = 0.0f; mayBeNull = true; } /*timeelapsed += (updateEndingTime - updateStartingTime) + surplus; //<-- uncomment to make timeelapsed global print("timeelapsed: "+timeelapsed);*/ //timeelapsed = (updateEndingTime - updateStartingTime); //<-- uncomment to make timeelapsed only about this cycle if ((((recorderPosition + recorderPositionStep > -1)) || ((recorderPosition + recorderPositionStep < maxPositions))) && continueCallingUpdate) //if in the "middle of something" //should be the only place where to increase recorderPosition recorderPosition += recorderPositionStep; else stop(); //stop on finishing an action if ((interval > 0.0f || mayBeNull) && currentAction != ActionMode.PAUSED && currentAction != ActionMode.STOPPED && continueCallingUpdate) { //if another update can be done StartCoroutine(waitForNewUpdate(interval, timeelapsed, action)); //don't ignore surplus //StartCoroutine(waitForNewUpdate(playingInterval,timeelapsed,action)); //ignore surplus } } }
public bool OnCreateActionMode(ActionMode mode, IMenu menu) { SetChoicedStop(null); return(false); }
//bad function name: not only sets replay speed but also returns a string describing the replaying speed relative to the recording speed protected string setReplaySpeed(int speed) { string ret = ""; if (speed == minSpeedSliderValue) { playingInterval = 0.0f; recorderPositionStep = orgRecorderPositionStep; currentAction = ActionMode.PAUSED; ret = "Paused"; } else if (speed > speedSliderValueBackup) { playingInterval = singleton.recordingInterval; int increaser = 1; if (orgRecorderPositionStep < 0) increaser = -1; recorderPositionStep = (orgRecorderPositionStep * speed) + increaser; int multiplicator = (int)Mathf.Round(recorderPositionStep / orgRecorderPositionStep); ret = "~ " + multiplicator + "x faster"; } else if (speed < speedSliderValueBackup) { playingInterval = singleton.recordingInterval * ((speed - 1) * -2); recorderPositionStep = orgRecorderPositionStep; int divisor = (int)Mathf.Round(playingInterval / singleton.recordingInterval); ret = "~ " + divisor + "x slower"; } else /*if (speed == sliderValueBackup)*/ { playingInterval = singleton.recordingInterval; recorderPositionStep = orgRecorderPositionStep; ret = "~ Recording speed"; } return ret; }
public void OnDestroyActionMode(ActionMode mode) { }
/// <summary> /// Start /// </summary> /// <returns></returns> public void StartAction(ActionMode actionMode) { if (_backgroundWorker == null) _backgroundWorker = CreateBackGroundWorker(); if (_backgroundWorker.IsBusy) { return; } ViewModel.TaskMode = actionMode; CurrentView.ShowResultLogMessage(string.Empty, false); // Start the BackgroundWorker _backgroundWorker.RunWorkerAsync(); }
public override void Cancel() { ActionMode = ActionMode.Cancel; }