public void SaveAttachment(bool addOrUpdate, Action <InvFacilityAttachment> successAction, System.Action failedAction) { try { Model.Data = File.ReadAllBytes(Model.FileName); if (Model.Data.Length == 0) { _windowManager.ShowError("Save Attachment", "File No Content"); return; } // shorten file name Model.ContentType = (new FileInfo(FileName)).Extension.ToUpper(); Model.FileName = new FileInfo(FileName).Name; var saved = _facilitiesService.AddOrUpdateInvFacilityAttachment(this.Model, addOrUpdate); if (saved != null && successAction != null) { successAction(saved); } else if (saved == null && failedAction != null) { failedAction(); } } catch (IOException ex) { } }
public SettingsDialog(Action <string, List <string> > onSettingsSave, System.Action onSync, string savedSourceProjectName, List <string> savedTargetProjectNames) { this.onSettingsSave = onSettingsSave; this.onSync = onSync; this.savedSourceProjectName = savedSourceProjectName; this.savedTargetProjectNames = savedTargetProjectNames; Build(); FillTargetProjects(); FillSourceProjectCombo(); buttonSync.Sensitive = projectsCombo.Active > 0; }
protected void ReachAction(Target target, System.Action act) { if (target == null) { return; } if (ReadyToActOn(target)) { Debug.Log("Ready to perform reach action: " + Dist(target)); motor.Stop(); act(); status.Clear(); ExecPostAction(); } else { motor.Target(target); status.Pending(this, target); } }
IEnumerator DoLerpLabelFromTo(string label, Vector3 fromPos, Transform toTransform) { m_enemies.Paused = true; int id = m_nextID; ++m_nextID; Vector3 renderWorldPos = fromPos; Vector3 velocity = Vector3.zero; System.Action renderer = () => { var labelSize = GUI.skin.box.CalcSize(new GUIContent(label)); var renderScreenPos = Camera.main.WorldToScreenPoint(renderWorldPos); renderScreenPos.y = Screen.height - renderScreenPos.y; var labelRect = new Rect(renderScreenPos.x - labelSize.y, renderScreenPos.y, labelSize.x, labelSize.y); GUI.Box(labelRect, label); }; m_renderers[id] = renderer; yield return(new WaitForSeconds(m_initialPause)); while (true) { renderWorldPos = Vector3.SmoothDamp(renderWorldPos, toTransform.position, ref velocity, m_smoothTime); float sqDistToTarget = (toTransform.position - renderWorldPos).sqrMagnitude; if (sqDistToTarget < 0.35f) { break; } yield return(null); } m_renderers.Remove(id); yield return(new WaitForSeconds(m_postPause)); m_enemies.Paused = false; }
public void DeleteAttachment(Action <InvFacilityAttachment> successAction, System.Action failedAction) { var success = true; try { success = _facilitiesService.DeleteFacilityAttachment(this.Model); if (success && successAction != null) { successAction(this.Model); } else if (!success && failedAction != null) { failedAction(); } } catch (IOException ex) { success = false; } }
public ValueHolder(T defaultValue, System.Action del) { DefaultValue = defaultValue; Value = defaultValue; OnResourceChanged += del; }
public DisposableAction(System.Action disposeAction) { _disposeAction = disposeAction; }
public void SaveFacility(bool addOrUpdate, Action <InvFacility> successAction, System.Action failedAction) { // convert components this.Model.InvEquipments = new List <InvEquipment>(this.Equipments.Select(x => x.Model)); var saved = _facilitiesService.AddOrUpdateInvFacility(this.Model, addOrUpdate); if (saved != null && successAction != null) { successAction(saved); } else if (saved == null && failedAction != null) { failedAction(); } }
public BotFlow Do(System.Action action) { ActionsToPerformWhenCalled.Add(action); return(this); }