public static void SetStatusMessage(StatusAction action) { if (MainForm != null) { MainForm.SetStatusMessage(action); } }
public void LogInAndPay(NSString userName, NSString userPassword, string amount) { if (Payleven.LoginState == PLVPaylevenLoginState.PLVPaylevenLoginStateLoggedIn) { // Payleven: prepare device and make payment PrepareDeviceAndPay(amount); } else { // Payleven: login user Payleven.LoginWithUsername(userName, userPassword, new NSString(ApiKey), (errorHandler) => { if (errorHandler == null) { // Payleven: login successful PrepareDeviceAndPay(amount); } else { // Payleven: login failed StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusLoginError); } }); } }
public void PrepareDeviceAndPay(string paymentAmount) { if (Payleven.Devices == null || Payleven.Devices.Count() == 0) { // Payleven: devices list is empty"); StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusDeviceNotFound); return; } var device = Payleven.Devices.FirstOrDefault(); device.PrepareWithCompletionHandler((completionHandler) => { if (device.Ready) { // Payleven: making payment, device is ready Pay(device, paymentAmount); } else { // Payleven: device is not ready, check error code StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusDeviceIsNotReady); } }); }
internal static void SetServantStatus(TServant servant, StatusAction action) { var instance = (IDaemonOverseer <TServant>)Instance; //This will only happen when OnApplicationQuit has been called if (instance == null) { return; } switch (action) { case StatusAction.Register: { instance.Register(servant); break; } case StatusAction.Unregister: { instance.Unregister(servant); break; } default: { throw new Exception($"{servant.GetType().Name} sent idenfication without the action setup."); } } }
public void Pay(PLVDevice device, string paymentAmount) { if (device == null) { // Payleven: device not found StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusDeviceNotFound); return; } if (!LocationCoordinate.IsValid()) { // Payleven: coordinates are not valid StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusCoordsIsNotValid); return; } var paymentRequest = new PLVPaymentRequest(PaymentHelper.GetRandomNSString(), PaymentHelper.LocaleAmount(paymentAmount), Currency, LocationCoordinate); var paymentTask = Payleven.PaymentTaskWithRequest(paymentRequest, device, this); if (paymentTask == null) { // Payleven: error with creating payment StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusError); return; } else { // Payleven: payment has started! paymentTask.Start(); } }
public override void PLVPaymentTask(PLVPaymentTask paymentTask, NSError error) { if (error != null) { // Payleven: task failed, you can check error code StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusError); } }
/// <summary> /// Clones this instance. /// </summary> /// <returns>A deep copy of this instance.</returns> public override ActionViewModelBase Clone() { var statusAction = new StatusAction(); return(new StatusActionViewModel(statusAction, ActionDescriptor, ParametersModel.ParameterDescriptions, AllActionDescriptions) { CommandText = CommandText, ParametersModel = ParametersModel.Clone(statusAction.Parameters) }); }
private void btnRefresh_Click(object sender, EventArgs e) { LiveImageAction action = new LiveImageAction(true); action.Perform(); StatusAction status = new StatusAction(true); status.Perform(); }
/// <summary> /// Initializes a new instance of the <see cref="StatusActionViewModel"/> class. /// </summary> /// <param name="action">The action.</param> /// <param name="actionDescriptor">The action descriptor.</param> /// <param name="parameterDescriptions">The parameter descriptions.</param> /// <param name="allDescriptions">All descriptions.</param> public StatusActionViewModel([NotNull] StatusAction action, [NotNull] ActionDescription actionDescriptor, [NotNull] IEnumerable <ParameterDescription> parameterDescriptions, [NotNull] IEnumerable <ActionDescription> allDescriptions) : base(action, actionDescriptor, parameterDescriptions, allDescriptions) { Assert.ArgumentNotNull(action, "action"); Assert.ArgumentNotNull(actionDescriptor, "actionDescriptor"); Assert.ArgumentNotNull(parameterDescriptions, "parameterDescriptions"); Assert.ArgumentNotNull(allDescriptions, "allDescriptions"); _action = action; }
private void UpdateStatus() { Program.InvokeMethod(this, new MethodInvoker(delegate() { StatusAction action = _status.Count == 0 ? null : _status.Peek(); this.StatusText = action == null ? "Ready" : action.Message; Cursor = action == null ? Cursors.Default : action.Cursor; } )); }
public void AddStatus(StatusType type, int id, int value, StatusAction action) { this.Status.Add(new NStatus() { Type = type, Id = id, Value = value, Action = action }); }
public static void PushAction(StatusAction action) { using (ThreadLocker.Lock(_actions)) { if (_actions.Count == 0) { _startTime = DateTime.Now; } _actions.Push(action); } }
/// <summary> /// 持续状态属性 /// </summary> /// <author>zhulin</author> public override void DoSkillStatus(float duration) { if (m_StatusData == null || m_StatusData.Count == 0) { return; } for (int j = 0; j < m_StatusData.Count; j++) { StatusAction skill = m_StatusData[j]; if (skill != null) { List <int> lData = new List <int>(); if (skill.GetPersistence() == true) { skill.GetAttrData(ref lData); for (int i = 0; i < lData.Count - 1; i += 2) { EffectType Type = (EffectType)lData[i]; if (Type == EffectType.SetHpByPercent) { if (duration <= 0.0) { Life life = CM.GetAllLifeM(m_SceneID, LifeMType.ALL); life.HP = (int)(life.fullHP * lData[i + 1] * 0.01f); } } } } else { List <int> l = new List <int>(); skill.GetAttrData(ref l); for (int i = 0; i < l.Count - 1; i += 2) { EffectType Type = (EffectType)l[i]; if (Type == EffectType.RecoHp || Type == EffectType.RecoAnger || Type == EffectType.IcePoint) { //是否要调用,可能会产生添加怒气 lData.Add(l[i]); lData.Add(l[i + 1]); } } } if (skill.DoSkillStatus(duration) == true && lData.Count > 0) { //Debug.Log(" 加血 " + duration + "," + skill.Duration); AddrContinuedAttr(lData); } } } }
/// <summary> /// check 是否包含某个技能产生的状态 /// </summary> /// <returns> true 包含 ,false 不包含</returns> public bool CheckStateBySkill(int SkillType) { for (int i = 0; i < m_StatusData.Count; i++) { StatusAction skill = m_StatusData[i]; if (skill != null && skill.CheckActionBySkill(SkillType) == true) { return(true); } } return(false); }
/// <summary> /// 获取技能释放者 /// </summary> public int GetResalseSceneID() { for (int i = 0; i < m_StatusData.Count; i++) { StatusAction skill = m_StatusData[i]; if (skill != null) { return(skill.GetResalseSceneID()); } } return(-1); }
public void RefreshStatus() { var sign = ControlService.SignCombo.Current; if (sign.DashboardType == DashboardType.Sign && sign.Controller.Connection != null && sign.Controller.Connection.State == System.Communication.ConnectionState.Opened) { LiveImageAction action = new LiveImageAction(false); action.Perform(); StatusAction status = new StatusAction(false); status.Perform(); } }
/// <summary> /// 获取属性数据 /// </summary> public override int GetAttrData(EffectType type) { List <int> lData = new List <int>(); for (int i = 0; i < m_StatusData.Count; i++) { StatusAction skill = m_StatusData[i]; if (skill != null && skill.GetPersistence() == false) { skill.GetAttrData(ref lData); } } return(GetAttrData(lData, type)); }
public NStatus AddStatus(StatusType type, StatusAction action, int id, int value, byte[] param = null) { Dirty = true; NStatus nstatus = new NStatus() { Type = type, Action = action, Id = id, Value = value, Param = param }; Console.WriteLine($"{type} {action} {id} {value}"); Statuses.Add(nstatus); return(nstatus); }
/// <summary> /// 持续状态属性 /// </summary> /// <author>zhulin</author> public override void DoSkillStatus(float duration) { if (m_StatusData == null || m_StatusData.Count == 0) { return; } for (int j = 0; j < m_StatusData.Count; j++) { StatusAction skill = m_StatusData[j]; if (skill != null) { List <int> lData = new List <int>(); if (skill.GetPersistence() == true) { skill.GetAttrData(ref lData); } else { List <int> l = new List <int>(); skill.GetAttrData(ref l); for (int i = 0; i < l.Count - 1; i += 2) { EffectType Type = (EffectType)l[i]; if (Type == EffectType.RecoHp || Type == EffectType.RecoAnger || Type == EffectType.IcePoint) { //是否要调用,可能会产生添加怒气 lData.Add(l[i]); lData.Add(l[i + 1]); } } } if (skill.DoSkillStatus(duration) == true && lData.Count > 0) { AddrContinuedAttr(lData); } } } }
/// <summary> /// 持续触发麻痹状态 /// </summary> /// <author>zhulin</author> public override void DoSkillStatus(float duration) { Life life = CM.GetAllLifeM(m_SceneID, LifeMType.ALL); if (life == null) { return; } if (m_StatusData == null || m_StatusData.Count == 0) { return; } for (int j = 0; j < m_StatusData.Count; j++) { StatusAction skill = m_StatusData[j]; if (skill != null) { if (skill.DoSkillStatus(duration) == true) { life.m_Attr.Paralysis = true; } } } }
public void AddEquipedChange(int slot, int equipID, StatusAction action) { Dirty = true; AddStatus(StatusType.Equiped, action, slot, equipID); }
public override void PaymentTaskDidFinish(PLVPaymentTask paymentTask) { StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusOK); }
public void AddItemChange(int id, int count, StatusAction action) { this.AddStatus(StatusType.Item, id, count, action); }
/// <summary> /// 叠加一个状态 /// </summary> /// public bool AddStatus(int ResalseSceneID, int SkillType, SkillStatusInfo Info) { m_bufftype = Info.m_bufftype; //为空 添加 Info.m_releasesceneid = ResalseSceneID; if (m_StatusData.Count == 0) { StatusAction status = new StatusAction(); status.Init(m_SceneID, SkillType, ResalseSceneID, Info); m_StatusData.Add(status); //AddStatusEffect(Info , SkillType); DoSkillStatus(0.0f); m_ReplaceInfo = Info.m_RelpaceInfo; return(true); } else { //状态叠加新规则,根据技能类型和技能等级做判断 StatusAction s = FindSameSkillTypeStaus(SkillType); if (s != null) { if (s.StatusInfo.m_effectlevel < Info.m_effectlevel) { s.SetDone(); StatusAction status = new StatusAction(); status.Init(m_SceneID, SkillType, ResalseSceneID, Info); m_StatusData.Add(status); DoSkillStatus(0.0f); return(true); } } else { StatusAction status = new StatusAction(); status.Init(m_SceneID, SkillType, ResalseSceneID, Info); m_StatusData.Add(status); DoSkillStatus(0.0f); } /*if(m_AddRole ==AddRule.ADD) //叠加 * { * StatusAction s = FindSameStaus(ResalseSceneID, SkillType); * if(s == null) * { * StatusAction status = new StatusAction(); * status.Init(m_SceneID,SkillType,ResalseSceneID,Info); * m_StatusData.Add(status); * DoSkillStatus(0.0f); * } * else * { * s.ResetTime(Info.m_time); * } * } * else if(m_AddRole ==AddRule.Replace) //替换 * { * m_StatusData.Clear(); * StatusAction status = new StatusAction(); * status.Init(m_SceneID,SkillType,ResalseSceneID,Info); * m_StatusData.Add(status); * DoSkillStatus(0.0f); * } * else * { * Debug.LogError("出现第三种规则,异常"); * }*/ } return(false); }
private void ShowBusy() { Program.InvokeMethod(this, new MethodInvoker( delegate() { TimeSpan elapsedTime = DateTime.Now.Subtract(_startTime); StatusAction action = _actions.Peek(); lblMessage.Text = action.Message; if (action.ProgressAvailable) { pbrProgress.Style = ProgressBarStyle.Continuous; pbrProgress.Value = Convert.ToInt32(action.Progress); lblProgress.Text = action.Progress.ToString("0.00") + "%"; lblProgress.Visible = true; } else { pbrProgress.Value = 100; pbrProgress.Style = ProgressBarStyle.Marquee; lblProgress.Text = ""; lblProgress.Visible = false; } if (!this.Visible && !action.PreventBusyDialog) { this.Location = Program.MainForm.Location; this.CenterToScreen(); } else { if (elapsedTime.TotalSeconds >= 2 /*&& seconds < 15*/) { if (elapsedTime.Hours >= 1) { lblElapsedTime.Text = string.Format("{4:0} hour{5}, {0:0} minute{2}, {1:0} second{3}", elapsedTime.Minutes, elapsedTime.Seconds, elapsedTime.Minutes == 1 ? "" : "s", elapsedTime.Seconds == 1 ? "" : "s", elapsedTime.Hours, elapsedTime.Hours == 1 ? "" : "s"); } else if (elapsedTime.Minutes >= 1) { lblElapsedTime.Text = string.Format("{0:0} minute{2}, {1:0} second{3}", elapsedTime.Minutes, elapsedTime.Seconds, elapsedTime.Minutes == 1 ? "" : "s", elapsedTime.Seconds == 1 ? "" : "s"); } else { lblElapsedTime.Text = string.Format("{0:0} second", elapsedTime.TotalSeconds) + (elapsedTime.TotalSeconds == 1 ? "" : "s"); } lblElapsedTime.Show(); } //else if (seconds >= 15 && seconds < 30) //{ // lblElapsedTime.Text = string.Format("there might be a connection problem - {0:0} seconds", seconds); //} //else if (seconds >= 30) //{ // lblElapsedTime.Text = string.Format("hmmm, this is taking too long - {0:0} seconds", seconds); //} } if (!action.PreventBusyDialog && elapsedTime.TotalSeconds >= 3 && !this.Visible) { this.Show(); this.BringToFront(); this.TopMost = true; this.TopLevel = true; } } )); }
internal void SetStatusMessage(StatusAction action) { _status.Push(action); UpdateStatus(); BusyDialog.PushAction(action); }
public ActionResult Verdict(int groupMemberId, int groupId, StatusAction approved, string title, bool administrator) { if (!IsLoggedIn()) { return RedirectToLogin(); } try { UserInformationModel<User> myUserInformation = GetUserInformatonModel(); bool myResult = false; if (approved == StatusAction.Approve) { myResult = theGroupService.ApproveGroupMember(myUserInformation, groupMemberId, title, administrator); if (myResult) { TempData["Message"] += MessageHelper.NormalMessage(GROUP_MEMBER_APPROVED); } } else { theGroupService.DenyGroupMember(myUserInformation, groupMemberId); myResult = true; TempData["Message"] += MessageHelper.NormalMessage(GROUP_MEMBER_DENIED); } if (myResult) { return RedirectToAction("Details", "Group", new { id = groupId }); } } catch (Exception myException) { LogError(myException, GROUP_MEMBER_ERROR); TempData["Message"] += MessageHelper.ErrorMessage(GROUP_MEMBER_VERDICT_ERROR); } //Force for radio button value export theValidationDictionary.ForceModleStateExport(); return RedirectToAction("Details", new { groupId = groupId, groupMemberId = groupMemberId }); }
public StatusActionMessage(StatusAction status) { Status = status; }
/// <summary> /// Connect /// </summary> private void DoConnect() { if (connStatus != null) { return; } if (isUseProxy && ddlProxyType.SelectedIndex != 0) { if (txtProxyIpAdd.Text.Trim() == "") { MsgBox.Warning("Sorry,the proxy IP address can't be empty"); return; } if (this.txtProxyPortNo.Text.Trim() == "") { MsgBox.Warning("Sorry,the proxy port number can't be empty"); return; } } Cursor = Cursors.WaitCursor; ConnectionExceptionAction.IsCancel = false; IsDisconnection = false; DashboardTree._currentSign = Current; IPEndPoint endPoint = null; IPEndPoint proxyEndPoint = null; LoginInfo info = new LoginInfo(); if (Current.Template.Sign.AutoLogin || Current.LoginInfomation.CanSave || Current.LoginInfomation.CanSaveLoginInfo) { info = CloneManager.Clone <LoginInfo>(Current.LoginInfomation); } if (chkStorePWD.Checked) { info.CanSave = true; } else { info.CanSave = false; } info.IpAddress = txtConnectIpAddress.Text.Trim(); info.Port = Convert.ToInt32(txtConnectPortNo.Text); info.ConnectionUserName = txtServerName.Text.Trim(); info.ConnectionPassword = txtConnectPWD.Text.Trim(); Current.LoginInfomation.ConnectionUserName = txtServerName.Text.Trim(); Current.LoginInfomation.ConnectionPassword = txtConnectPWD.Text.Trim(); endPoint = new IPEndPoint(IPAddress.Parse(info.IpAddress), info.Port); if (isUseProxy && ddlProxyType.SelectedIndex != 0) { info.PorxyUserName = txtProxyUserName.Text; info.ProxyPort = Convert.ToInt32(txtProxyPortNo.Text); info.PorxyAddress = txtProxyIpAdd.Text; info.ProxyType = (ProxyTypes)Enum.Parse(typeof(ProxyTypes), ddlProxyType.SelectedItem.ToString()); info.PorxyPassword = txtProxyPWD.Text; proxyEndPoint = new IPEndPoint(IPAddress.Parse(this.txtProxyIpAdd.Text), Convert.ToInt32(this.txtProxyPortNo.Text)); } else { info.ProxyType = ProxyTypes.None; } Current.LoginInfomation = info; Current.Controller.Connection.FtpUser.Account = info.ConnectionUserName; Current.Controller.Connection.FtpUser.NoSecurityPWD = info.ConnectionPassword; TcpUFEConnection tcpConn = Current.Controller.Connection as TcpUFEConnection; if (tcpConn != null) { var connParams = new TcpConnectionParams(endPoint, proxyEndPoint, info.ProxyType, info.PorxyUserName, info.PorxyPassword); tcpConn.Params = connParams; } ProWrite.UI.Controls.Actions.UFE.Responses.UFEResponseService.Init(Current); this.Hide(); ConnectionProgress progress = new ConnectionProgress(Current, false, info.ConnectionPassword); progress.ShowModalDialog(); if (!chkStorePWD.Checked) { Current.LoginInfomation.ConnectionPassword = ""; } if (progress.Result) { LiveImageAction liveImageAction = new LiveImageAction(); liveImageAction.Sign = Current; liveImageAction.Perform(); StatusAction statusAction = new StatusAction(false); statusAction.Sign = Current; statusAction.Perform(); GetStatusAction getStatus = new GetStatusAction(); getStatus.sign = Current; getStatus.Perform(); LogViewAction logviewAction = new LogViewAction(); logviewAction.sign = Current; logviewAction.Perform(); if (Current.IsWebCam) { IsConnectWebCam = true; } UpdateSignInfo(); } else { ActionHelper.OnDisconnected(false); this.Show(); this.Cursor = Cursors.Default; } }
public void AddEquipChange(StatusAction action, int id, int templateId, byte[] property = null) { Dirty = true; AddStatus(StatusType.Equip, action, id, templateId, property); }
/// <summary> /// Used to quickly send a status update with detail /// </summary> public static IStatusModel Update(string status, string statusDetail, int total, int current, StatusAction action) { //Log.Write(typeof(StatusModel).FullName, MethodBase.GetCurrentMethod().Name, LogEntryType.Trace, string.Format("{0}{1}{2}", // status == null ? "" : string.Format("Status: {0}", status), // status != null && statusDetail != null ? ", " : "", // statusDetail == null ? "" : string.Format("Status Detail: {0}", statusDetail))); return(new StatusModel { Action = action, Status = status, StatusDetail = statusDetail, Total = total, Current = current }); }