private static void ProcessEmotionRequest(string client, string emotion) { var hubContext = GlobalHost.ConnectionManager.GetHubContext <ReportHub>(); var emotionStatus = Enum.GetNames(typeof(EmotionStatus)).Any(x => x.ToLowerInvariant() == emotion.ToLowerInvariant()) ? (EmotionStatus)Enum.Parse(typeof(EmotionStatus), emotion, true) : EmotionStatus.None; hubContext.Clients.All.printLog($"{DateTime.UtcNow:O} '{client}' post: {emotion} - {emotionStatus}"); if (emotionStatus == EmotionStatus.None || emotionStatus == EmotionStatus.Freezed) { return; } hubContext.Clients.All.addMessage(GenerateMessage(client, emotionStatus), GetMessageType(emotionStatus)); hubContext.Clients.All.updateFocusIndex(ComputeFocusIndex(emotionStatus)); if (emotionStatus == EmotionStatus.HandUp) { hubContext.Clients.All.raiseHand(); hubContext.Clients.All.updateHandupCount(StatusCollection.CountHandUp(client)); } else { hubContext.Clients.All.putHandDown(); } }
public void EndPosion(OnStatusEndEventData e) { StatusCollection Collection = e.Target.GetComponentInChildren <StatusCollection>(); if (Collection != null) { Collection.RemoveStatus(Status); } ColorShifter shifter = e.Target.GetComponentInChildren <ColorShifter>(); if (shifter != null) { shifter.ShiftToColor( new Color(0f, 1f, 0f, 1f), new Color(1f, 1f, 1f, 1f), 1f ); StartCoroutine(DestroyAfter(1f)); } else { Destroy(gameObject); } }
private async Task AddStatuses(IEnumerable <StatusViewModel> statuses, bool append = true) { var statusViewModels = statuses as StatusViewModel[] ?? statuses.ToArray(); if (statusViewModels.Any()) { SinceId = Math.Max(SinceId, statusViewModels.Max(s => s.Id)); MaxId = Math.Min(MaxId, statusViewModels.Min(s => s.Id)); foreach (var s in statusViewModels) { await UpdateCache(s.Model); if (append) { await Dispatcher.RunAsync(() => StatusCollection.Add(s)); } else { await Dispatcher.RunAsync(() => StatusCollection.Insert(0, s)); } } RaiseNewStatus(statusViewModels.Last()); } }
public void EndConfusion(OnStatusEndEventData e) { MovableBody movableBody = e.Target.GetComponentInChildren <MovableBody>(); if (movableBody != null) { RemoveLastRandomMovement(movableBody); } StatusCollection Collection = e.Target.GetComponentInChildren <StatusCollection>(); if (Collection != null) { Collection.RemoveStatus(Status); } ColorShifter shifter = e.Target.GetComponentInChildren <ColorShifter>(); if (shifter != null) { shifter.ShiftToColor( new Color(1f, 1f, 0f, 1f), new Color(1f, 1f, 1f, 1f), 1f ); StartCoroutine(DestroyAfter(1f)); } else { Destroy(gameObject); } }
internal CanStartRoom( MainWindow window, StatusCollection status, Int64 now, Garner garner, Boolean checkClosing = false, List <Room>?rooms = null ) { this.window = window; this.status = status; this.now = now; this.garner = garner; this.checkClosing = checkClosing; this.rooms = rooms; // giftHistory.count() を呼ぶ前に必ずexpectedResetを呼ばないといけない this.expectedReset = garner.giftHistory.expectedReset(now); // historyCount は外部から参照されるreadonly変数なのでこのタイミングで初期化したい this.historyCount = garner.giftHistory.count(); // 初期化時に検討までやってしまう this.remainStartRoom = check(); }
private void bindStatus_Click(object sender, EventArgs e) { var collection = StatusCollection.GetStatusCollection(); var mainControl = (StatusStrip)GetMainControlByName("statusBar1"); foreach (var item in collection) { var isMatch = false; foreach (object component in mainControl.Items) { if (isMatch) { break; } if (((INamedBindable)component).Name == item.Name) { ((IBindableComponent)component).DataBindings.Add("Text", item, "Text"); ((IBindableComponent)component).DataBindings.Add("ToolTipText", item, "ToolTipText"); ((IBindableComponent)component).DataBindings.Add("Enabled", item, "Enabled"); ((IBindableComponent)component).DataBindings.Add("Visible", item, "Visible"); isMatch = true; } } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { cgSelectPhoto.ItemsSource = (new AlbumPhoto(curentSession.GetAllItems <Album>(Request.comGetPhotos), curentSession.token)).Photos; cgSelectPhoto.SelectedIndex = 0; statuses = curentSession.GetAllItems <StatusCollection>(Request.comGetStatuses); cmbOrderStatus.ItemsSource = statuses.statuses; Update_Goods(); Update_Customers(); Update_Orders(); }
public void LoadSceneInStack(string sceneName) { var newStatus = new StatusCollection(); newStatus.StackGameStatus = new GameStatus(); newStatus.StackGameStatus.DeepClone(GameStatus.Instance); savingStatus.Add(newStatus); SceneStack.Add(sceneName); LoadScene(CurrentSceneName); }
protected CollectionBase GenerateStatusCollectionFromReader(IDataReader returnData) { StatusCollection stsCollection = new StatusCollection(); while (returnData.Read()) { Status newStatus = new Status((int)returnData["StatusId"], (int)returnData["ProjectId"], (string)returnData["StatusName"], (string)returnData["StatusImageUrl"]); stsCollection.Add(newStatus); } return(stsCollection); }
private void ApplyConfusionTo(GameObject user) { StatusCollection statuses = user.GetComponentInChildren <StatusCollection>(); if (statuses != null) { Status confusion = Instantiate(ConfusionStatus); statuses.AddStatus(confusion); confusion.Emitter.Emit(new OnStatusStartEventData(user, gameObject, 5f)); } }
public StatusCollection ExecuteAudit(Person person) { var testPerson = new Person("Chad", 35); var auditz = new List <AuditRunner.AuditMethod <Person> >() { AuditTools.AttributesAreSame(testPerson, new string[] { "Age" }), IsNotChad, IsOld }; StatusCollection results = AuditRunner.RunAudits <Person>(person.Name /*Name for result collections*/, person /* Object to run audits on*/, auditz /* Audits to run */); return(results); }
private async void Parser_StatusDeleted(object sender, DeleteStreamEventArgs e) { // Yes the same id shouldn't be there more than once, but this happens sometimes. // so delete all statuses that match the id. var toDelete = StatusCollection.Where(s => s.Id == e.Id).ToArray(); foreach (var status in toDelete) { await Dispatcher.RunAsync(() => StatusCollection.Remove(status)); } await Cache.RemoveStatus(e.Id); }
public RoomBase( string groupName, IMessageService messageService, IUserService userService) { GroupName = groupName; this.userService = userService; var messageChangeService = new MessageChangeService(messageService, userService, groupName);//TODO: factory for these please messages = new MessageCollection(messageChangeService); var statusChangeService = new StatusChangeService(messageService, groupName); statuses = new StatusCollection(statusChangeService); }
public StatusCollection ExecuteAudit(Location location) { var testLoc = new Location("", new Coordinate(0, 0), 5.6m); var auditz = new List <AuditRunner.AuditMethod <Location> >() { AuditTools.LocationPopular, AuditTools.NotInNawamin, AuditTools.AttributesAreSame(testLoc, new string[] { "Rating" }), IsNotJelloWorld }; StatusCollection results = AuditRunner.RunAudits <Location>(location.Name /*Name for result collections*/, location /* Object to run audits on*/, auditz /* Audits to run */); return(results); }
/// <summary> /// 清除输入框 /// </summary> /// <param name="o"></param> public void CleanData(object o) { this.Title = ""; this.Detail = ""; this.AddVisibility = Visibility.Visible; this.EditVisibility = Visibility.Collapsed; this.WorkDateTime = DateTime.Now; this.Begin_time = DateTime.Now; this.End_time = DateTime.Now; this.Status = StatusCollection.First(); }
public void Cast(OnPointTargetCastEventData e) { StatusCollection statusCollection = e.Caster.GetComponentInChildren <StatusCollection>(); if (statusCollection != null) { Status posionStatus = Instantiate(PosionStatus); statusCollection.AddStatus(posionStatus); posionStatus.Emitter.Emit( new OnStatusStartEventData(e.Caster, gameObject, 3f) ); } }
public StatusCollection GetStatus() { StatusCollection status = new StatusCollection(); using (StatusDataAdapter adapter = new StatusDataAdapter()) { IDataReader dr = adapter.GetStatus(); while (dr.Read()) { status.Add(PopulateReader(dr)); } dr.Dispose(); adapter.Dispose(); return status; } }
void GetTop10Alarms() { var z = StatusCollection.Where(m => m.StatusInfo.AlarmContent != "运行中").Where(w => w.StatusInfoId != -1) .GroupBy(x => x.StatusInfo.Id) .Select(x => new { Key = x.First().StatusInfo.AlarmContent, Value = x.Sum(y => y.Span.TotalSeconds) }).OrderByDescending(x => x.Value); if (z.Any()) { var q = z.ToList(); if (q.Count() > 10) { var top10 = q.Take(10); var other = q.Skip(10).Sum(x => x.Value); Top10SeriesCollection[0].Values.Clear(); foreach (var v in top10) { Top10SeriesCollection[0].Values.Add(new ObservableValue(v.Value)); } Top10SeriesCollection[0].Values.Add(new ObservableValue(other)); var l = new List <string>(); l.AddRange(top10.Select(x => x.Key).ToArray()); l.Add("Others"); _top10Labels.Clear(); _top10Labels.AddRange(l.ToArray()); } else { Top10SeriesCollection[0].Values.Clear(); foreach (var v in q) { Top10SeriesCollection[0].Values.Add(new ObservableValue(v.Value)); } _top10Labels.Clear(); _top10Labels.AddRange(q.Select(x => x.Key)); } } else { Top10SeriesCollection[0].Values.Clear(); _top10Labels.Clear(); // return; } }
/// <summary> /// 初始化,读取在线配置信息 /// </summary> private void Inint(object o) { var loadingDialog = new LoadingDialog(); var result = DialogHost.Show(loadingDialog, "RootDialog", delegate(object sender, DialogOpenedEventArgs args) { string access_token = MainStaticData.AccessToken; string get_data = "https://api.bobdong.cn/time_manager/data/select?access_token=" + access_token; var datas = NetHelper.HttpCall(get_data, null, HttpEnum.Get); this.ThisContorler = o; var datasObject = JsonHelper.Deserialize <ReturnData <ObservableCollection <WorkTimeData> > >(datas); ThreadStart start = delegate() { Mainthread.BeginInvoke((Action) delegate()// 异步更新界面 { if (datasObject.code != 0) { } else { DataItems.Clear(); foreach (var item in datasObject.data) { DataItems.Add(new WorkTimeData_ViewData(item)); } } StatusCollection = MainStaticData.StstusCollection; TypeCollection = MainStaticData.TypeCollection; WorkDateTime = DateTime.Now; Status = StatusCollection.First(); args.Session.Close(false); }); }; new Thread(start).Start(); // 启动线程 }); }
public static async Task <StatusCollection> ExecuteAudit(string blueprintid, string coursecopyid) { StatusCollection AuditResults = new StatusCollection("Group Category Audit for " + coursecopyid); try { GroupCategoryObject CourseBlueprint = await GetGroupCategories(blueprintid); GroupCategoryObject CourseCopy = await GetGroupCategories(coursecopyid); } catch (Exception e) { AuditResults.StatusObjects.Add(new StatusObject(-1, "Error Runnig Audit!", e.Message)); } return(AuditResults); }
public void HitTarget(OnCastHitTargetEventData e) { Skill.GetEmitter().Emit(e); StatusCollection StatusCollection = e.With.GetComponentInChildren <StatusCollection>(); Status PosionStatus = Instantiate(StatusPrefab); StatusCollection.AddStatus( PosionStatus ); hasHit = true; PosionStatus.Emitter.Emit( new OnStatusStartEventData(e.With.gameObject, gameObject, 3f) ); StartCoroutine(DestroyAfter(1f)); }
public bool Post([FromBody] MapRequest model) { if (model != null && !string.IsNullOrWhiteSpace(model.Client) && !string.IsNullOrWhiteSpace(model.Emotion)) { StatusCollection.Save(model.Client, model.Emotion); ProcessEmotionRequest(model.Client, model.Emotion); RequestCounter += 1; LastUpdateTime = DateTime.UtcNow; return(true); } else { return(false); } }
public static void LoadStatus(ref RadDropDownList cboStatus) { try { cboStatus.DisplayMember = "StatusName"; cboStatus.ValueMember = "Status_ID"; List <StatusCollection> listStatusCollection = EQ_MainForm.dbContext.StatusCollections.Where(d => d.Active == true).ToList <StatusCollection>(); StatusCollection emptyStatusCollection = new StatusCollection(); emptyStatusCollection.Status_ID = 0; emptyStatusCollection.StatusName = string.Empty; listStatusCollection.Insert(0, emptyStatusCollection); cboStatus.DataSource = listStatusCollection; cboStatus.SelectedIndex = 0; } catch //(Exception ex) { Helper.ShowError("Cannot load the status information!"); } }
void GetStatus() { try { using (var db = new OeedbContext()) { StatusCollection.Clear(); StatusCollection.AddRange( db.Alarms .Include(m => m.StatusInfo) .Where(x => x.StatusInfo.StationId == StationIndex + 1) .Where(x => x.Time > FromDateTime && x.Time < ToDateTime) .OrderBy(x => x.Time)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private async Task AddStatus(StatusViewModel status, bool append = true) { SinceId = Math.Min(SinceId, status.Id); MaxId = Math.Min(MaxId, status.Id); await Dispatcher.RunAsync(() => { if (append) { StatusCollection.Add(status); } else { StatusCollection.Insert(0, status); } }); RaiseNewStatus(status); await UpdateCache(status.Model); }
private void OnCastHit(OnCastHitTargetEventData e) { StatusCollection StatusCollection = e.With.GetComponentInChildren <StatusCollection>(); if (e.With == e.Caster.gameObject) { return; //dont collider with self } if (e.With.layer == e.Caster.layer) { return; //dont collide with shared tags as caster } if (StatusCollection != null) { Status PosionStatus = Instantiate(this.PosionStatus); StatusCollection.AddStatus(PosionStatus); PosionStatus.Emitter.Emit( new OnStatusStartEventData(e.With, gameObject, 3f) ); } }
public async Task GetStatus(string tobeParsedString) { try { IsLoading = true; IsError = false; var ResultList = await StatusParser.Parse(tobeParsedString); foreach (var s in ResultList) { StatusCollection.Add(s); } if (StatusCollection.Count == 0) { IsError = true; } } catch { IsError = true; } IsLoading = false; }
// 現在の状態を文字列に出力する internal StatusCollection dumpStatus(Int64 now) { var expireExceed = this.expireExceed; var remainExpireExceed = expireExceed - now; var hasExceed = remainExpireExceed > 0L; var expectedReset = giftHistory.expectedReset(now); var sc = new StatusCollection(); sc.addRun($"{itemName} 所持数 {giftCounts.sumInTime( now )?.ToString() ?? "不明"} "); giftHistory.addCountTo(sc, hasExceed); /* * var hyperLink = new Hyperlink() { * NavigateUri = new Uri( $"stargarner://{itemNameEn}/settings" ) * }; * hyperLink.Inlines.Add( "設定" ); * hyperLink.RequestNavigate += (sender, e) => window.openSetting(this); * sc.addLink( hyperLink ); */ giftHistory.addTo(sc); var eventList = new List <EventTime>(); if (hasExceed) { eventList.Add(new EventTime(1, "制限解除", expireExceed, remainExpireExceed)); } if (!hasExceed || expectedReset > expireExceed) { var delta = expectedReset - now; if (delta > 0L) { eventList.Add(new EventTime(2, "解除予測", expectedReset, delta)); } } do { var st = liveStarts.current(now); if (st == null) { break; // 配信予定がない } var firstLap = st.time + st.offset - UnixTime.hour1 * 2L; var delta = firstLap - now; if (delta > 0L) { eventList.Add(new EventTime(3, "1周目集め", firstLap, delta)); break; } var dropTime = st.time + st.offset - UnixTime.hour1; delta = dropTime - now; if (delta > 0L) { eventList.Add(new EventTime(4, "捨て時刻", dropTime, delta)); break; } delta = st.time - now; if (delta > 0L) { eventList.Add(new EventTime(5, "配信開始", st.time, delta)); break; } var thrdLapStart = st.time + st.offset; delta = thrdLapStart - now; // 3周目は過去になっても表示する eventList.Add(new EventTime(6, "3周目開始", thrdLapStart, delta)); } while (false); eventList.Sort(); foreach (var ev in eventList) { sc.add($"{ev.time.formatTime()} 残{ev.remain.formatDuration()} {ev.name}"); } return(sc); }
public ReduceResult Get() { return(new ReduceResult(RequestCounter, StatusCollection.Load(), LastUpdateTime)); }
public void Delete() { StatusCollection.Reset(); }