protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { ShellTile mainTile = ShellTile.ActiveTiles.FirstOrDefault(); switch (action) { case UserAction.Play: if (PlayState.Paused == player.PlayerState) { player.Play(); mainTile.Update(new StandardTileData { BackContent = "Play" }); } break; case UserAction.Pause: player.Pause(); mainTile.Update(new StandardTileData { BackContent = "Pause" }); break; } NotifyComplete(); }
public Control(int panelId, DataTable data, List<string> PKColNames, UserAction action) { this.panelId = panelId; this.data = data; this.PKColNames = PKColNames; this.action = action; }
/// ------------------------------------------------------------------------------------ public CalendarCell(Func<DateTime> getDefaultValue, UserAction whenToUseDefault) { _getDefaultValue = getDefaultValue ?? (() => DateTime.Now.Date); _whenToUseDefault = whenToUseDefault; // Use the short date format. Style.Format = "d"; }
protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: if (PlayState.Playing != player.PlayerState) { player.Play(); } break; case UserAction.Stop: player.Stop(); break; case UserAction.Pause: if (PlayState.Playing == player.PlayerState) { player.Pause(); } break; case UserAction.Rewind: player.Position = player.Position.Subtract(new TimeSpan(0,0,10)); break; case UserAction.FastForward: player.Position = player.Position.Add(new TimeSpan(0,0,10)); break; } NotifyComplete(); }
public ActionResult Display(string name) { ProfileViewModel profileViewModel = new ProfileViewModel(); User displayUser = null; int userID = 0; User thisUser = Users.GetLoggedInUser(); if (Int32.TryParse(name, out userID)) { displayUser = Users.GetUser(userID); } else { displayUser = Users.GetUser(name); } if (displayUser == null) { return RedirectToAction("Index"); } profileViewModel.User = displayUser; // relationships if (displayUser.UserID != thisUser.UserID) { profileViewModel.CommonUserRelationships = UserRelationships.GetCommonRelationshipUsers(displayUser.UserID, thisUser.UserID); profileViewModel.CommonCarsCourses = UserRelationships.GetCommonCourses(displayUser.UserID, thisUser.UserID); profileViewModel.ViewerRelationshipToUser = UserRelationships.GetRelationshipStatus(thisUser.UserID, displayUser.UserID); } else { profileViewModel.CommonUserRelationships = null; profileViewModel.CommonCarsCourses = null; } /* profileViewModel.Children = db.FamilyMember .Where(fm => fm.UserID == displayUser.UserID && fm.Family == "C") .OrderBy(fm => fm.BirthDate) .ToList(); profileViewModel.Spouses = db.CarsRelationships .Where(fm => (fm.PrimaryID == displayUser.UserID && fm.Relationship == "HW") || (fm.SecondaryID == displayUser.UserID && fm.Relationship == "WH")) .ToList(); */ UserAction ua = new UserAction() { SourceUserID = thisUser.UserID, TargetUserID = displayUser.UserID, UserActionType = UserActionType.ViewProfile, ActionDate = DateTime.Now, GroupID = 0, MessageID = 0, PostCommentID = 0, PostID = 0, Text = "" }; db.UserActions.Add(ua); db.SaveChanges(); return View(profileViewModel); }
/// <summary> /// Called when the user requests an action using system-provided UI and the application has requesed /// notifications of the action /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { if (action == UserAction.Play) player.Play(); else if (action == UserAction.Pause) player.Pause(); NotifyComplete(); }
public IList<UserAction> AddActionAtFirstIndex(UserAction action) { using (IRedisTypedClient<UserAction> redis = _redisClient.GetTypedClient<UserAction>()) { IRedisList<UserAction> userActions = redis.Lists["user:actions"]; userActions.Enqueue(action); return userActions; } }
public Control(int panelId, Panel panel, int targetPanelId, Panel targetPanel, DataTable data, List<string> PKColNames, UserAction action) { this.panelId = panelId; this.data = data; this.PKColNames = PKColNames; this.action = action; this.panel = panel; this.targetPanel = targetPanel; this.targetPanelId = targetPanelId; }
public void AddMovie(Guid userId, string userName, Movie movie) { TinyMovie tinyMovie = (TinyMovie)movie; user_movie userMovie = Mapper.Map<TinyMovie, user_movie>(tinyMovie); userMovie.user_movie_user_id = userId; _userMovieRepo.Insert(userMovie); UserAction actionToAdd = new UserAction(userName, movie); actionToAdd.Action = Action.ADD_MOVIE; AddUserAction(actionToAdd); }
//Methods public void doAction(UserAction userAction) { userAction.doAction(); actionList.AddFirst(userAction); //cancel old actions if (countUndo > 0) { countUndo = 0; actionUndoList.Clear(); } }
public TreeControl(DataTable data, string PKColName, // tree controls must have a single-column primary key string parentColName, string displayColName, UserAction action) : base(data, PKColName, action) { this.parentColName = parentColName; this.displayColName = displayColName; ds = new DataSet(); this.data.TableName = "data"; ds.Tables.Add(this.data); ds.Relations.Add("hierarchy", ds.Tables[0].Columns[PKColNames[0]], ds.Tables[0].Columns[parentColName]); }
private void btnAddNewGlassType_Click(object sender, RoutedEventArgs e) { _glassTypeAction = UserAction.AddNew; btnSaveNewGlassType.IsEnabled = true; txtGlassTypeName.IsReadOnly = false; btnAddNewGlassType.IsEnabled = false; btnEditGlassType.IsEnabled = false; btnSaveNewGlassType.IsEnabled = true; btnDeleteGlassType.IsEnabled = false; btnCancelGlassType.IsEnabled = true; txtGlassTypeName.Focus(); }
public static void LoadFromXML(string path, ref List<UserAction> ActionList) { FileStream fs = null; try { fs = new FileStream(path, FileMode.Open, FileAccess.Read); XmlReader xrReport = XmlReader.Create(fs); XmlDocument xdoc = new XmlDocument(); xdoc.Load(xrReport); // xdoc.SelectSingleNode("/Record/ ActionHost.ptWindowPoint = new System.Drawing.Point( Convert.ToInt32(xdoc.DocumentElement.SelectSingleNode("LeftTop/Top").InnerText), Convert.ToInt32(xdoc.DocumentElement.SelectSingleNode("LeftTop/Left").InnerText) ); ActionHost.szTargetBounds = new System.Drawing.Size( Convert.ToInt32(xdoc.DocumentElement.SelectSingleNode("RightBottom/Right").InnerText) - ActionHost.ptWindowPoint.X, Convert.ToInt32(xdoc.DocumentElement.SelectSingleNode("RightBottom/Bottom").InnerText) - ActionHost.ptWindowPoint.Y ); ActionHost.strTargetExeName = xdoc.DocumentElement.SelectSingleNode("ProgramExe").InnerText; ActionHost.TargetWindow = new IntPtr(Convert.ToInt32(xdoc.DocumentElement.SelectSingleNode("MainWindowHandle").InnerText)); XmlNodeList xnlEvents = xdoc.SelectNodes("Record/Events/Event"); foreach (XmlNode xnEvent in xnlEvents) { System.Windows.Forms.Message mes = new System.Windows.Forms.Message(); mes.Msg = Int32.Parse(xnEvent.SelectSingleNode("Message").InnerXml); int mouseX = Int32.Parse(xnEvent.SelectSingleNode("Coords/X").InnerXml); int mouseY = Int32.Parse(xnEvent.SelectSingleNode("Coords/Y").InnerXml); System.Drawing.Point mouseCoords = new System.Drawing.Point(mouseX, mouseY); UserAction uaItem = new UserAction(mes, (uint)ActionHost.TargetWindow.ToInt32()); uaItem.MouseCoords = mouseCoords; ActionHost.AddItem(uaItem); string val = xnEvent.InnerXml; } xrReport.Close(); } finally { fs.Close(); } }
/// <summary> /// Called when the user requests an action using system-provided UI and the application has requesed /// notifications of the action /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: playTrack(player); break; case UserAction.Stop: player.Stop(); break; } NotifyComplete(); }
public void SwipeControl(UserAction action) { if (action == UserAction.SWIPE_RIGHT && IsBackRun){ IsBackRun = false; } else if (action == UserAction.SWIPE_RIGHT && !IsBackRun) { IsForwardRun = true; } else if (action == UserAction.SWIPE_LEFT && IsForwardRun) { IsForwardRun = false; } else if (action == UserAction.SWIPE_LEFT && !IsForwardRun) { IsBackRun = true; } else if (action == UserAction.SWIPE_UP) { IsJump = true; } }
private void NotifyUserAction(UserAction arg1, IDictionary<string, object> arg2) { Debug.Log("Event: NotifyUserAction Fired"); //The following are potential UserActions: // AchievementViewAction = 100, // AchievementEngagedAction = 101, // AchievementDismissedAction = 102, // SponsorContentViewedAction = 103, // SponsorContentEngagedAction = 104, // SponsorContentDismissedAction = 105, // PortalViewedAction = 106, // SignInAction = 107, // SignOutAction = 108, // RegisteredAction = 109, // PortalDismissedAction = 110, // RedeemedRewardAction = 111, // CheckinCompletedAction = 112, // VirtualItemRewardAction = 113 }
/// <summary> /// Called when the user requests an action using application/system provided UI /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported. /// /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks. /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: PlayTrack(player); break; case UserAction.Pause: player.Pause(); break; case UserAction.SkipPrevious: PlayPreviousTrack(player); break; case UserAction.SkipNext: PlayNextTrack(player); break; } NotifyComplete(); }
public IList<UserAction> AddUserAction(UserAction action) { IList<UserAction> userActions = new List<UserAction>(); try { userActions = _userActionDAO.AddActionAtFirstIndex(action); if (userActions.Count == UserActionsLength) { userActions = _userActionDAO.RemoveLastAction(); } return userActions; } catch (Exception ex) { new LogEvent(ex.Message).Raise(); } return userActions; }
public bool ArticleCommentCreateDeleteUpdate(ArticleComment articleComment, UserAction ua) { bool result = false; string commandText = string.Empty; switch (ua) { case UserAction.Create: commandText = "INSERT INTO ArticleComment (ArticleCommentID, ArticleCommentText, UserID, UserName, UserAddress, ArticleCommentCreateTime, ArticleID) VALUES ("+ articleComment.CommentID +", '"+articleComment.CommentText +"',"+articleComment.UserID +", '"+articleComment.UserName +"', '"+articleComment.UserAddress +"','"+articleComment.CommentCreateTime +"',"+articleComment.ArticleID +")"; break; case UserAction.Delete: commandText = "DELETE FROM ArticleComment WHERE (ArticleCommentID = "+articleComment.CommentID +")"; break; case UserAction.Update: commandText = "UPDATE ArticleComment SET ArticleCommentText = '"+articleComment.CommentText +"', UserID = "+articleComment.UserID +", UserName = '******', UserAddress = '"+articleComment.UserAddress + "',ArticleCommentCreateTime = '"+articleComment.CommentCreateTime +"', ArticleID = "+articleComment.ArticleID +" WHERE (ArticleCommentID = "+articleComment.CommentID +")"; break; } using (SqlConnection conn = new SqlConnection(DataHelper2.SqlConnectionString)) { using (SqlCommand comm = new SqlCommand()) { comm.CommandText = commandText; comm.Connection = conn; conn.Open(); try { comm.ExecuteNonQuery(); result = true; } catch (Exception ex) { throw new Exception(ex.Message); } } } return result; }
public void Refresh() { ActionContains.Children.Clear(); if(_actionList != null && _actionList.Count !=0) { for (int i=0; i < _actionList.Count; i++) { UserAction action = new UserAction(); action.MyAction = _actionList[i]; action.Index = i; action.OnSelectThis += action_OnSelectThis; action.OnEditThis +=action_OnEditThis; ActionContains.Children.Add(action); } InvalidateVisual(); if (OnCurrentActionChange != null) { OnCurrentActionChange(this,null); } } }
public Control(int panelId, string caption, UserAction action) : this(panelId, new DataTable(), "caption", action) { data.Columns.Add("caption"); data.Rows.Add(caption); }
public void Run(UserAction action) { switch (action) { case UserAction.Show: { var id = ReadEmployeeId(); var employee = DbHelper.GetEmployee(id); Console.WriteLine(employee.ToString()); break; } case UserAction.Raise: { var id = ReadEmployeeId(); var employee = DbHelper.GetEmployee(id); var happyEmployee = GiveRaise(employee, RAISE_RATE); Console.WriteLine("Employee " + employee); Console.WriteLine("Happy Employee " + happyEmployee); break; } case UserAction.Promote: { var id = ReadEmployeeId(); var employee = DbHelper.GetEmployee(id); var happyEmployee = GivePromotion(employee, RAISE_RATE); Console.WriteLine("Employee " + employee); Console.WriteLine("Happy Employee " + happyEmployee); break; } case UserAction.ReportAll: { var employees = DbHelper.GetEmployees(); var report = employees .GroupBy(x => x.Role) .ToDictionary( xs => xs.Key, xs => xs.Select(x => x.Salary / 52).Sum() ); EmployeeAppHelpers.PrintReport(report); break; } case UserAction.ReportByRole: { var employees = DbHelper.GetEmployees(); var role = ReadRole(); // NOTE: there many ways to do this var report = employees .GroupBy(x => x.Role) .Where(x => x.Key == role) .ToDictionary( xs => xs.Key, xs => xs.Select(x => x.Salary / 52).Sum() ); EmployeeAppHelpers.PrintReport(report); break; } default: throw new Exception($"Something really bad has happened, Action of {action} is invalid"); } }
private void btnSave_Click(object sender, EventArgs e) { if (!btnSave.Enabled) { return; } Validator _validator = SCMS.Validators[this]; if (!Materia.Valid(_validator, txtAccountNo, !string.IsNullOrEmpty(txtAccountNo.Text.RLTrim()), "Please specify bank account number.")) { return; } if (!Materia.Valid(_validator, txtAccountName, !string.IsNullOrEmpty(txtAccountName.Text.RLTrim()), "Please specify bank account name.")) { return; } if (!Materia.Valid(_validator, cboBankingCompany, cboBankingCompany.SelectedIndex >= 0, "Please specify a valid banking company.")) { return; } if (!Materia.Valid(_validator, cboCurrency, cboCurrency.SelectedIndex >= 0, "Please specify bank currency.")) { return; } if (!Materia.Valid(_validator, cboAccountCode, cboAccountCode.SelectedIndex >= 0, "Please specify bank's associated G/L account.")) { return; } DataTable _bankaccounts = Cache.GetCachedTable("bankaccounts"); if (_bankaccounts != null) { DataRow[] _rows = _bankaccounts.Select("([AccountNo] LIKE '" + txtAccountNo.Text.ToSqlValidString(true) + "' AND\n" + " [Company] LIKE '" + SCMS.CurrentCompany.Company.ToSqlValidString(true) + "') AND\n" + "NOT ([BankAccountCode] LIKE '" + _bankaccountcode.ToSqlValidString(true) + "')"); if (!Materia.Valid(_validator, txtAccountNo, _rows.Length <= 0, "Account already exists.")) { return; } string _query = ""; string _refno = ""; string _seriesno = ""; DataColumnCollection _cols = _bankaccounts.Columns; if (_isnew) { Func <string, bool, string> _delegate = new Func <string, bool, string>(SCMS.GetTableSeriesNumber); IAsyncResult _result = _delegate.BeginInvoke("bankaccounts", true, null, _delegate); while (!_result.IsCompleted && !_cancelled) { Thread.Sleep(1); Application.DoEvents(); } if (_cancelled) { if (!_result.IsCompleted) { try { _result = null; } catch { } finally { Materia.RefreshAndManageCurrentProcess(); } } return; } _seriesno = _delegate.EndInvoke(_result); _refno = "BANK-" + SCMS.CurrentCompany.Company + "-" + _seriesno; object[] _values = new object[_cols.Count]; _values[_cols["BankAccountCode"].Ordinal] = _refno; _values[_cols["AccountNo"].Ordinal] = txtAccountNo.Text; _values[_cols["AccountName"].Ordinal] = txtAccountName.Text; _values[_cols["Currency"].Ordinal] = cboCurrency.SelectedValue.ToString(); _values[_cols["AccountCode"].Ordinal] = cboAccountCode.SelectedValue; _values[_cols["Swift"].Ordinal] = txtSwift.Text; _values[_cols["IBAN"].Ordinal] = txtIban.Text; _values[_cols["Bank"].Ordinal] = cboBankingCompany.SelectedValue; _values[_cols["Branch"].Ordinal] = txtBranch.Text; _values[_cols["Notes"].Ordinal] = txtNotes.Text; _values[_cols["Company"].Ordinal] = SCMS.CurrentCompany.Company; _values[_cols["DateCreated"].Ordinal] = DateTime.Now; _values[_cols["LastModified"].Ordinal] = DateTime.Now; _bankaccounts.Rows.Add(_values); } else { DataRow[] _existing = _bankaccounts.Select("[BankAccountCode] LIKE '" + _bankaccountcode.ToSqlValidString(true) + "'"); if (_existing.Length > 0) { _existing[0]["AccountNo"] = txtAccountNo.Text; _existing[0]["AccountName"] = txtAccountName.Text; _existing[0]["Currency"] = cboCurrency.SelectedValue; _existing[0]["AccountCode"] = cboAccountCode.SelectedValue; _existing[0]["Swift"] = txtSwift.Text; _existing[0]["IBAN"] = txtIban.Text; _existing[0]["Bank"] = cboBankingCompany.SelectedValue; _existing[0]["Branch"] = txtBranch.Text; _existing[0]["Notes"] = txtNotes.Text; } } QueryGenerator _generator = new QueryGenerator(_bankaccounts); _query = _generator.ToString(); _generator = null; Materia.RefreshAndManageCurrentProcess(); if (!string.IsNullOrEmpty(_query.RLTrim())) { btnSave.Enabled = false; btnSaveAndClose.Enabled = false; IAsyncResult _result = Que.BeginExecution(SCMS.Connection, _query); while (!_result.IsCompleted && !_cancelled) { Thread.Sleep(1); Application.DoEvents(); } if (_cancelled) { if (!_result.IsCompleted) { try { _result = null; } catch { } finally { Materia.RefreshAndManageCurrentProcess(); } } return; } else { QueResult _queresult = Que.EndExecution(_result); if (string.IsNullOrEmpty(_queresult.Error.RLTrim())) { UserAction _action = UserAction.Add; if (!_isnew) { _action = UserAction.Edit; } string _log = "Added a new bank account : " + txtAccountNo.Text + " - " + txtAccountName.Text + "."; if (!_isnew) { _log = "Updated bank account : " + txtAccountNo.Text + " - " + txtAccountName.Text + "."; } _bankaccounts.AcceptChanges(); if (_isnew) { _bankaccountcode = _refno; } if (_isnew) { _isnew = false; } if (_updated) { _updated = false; } if (!_withupdates) { _withupdates = true; } Text = Text.Replace(" *", "").Replace("*", ""); Cursor = Cursors.WaitCursor; if (!txtSearch.AutoCompleteCustomSource.Contains(txtAccountNo.Text)) { txtSearch.AutoCompleteCustomSource.Add(txtAccountNo.Text); } if (!txtSearch.AutoCompleteCustomSource.Contains(txtAccountName.Text)) { txtSearch.AutoCompleteCustomSource.Add(txtAccountName.Text); } if (!txtSearch.AutoCompleteCustomSource.Contains(cboBankingCompany.SelectedValue.ToString())) { txtSearch.AutoCompleteCustomSource.Add(cboBankingCompany.SelectedValue.ToString()); } if (!txtSearch.AutoCompleteCustomSource.Contains(cboAccountCode.SelectedValue.ToString())) { txtSearch.AutoCompleteCustomSource.Add(cboAccountCode.SelectedValue.ToString()); } IAsyncResult _logresult = SCMS.CurrentSystemUser.LogActionAsync(_action, _log); _logresult.WaitToFinish(); Cursor = Cursors.Default; if (sender == btnSaveAndClose) { DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } else { if (!tbOutstanding.Visible) { tbOutstanding.Visible = true; } if (!tbBankLedger.Visible) { tbBankLedger.Visible = true; } } } else { if (_queresult.Error.Contains("duplicate")) { btnSave_Click(sender, new EventArgs()); } else { SCMS.LogError(this.GetType().Name, new Exception(_queresult.Error)); MsgBoxEx.Alert("Failed to save the current bank account.", "Save Bank Account"); } _bankaccounts.RejectChanges(); } _queresult.Dispose(); } btnSave.Enabled = true; btnSaveAndClose.Enabled = true; } } else { if (sender == btnSaveAndClose) { DialogResult = System.Windows.Forms.DialogResult.None; Close(); } } }
public void setObj(string kind) { Uaction = SDirector.getInstance().currentSceneController as UserAction; this.obj = kind; }
public string Edit() { ApiResult result = new ApiResult(); try { User user = GetUserInfo(); if (user == null) { result.message = EnumBase.GetDescription(typeof(Enum_ErrorCode), Enum_ErrorCode.UnLogin); result.code = Enum_ErrorCode.UnLogin; return(JsonConvert.SerializeObject(result)); } var number = ZNRequest.GetString("ToUserNumber"); if (string.IsNullOrWhiteSpace(number)) { result.message = "参数异常,请刷新重试"; return(JsonConvert.SerializeObject(result)); } //判断是否拉黑 var black = db.Exists <Black>(x => x.CreateUserNumber == user.Number && x.ToUserNumber == number); if (black) { result.message = "对方已被加入黑名单,请在设置页面解除"; return(JsonConvert.SerializeObject(result)); } Fan model = db.Single <Fan>(x => x.CreateUserNumber == user.Number && x.ToUserNumber == number); if (model == null) { model = new Fan(); model.CreateUserNumber = user.Number; model.ToUserNumber = number; model.CreateDate = DateTime.Now; model.CreateIP = Tools.GetClientIP; var success = Tools.SafeInt(db.Add <Fan>(model)) > 0; if (success) { user.Follows = db.Find <Fan>(x => x.CreateUserNumber == user.Number).Count; result.result = true; result.message = user.Follows; //操作记录 var now = DateTime.Now.ToString("yyyy-MM-dd"); var action = db.Single <UserAction>(x => x.CreateUserNumber == user.Number && x.CreateTimeText == now && x.ActionType == Enum_ActionType.Follow); if (action == null) { action = new UserAction(); action.CreateUserNumber = user.Number; action.ActionType = Enum_ActionType.Follow; action.CreateTime = DateTime.Now; action.CreateTimeText = now; action.ActionInfo = number; db.Add <UserAction>(action); } else { if (!action.ActionInfo.Contains(number)) { action.ActionInfo += "," + number; db.Update <UserAction>(action); } } //推送 new AppHelper().Push(number, 0, "", user.NickName, Enum_PushType.Fan); } } else { result.result = true; result.message = db.Find <Fan>(x => x.CreateUserNumber == user.Number).Count; } } catch (Exception ex) { LogHelper.ErrorLoger.Error("Api_Fan_Edit:" + ex.Message); result.message = ex.Message; } return(JsonConvert.SerializeObject(result)); }
protected void SetValueAndRange(int value, int minimumValue, int maximumValue, UserAction userAction) { if (value < minimumValue || value > maximumValue) { if (!this.DesignMode) { throw new ArgumentOutOfRangeException("value", "The specified value is not consistent with the specified minimum and maximum values."); } value = Math.Min(maximumValue, Math.Max(minimumValue, value)); } bool minimumChanged = _minimumValue != minimumValue; bool maximumChanged = _maximumValue != maximumValue; bool valueChanged = _value != value; if (minimumChanged || maximumChanged || valueChanged) { _minimumValue = minimumValue; _maximumValue = maximumValue; _value = value; _trackBar.Invalidate(); this.Invalidate(); if (minimumChanged) { this.OnPropertyChanged(new PropertyChangedEventArgs("MinimumValue")); } if (maximumChanged) { this.OnPropertyChanged(new PropertyChangedEventArgs("MaximumValue")); } if (valueChanged) { this.OnValueChanged(new ValueChangedEventArgs() { UserAction = userAction }); } } }
public void DecreaseScoreBy(decimal score, UserAction reason) { Check.Argument.IsNotNegativeOrZero(score, "score"); AddScore(-score, reason); }
/// <summary> /// Called when the user requests an action using application/system provided UI /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported. /// /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks. /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: if (player.PlayerState != PlayState.Playing) { player.Play(); } break; case UserAction.Stop: player.Stop(); break; case UserAction.Pause: player.Pause(); break; default: break; } NotifyComplete(); }
public UserActivity(UserDetail user, UserAction action, string details = null) : this() { _userId = user?.userId; // this should be a valid userid or NULL (FK constraint) _action = action; _details = details; }
private void HandleFontSettingChange(object sender, EventArgs e) { if (!m_bFireElementChangeEvents || !m_bFireFontChangeEvents || CardMakerInstance.ProcessingUserAction) { return; } var listElements = ElementManager.Instance.SelectedElements; if (null != listElements) { var listActions = UserAction.CreateActionList(); var zControl = (Control)sender; foreach (var zElement in listElements) { var zElementToChange = zElement; if (!CardMakerInstance.ProcessingUserAction && null != sender) { object zRedoValue = null; object zUndoValue = null; // The current value on the element can be used for an undo if (PopulateUndoRedoValues(zControl, zElementToChange, ref zRedoValue, ref zUndoValue)) { listActions.Add(bRedo => { AssignValueByControl(zControl, zElementToChange, bRedo ? zRedoValue : zUndoValue, false); if (null != LayoutManager.Instance.ActiveDeck) { LayoutManager.Instance.ActiveDeck.ResetMarkupCache(zElementToChange.name); } }); } else { FontStyle eFontStyle = (checkBoxBold.Checked ? FontStyle.Bold : FontStyle.Regular) | (checkBoxItalic.Checked ? FontStyle.Italic : FontStyle.Regular) | (checkBoxStrikeout.Checked ? FontStyle.Strikeout : FontStyle.Regular) | (checkBoxUnderline.Checked ? FontStyle.Underline : FontStyle.Regular); // even if this font load fails due to style it should convert over to the valid one var zFont = FontLoader.GetFont(m_listFontFamilies[comboFontName.SelectedIndex], (int)numericFontSize.Value, eFontStyle); var fontRedo = zFont; var fontUndo = zElementToChange.GetElementFont(); fontUndo = fontUndo ?? DrawItem.DefaultFont; listActions.Add(bRedo => { var fontValue = bRedo ? fontRedo : fontUndo; zElementToChange.SetElementFont(fontValue); // only affect the controls if the current selected element matches that of the element to change if (zElementToChange == ElementManager.Instance.GetSelectedElement()) { comboFontName.Text = fontValue.Name; SetupElementFont(fontValue); } if (null != LayoutManager.Instance.ActiveDeck) { LayoutManager.Instance.ActiveDeck.ResetMarkupCache(zElementToChange.name); } }); } } } Action <bool> actionChangeFont = bRedo => { CardMakerInstance.ProcessingUserAction = true; listActions.ForEach(action => action(bRedo)); CardMakerInstance.ProcessingUserAction = false; if (0 < numericLineSpace.Value) { checkFontAutoScale.Checked = false; } LayoutManager.Instance.FireLayoutUpdatedEvent(true); }; UserAction.PushAction(actionChangeFont); // perform the action as a redo now actionChangeFont(true); } }
private void btnColor_Click(object sender, EventArgs e) { var listSelectedElements = ElementManager.Instance.SelectedElements; if (null == listSelectedElements) { MessageBox.Show(this, "Please select at least one enabled Element."); return; } var zRGB = new RGBColorSelectDialog(); var btnClicked = (Button)sender; var zPanel = (Panel)btnClicked.Tag; zRGB.UpdateColorBox(zPanel.BackColor); if (DialogResult.OK != zRGB.ShowDialog()) { return; } var colorRedo = zRGB.Color; var listActions = UserAction.CreateActionList(); foreach (var zElement in listSelectedElements) { var zElementToChange = zElement; var colorUndo = Color.White; if (btnClicked == btnElementBorderColor) { colorUndo = zElement.GetElementBorderColor(); } else if (btnClicked == btnElementOutlineColor) { colorUndo = zElement.GetElementOutlineColor(); } else if (btnClicked == btnElementFontColor || btnClicked == btnElementShapeColor) { colorUndo = zElement.GetElementColor(); } listActions.Add(bRedo => { if (null != LayoutManager.Instance.ActiveDeck) { LayoutManager.Instance.ActiveDeck.ResetMarkupCache(zElementToChange.name); } SetColorValue(btnClicked, bRedo ? colorRedo : colorUndo, zElementToChange); UpdatePanelColors(zElementToChange); }); } Action <bool> actionChangeColor = bRedo => { listActions.ForEach(action => action(bRedo)); LayoutManager.Instance.FireLayoutUpdatedEvent(true); }; UserAction.PushAction(actionChangeColor); // perform the action as a redo now actionChangeColor(true); }
public ApiResult LogNewActionInfo(UserAction action, ApiResult message) { Status(action, message.Status == 0, message.Message.IsNullOrEmpty() ? null : message.Message); return(message); }
void Draging(EventCallBack back, UserAction action, Vector2 v) { back.DecayRateY = 0.998f; Scrolling(back, v); }
private void Awake() { action = Director.getInstance().current as UserAction; }
/// <summary> /// Called when the user requests an action using application/system provided UI /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported. /// /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks. /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: if (player != null && player.PlayerState != PlayState.Playing) { player.Volume = 1; player.Play(); } break; case UserAction.Stop: player.Stop(); break; case UserAction.Pause: player.Pause(); break; case UserAction.FastForward: player.FastForward(); break; case UserAction.Rewind: player.Rewind(); break; case UserAction.Seek: player.Position = (TimeSpan)param; break; case UserAction.SkipNext: SetNextTrack(player); break; case UserAction.SkipPrevious: SetPreviousTrack(player); break; } NotifyComplete(); }
protected void SetValue(int value, UserAction userAction) { SetValueAndRange(value, _minimumValue, _maximumValue, userAction); }
/// <summary> /// Called when the user requests an action using application/system provided UI /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param"> /// The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track /// </param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported. /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks. /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { Debug.WriteLine("OnUserAction() action " + action); switch (action) { case UserAction.Play: var task = Task.Run((Func<Task>)RunDownload); if (player.PlayerState != PlayState.Playing) player.Play(); task.ContinueWith(t => NotifyComplete()); return; case UserAction.Stop: player.Stop(); break; case UserAction.Pause: player.Pause(); break; case UserAction.FastForward: player.FastForward(); break; case UserAction.Rewind: player.Rewind(); break; case UserAction.Seek: player.Position = (TimeSpan)param; break; case UserAction.SkipNext: player.Track = GetNextTrack(); break; case UserAction.SkipPrevious: var previousTrack = GetPreviousTrack(); if (previousTrack != null) player.Track = previousTrack; break; } NotifyComplete(); }
/// <summary> /// Called when the user requests an action using application/system provided UI /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported. /// /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks. /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: if (player.PlayerState != PlayState.Playing) { player.Play(); } break; case UserAction.Stop: player.Stop(); break; case UserAction.Pause: player.Pause(); break; case UserAction.FastForward: player.FastForward(); break; case UserAction.Rewind: player.Rewind(); break; case UserAction.Seek: player.Position = (TimeSpan)param; break; case UserAction.SkipNext: player.Track = GetNextTrack(); break; case UserAction.SkipPrevious: AudioTrack previousTrack = GetPreviousTrack(); if (previousTrack != null) { player.Track = previousTrack; } break; } NotifyComplete(); }
/// <summary> /// Records the user action. /// </summary> /// <param name="action">The action.</param> /// <returns>Task.</returns> public Task RecordUserAction(UserAction action) { action.Id = Guid.NewGuid().ToString("N"); return(_userActionRepository.Create(action)); }
public RequestedAction(UserAction action) { ActionName = action; }
public TreeControl(int panelId, HierarchyNavTable data, string PKColName, // tree controls must have a single-column primary key string parentColName, string displayColName, UserAction action) : base(panelId, data, PKColName, action) { this.actions = new List<UserAction> { action }; this.parentColName = parentColName; this.displayColName = displayColName; this.displayColumns = new List<string> { displayColName }; this.data = data; }
void Start() { action = SSDirector.getInstance().currentSceneController as UserAction; }
void Layout_Loaded(object sender, LayoutEventArgs e) { UserAction.ClearUndoRedoStacks(); }
protected void SetValueAndRange(int value, int minimumValue, int maximumValue, UserAction userAction) { if (value < minimumValue || value > maximumValue) { if (!this.DesignMode) throw new ArgumentOutOfRangeException("value", "The specified value is not consistent with the specified minimum and maximum values."); value = Math.Min(maximumValue, Math.Max(minimumValue, value)); } bool minimumChanged = _minimumValue != minimumValue; bool maximumChanged = _maximumValue != maximumValue; bool valueChanged = _value != value; if (minimumChanged || maximumChanged || valueChanged) { _minimumValue = minimumValue; _maximumValue = maximumValue; _value = value; _trackBar.Invalidate(); this.Invalidate(); if (minimumChanged) this.OnPropertyChanged(new PropertyChangedEventArgs("MinimumValue")); if (maximumChanged) this.OnPropertyChanged(new PropertyChangedEventArgs("MaximumValue")); if (valueChanged) this.OnValueChanged(new ValueChangedEventArgs(){UserAction = userAction}); } }
/// <summary> /// Deletes the specified action. /// </summary> /// <param name="action">The action.</param> /// <returns>Task.</returns> public Task Delete(UserAction action) { return(_userActionRepository.Delete(action)); }
public void DragEnd(UserAction action) { Drag.gameObject.SetActive(false); }
public Keybind(UserAction action, KeyCombo keyCombo) { this.action = action; this.keyCombo = keyCombo; }
public Control(int panelId, Panel panel, DataTable data, List<string> PKColNames, UserAction action) : this(panelId, panel, panel.panelId, panel, data, PKColNames, action) { }
public Keybind(UserAction action, KeyCombo keyCombo, KeyCombo keyComboAlt) : this(action, keyCombo) { this.keyComboAlt = keyComboAlt; }
public Control(int panelId, DataTable data, string PKColName, UserAction action) : this(panelId, data, new List<string>(new string[] { PKColName }), action) { }
// Use this for initialization void Start() { Instance = SSDirector.GetInstance(); action = SSDirector.GetInstance() as UserAction; }
void CenterPointEntry(UserEvent callBack, UserAction action) { Cover.transform.localPosition = Vector3.zero; Cover.SizeDelta = model.SizeDelta; Cover.gameObject.SetActive(true); }
internal void DetermineEvent(ActionType type, List <HungerGameProfile> users, HungerGameProfile profile, ItemDrop drops, UserAction activity) => EventManager(type, users, profile, drops, activity);
/// <summary> /// Saves the user action. /// </summary> /// <param name="action">The action.</param> /// <param name="dataContext">The data context.</param> public void SaveUserAction(UserAction action) { ISession session = NHibernateManager.Instance.GetSession(); session.SaveOrUpdate(action); session.Flush(); }
void PointLeave(UserEvent callBack, UserAction action) { Cover.gameObject.SetActive(false); }
public S2C_UserAction(User user, UserAction action) { _User = user; _Action = action; }
void HeadPointDown(UserEvent eventCall, UserAction action) { ac = 0; }
/// <summary> /// Called when the user requests an action using application/system provided UI /// </summary> /// <param name="player">The BackgroundAudioPlayer</param> /// <param name="track">The track playing at the time of the user action</param> /// <param name="action">The action the user has requested</param> /// <param name="param">The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track</param> /// <remarks> /// User actions do not automatically make any changes in system state; the agent is responsible /// for carrying out the user actions if they are supported. /// /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks. /// </remarks> protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param) { switch (action) { case UserAction.Play: if (track != null && track.Tag != null) { var data = track.Tag.ToString().Split('$'); var url = data[data.Length - 1]; var type = data[2]; if (type.ToLower() != "shoutcast") { track.Source = new Uri(url); } } //player.Track = new AudioTrack(null, "", "", "", null, track.Tag, EnabledPlayerControls.Pause); if (player.SafeGetPlayerState() != PlayState.Playing) { player.Play(); } break; case UserAction.Stop: if (player.SafeGetPlayerState() == PlayState.Playing) player.Stop(); break; case UserAction.Pause: if (player.SafeGetPlayerState() == PlayState.Playing) player.Pause(); break; case UserAction.FastForward: //player.FastForward(); break; case UserAction.Rewind: //player.Rewind(); break; case UserAction.Seek: //player.Position = (TimeSpan)param; break; case UserAction.SkipNext: //player.Track = GetNextTrack(); break; case UserAction.SkipPrevious: //AudioTrack previousTrack = GetPreviousTrack(); //if (previousTrack != null) //{ // player.Track = previousTrack; //} break; } NotifyComplete(); }
public void Draging(UserAction action) { Drag.transform.localPosition = UIElement.ScreenToLocal(Drag.transform.parent, action.CanPosition); Drag.gameObject.SetActive(true); }