//Canvas Dreick klick private void Dreieck1(Point pos) { TmpFigur = new TDreieck(CanvasZeichnung, pos); TmpFigur.Pos2 = pos; TmpFigur.Modus = TZeichenModus.Entwurf; status = TStatus.Dreieck2; }
private void Dreieck2(Point pos) { TmpFigur.Pos2 = pos; ((TDreieck)TmpFigur).Pos3 = pos; TmpFigur.Modus = TZeichenModus.Normal; status = TStatus.Dreieck3; }
void StatusUpdated(TStatus status) { Dispatcher.Invoke(() => { chatlist.Add(status.User.UserName, status.Text); }); }
internal static void ThrowIfInvalidStatus(TStatus status) { if (new[] { TStatusCode.ERROR_STATUS, TStatusCode.INVALID_HANDLE_STATUS }.Contains(status.StatusCode)) { throw new SparkOperationException(status.ErrorMessage, status.InfoMessages); } }
public static void CheckStatus(this TStatus status) { if (status.__isset.errorMessage) { throw new Exception(status.ErrorMessage); } }
/// <summary> /// Initializes a new instance of the <see cref="Transition"/> class. /// </summary> /// <param name="source">The source status.</param> /// <param name="target">The target status.</param> /// <param name="command">The trigger command.</param> /// <param name="isCodeMatch">A function to test if the code triggers this transition.</param> public Transition(TStatus source, TStatus target, [NotNull] string command, Func <int, bool> isCodeMatch) { Source = source; Target = target; _isCommandMatchFunc = cmd => string.Equals(command, cmd.Trim(), StringComparison.OrdinalIgnoreCase); _isCodeMatchFunc = isCodeMatch; }
private void Explore(TStatus status) { if (completed[status]) { return; } started[status] = true; Relationship identity = new Relationship { Path = new List <DirectRelation> { new DirectRelation { Status = status, Relation = RelationType.Self } } }; Record(identity); // Record the 'self' relationship for this status. foreach (var relationship in GetConnectionsFrom(status)) { TStatus targetStatus = relationship.TargetStatus; if (!completed[targetStatus] && !started[targetStatus]) { Explore(targetStatus); } if (completed[targetStatus]) { MergeExisting(relationship, targetStatus); } else { ExploreManually(status, identity); break; } } completed[status] = true; }
//Modus setzen, neue Zeichnung anlegen private void Window_Loaded(object sender, RoutedEventArgs e) { status = TStatus.Bearbeiten; modus = TModus.Bearbeiten; TmpFigur = null; zeichnung = new TZeichnung(); Bearbeiten.IsChecked = true; }
/// <summary> /// Initializes a new instance of the <see cref="Transition"/> class. /// </summary> /// <remarks> /// The <paramref name="hundredsRange"/> is multiplied by 100 to get the FTP code range. /// </remarks> /// <param name="source">The source status.</param> /// <param name="target">The target status.</param> /// <param name="command">The trigger command.</param> /// <param name="hundredsRange">The hundreds range.</param> public Transition(TStatus source, TStatus target, [NotNull] string command, int hundredsRange) : this(source, target, command, code => code >= (hundredsRange * 100) && code < (hundredsRange + 1) * 100) { if (hundredsRange > 9) { throw new ArgumentOutOfRangeException(nameof(hundredsRange), "The value must be below 10."); } }
private void MergeExisting(Relationship relationship, TStatus targetStatus) { TStatus status = relationship.SourceStatus; foreach (Relationship targetRelationship in relationships[targetStatus]) { Record(GetMerged(relationship, targetRelationship)); } }
//Kreis zweiter Punkt private void Kreis2(Point pos) { TmpFigur.Pos2 = pos; TmpFigur.Modus = TZeichenModus.Normal; zeichnung.Add(TmpFigur); if (tauschePunkte == true) { TmpFigur.tauschePunkte(); tauschePunkte = false; } TmpFigur = null; status = TStatus.Linie1; }
//Toolbox auswählen private void Click_box(object sender, RoutedEventArgs e) { modus = buttonToModus((ToggleButton)(sender)); status = modusToStatus(modus); Bearbeiten.IsChecked = false; Linie.IsChecked = false; Dreieck.IsChecked = false; Ellipse.IsChecked = false; Kreis.IsChecked = false; Rechteck.IsChecked = false; Quadrat.IsChecked = false; ((ToggleButton)(sender)).IsChecked = true; entferneTmpFigur(); }
private string GetBestName(TStatus status) { if (typeof(TStatus).IsEnum) { return(status.ToString()); } foreach (Type enumType in rules.extraEnumTypes) { try { var name = Enum.Parse(enumType, status.ToString()); return(name.ToString()); } catch (ArgumentException) { continue; } } return(status.ToString()); }
private HashSet <TStatus> GetExtendedFamily(TStatus status) { HashSet <TStatus> result = new HashSet <TStatus>(); Queue <TStatus> q = new Queue <TStatus>(); q.Enqueue(status); while (q.Count > 0) { TStatus nextStatus = q.Dequeue(); if (result.Add(nextStatus)) { foreach (var extendingStatus in rules.statusesThatExtend[nextStatus]) { q.Enqueue(extendingStatus); } } } return(result); }
private void Dreieck3(Point pos) { ((TDreieck)TmpFigur).Pos3 = pos; TmpFigur.Modus = TZeichenModus.Normal; zeichnung.Add(TmpFigur); if (tauschePunkte == true) { if (tauscheDreieckID == 1) { ((TDreieck)TmpFigur).tauschePunkte_1(); } if (tauscheDreieckID == 2) { ((TDreieck)TmpFigur).tauschePunkte_2(); } tauschePunkte = false; } TmpFigur = null; status = TStatus.Dreieck1; }
//rechtklick im canvas private void CanvasZeichnung_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { //tmp figur entfernen bei rechtsklick if (modus != TModus.Bearbeiten) { entferneTmpFigur(); status = modusToStatus(modus); statusafteropen(); } //else configuration öffnen, wenn objekt else { Point pos = e.GetPosition(CanvasZeichnung); TFigur figur = FangeFigur(pos); if (figur != null) { figur.ZeigeKontextMenu(zeichnung, CanvasZeichnung); zeichnung.change = true; } } }
//set satus without click event private void statusafteropen() { if (Bearbeiten.IsChecked == true) { status = TStatus.Bearbeiten; modus = TModus.Bearbeiten; } if (Linie.IsChecked == true) { status = TStatus.Linie1; modus = TModus.Linie; } if (Dreieck.IsChecked == true) { status = TStatus.Dreieck1; modus = TModus.Dreieck; } if (Ellipse.IsChecked == true) { status = TStatus.Linie1; modus = TModus.Ellipse; } if (Kreis.IsChecked == true) { status = TStatus.Linie1; modus = TModus.Kreis; } if (Rechteck.IsChecked == true) { status = TStatus.Linie1; modus = TModus.Rechteck; } if (Quadrat.IsChecked == true) { status = TStatus.Linie1; modus = TModus.Quadrat; } }
private void ExploreManually(TStatus status, Relationship pathSoFar) { foreach (var relationship in GetConnectionsFrom(status)) { TStatus targetStatus = relationship.TargetStatus; Relationship fullPathRelationship = GetMerged(pathSoFar, relationship); if (pathSoFar.Path.Where(x => x.Status.Equals(targetStatus)).Any()) // If targetStatus is already in the path... { Record(fullPathRelationship); // Record this link, and go no farther. } else { if (completed[targetStatus]) { MergeExisting(fullPathRelationship, targetStatus); } else { Record(fullPathRelationship); ExploreManually(targetStatus, fullPathRelationship); } } } }
/// <summary> /// Создание объекта "Предмет" с заданными параметрами /// </summary> /// <param name="pname">Название предмета (курса)</param> /// <param name="pstatus">Статус предмета</param> /// <remarks>Конструктор для обработки данных при чтении из файла</remarks> public TSubject(string pname, TStatus pstatus) { name = pname; status = pstatus; list = null; }
/// <summary> /// Инициализация объекта с заданными параметрами и для списка /// </summary> /// <param name="pname">Название предмета</param> /// <param name="pstatus">Статус предмета</param> /// <param name="listname">Название списка работ</param> /// <param name="listdesc">Описание списка работ</param> /// <remarks>Полный конструктор, для одновременного создания предмета и списка его работ</remarks> public TSubject(string pname, TStatus pstatus, string listname, string listdesc) { name = pname; status = pstatus; list = new TLabList(listname, listdesc); }
/// <summary> /// Initializes a new instance of the <see cref="Transition"/> class. /// </summary> /// <param name="source">The source status.</param> /// <param name="target">The target status.</param> /// <param name="command">The trigger command.</param> /// <param name="resultCode">The expected FTP code.</param> public Transition(TStatus source, TStatus target, [NotNull] string command, SecurityActionResult resultCode) : this(source, target, command, code => code == (int)resultCode) { }
TType type; // тип задачи #endregion Fields #region Constructors /// <summary> /// Конструктор для создания корневого элемента /// </summary> public TToDoItem() { name = "Задачи проекта"; text = "Задачи проекта"; label = ""; tags = ""; progress = 0; status = TStatus.New; dateCreated = DateTime.Now; // инициализируем массив задач Items = new TToDoItem[0]; // у корня нет истории! (а может и есть, увидим дальше) }
private void ThreadContorl(Threads v, TStatus s) { switch (s) { case TStatus.Start: switch (v) { case Threads.Point: if (t.IsAlive) { t.Abort(); } t = new Thread(new ThreadStart(PointStatus)); t.Start(); break; case Threads.Learn: if (d.IsAlive) { d.Abort(); } d = new Thread(new ThreadStart(LeaningPlan)); d.Start(); break; case Threads.Rock: if (f.IsAlive) { f.Abort(); } f = new Thread(new ThreadStart(Rock)); f.Start(); break; } break; case TStatus.Stop: switch (v) { case Threads.Point: if (t != null && t.IsAlive) { t.Abort(); } break; case Threads.Learn: if (d != null && d.IsAlive) { d.Abort(); } break; case Threads.Rock: if (f != null && f.IsAlive) { f.Abort(); } break; } break; case TStatus.Restart: switch (v) { case Threads.Point: if (t.IsAlive) { t.Abort(); } t = new Thread(new ThreadStart(PointStatus)); t.Start(); break; case Threads.Learn: if (d.IsAlive) { d.Abort(); } d = new Thread(new ThreadStart(LeaningPlan)); d.Start(); break; case Threads.Rock: if (f.IsAlive) { f.Abort(); } f = new Thread(new ThreadStart(Rock)); f.Start(); break; } break; } }
//Ellipse erster Punkt private void Ellipse1(Point pos) { TmpFigur = new TEllipse(CanvasZeichnung, pos); TmpFigur.Modus = TZeichenModus.Entwurf; status = TStatus.Linie2; }
//Kreis erster Punkt private void Kreis1(Point pos) { TmpFigur = new TKreis(CanvasZeichnung, pos); TmpFigur.Modus = TZeichenModus.Entwurf; status = TStatus.Linie2; }
/// <summary> /// Обновление статуса работы /// </summary> public void RefreshStatus() { int count = 0; for (int i = 0; i < elements.Length; i++) if (elements[i].isCompleted) count++; if (count > 0 && count < elements.Length) status = TStatus.InWork; else if (count == elements.Length) status = TStatus.Completed; else if (count == 0) status = TStatus.NotStarted; }
//Quadrat erster Punkt private void Quadrat1(Point pos) { TmpFigur = new TQuadrat(CanvasZeichnung, pos); TmpFigur.Modus = TZeichenModus.Entwurf; status = TStatus.Linie2; }
public Transaction(OwnAction action) { this.Status = TStatus.Execute; this.Action = action; }
/// <summary> /// Получает название статуса /// </summary> /// <param name="status">Статус</param> /// <returns>Возвращает строку с названием статуса</returns> public static string GetStatusName(TStatus status) { return StatusNames[(int)status]; }
public Entry(TKey key, TValue item, TStatus status) { Key = key; Item = item; Status = status; }
/// <summary> /// Инициализация объекта /// </summary> /// <param name="pname">Название работы</param> /// <param name="pdesc">Описание работы</param> /// <param name="pstatus">Статус работы</param> /// <remarks>Конструкор используемый при чтении данных из файла</remarks> public TListItem(string pname, string pdesc, TStatus pstatus) { name = pname; description = pdesc; status = pstatus; elements = new Element[0]; // пустой массив изначально }
private IEnumerable <Relationship> GetConnectionsFrom(TStatus status) { foreach (TStatus targetStatus in rules.statusesExtendedBy[status]) { yield return(new Relationship { Path = new List <DirectRelation> { new DirectRelation { Status = status, Relation = RelationType.Self }, new DirectRelation { Status = targetStatus, Relation = RelationType.Extends } } }); } foreach (TStatus targetStatus in rules.statusesCancelledBy[status]) { var pair = new StatusPair(status, targetStatus); bool conditional = rules.cancellationConditions[pair] != null; yield return(new Relationship { Path = new List <DirectRelation> { new DirectRelation { Status = status, Relation = RelationType.Self }, new DirectRelation { Status = targetStatus, Relation = RelationType.Cancels, IsConditional = conditional } } }); } foreach (InstanceType instanceType in new InstanceType[] { InstanceType.Feed, InstanceType.Suppress, InstanceType.Prevent }) { RelationType relation; switch (instanceType) { case InstanceType.Feed: relation = RelationType.Feeds; break; case InstanceType.Suppress: relation = RelationType.Suppresses; break; case InstanceType.Prevent: relation = RelationType.Prevents; break; default: throw new NotImplementedException(); } foreach (TStatus targetStatus in rules.statusesFedBy[instanceType][status]) { var pair = new StatusPair(status, targetStatus); bool conditional = rules.converters[instanceType].ContainsKey(pair); yield return(new Relationship { Path = new List <DirectRelation> { new DirectRelation { Status = status, Relation = RelationType.Self }, new DirectRelation { Status = targetStatus, Relation = relation, IsConditional = conditional } } }); } } }
TStatus status; // статус предмета (курса) #endregion Fields #region Constructors /// <summary> /// Создание объекта "Предмет" с заданными параметрами /// </summary> /// <param name="pname">Название предмета (курса)</param> /// <remarks>Конструктор по умолчаню, при первом создании предмета</remarks> public TSubject(string pname) { name = pname; status = TStatus.NotStarted; // начальный статус list = new TLabList(pname, "Работы по курсу " + pname); }
/// <summary> /// Обновление статуса предмета в целом /// </summary> public void RefreshStatus() { // TODO: что-то в этом методе есть еще не так...?? int count = 0; for (int i = 0; i < list.Items.Length; i++) if (list.Items[i].Status == TStatus.Completed) count++; if (count == list.Items.Length) status = TStatus.Completed; else { count = 0; for (int i = 0; i < list.Items.Length; i++) if (list.Items[i].Status == TStatus.InWork) count++; if (count > 0 && count < list.Items.Length) status = TStatus.InWork; else { count = 0; for (int i = 0; i < list.Items.Length; i++) if (list.Items[i].Status == TStatus.NotStarted) count++; if (count == list.Items.Length) status = TStatus.NotStarted; } } }
private void CheckRpsErrors(List <string> result, bool includeWarnings) { foreach (Relationship r in relationships.GetAllValues()) { // This part finds rock-paper-scissors relationships and decides whether they're potentially dangerous or not. if (r.SourceStatus.Equals(r.TargetStatus) && r.IsNegative && r.ChainBroken && r.Path.Count == 4) { RelationType relation = r.Path[1].Relation; // The first is 'self'. Skip that one. if (r.Path.Skip(2).All(x => x.Relation == relation)) // If the rest are the same, we have a basic rock-paper-scissors relationship. { var trio = r.Path.Take(3).Select(x => x.Status).ToList(); if (visitedRps[trio]) { continue; // If already visited, skip it. } RecordRpsVisited(trio); bool notDangerous = false; EasyHashSet <RelationType> negatives = new EasyHashSet <RelationType> { RelationType.Cancels, RelationType.Prevents, RelationType.Suppresses }; for (int i = 0; i < 3; ++i) // For each pair (A -> B)... { TStatus source = r.Path[i].Status; TStatus target = r.Path[i + 1].Status; EasyHashSet <RelationType> removed = new EasyHashSet <RelationType>(); foreach (RelationType presentRelation in negatives) { if (!relationships[source] .Where(x => x.TargetStatus.Equals(target) && !x.ChainBroken && x.Relation == presentRelation) .Any()) // Note which relation types are present for all statuses in this cycle. { removed[presentRelation] = true; if (presentRelation == RelationType.Suppresses) { notDangerous = true; // No suppression means no danger. } } } negatives.ExceptWith(removed); // Remove the no-longer-true relationship flags. bool cancelled = false; if (relationships[source] .Where(x => x.TargetStatus.Equals(target) && !x.ChainBroken && x.Relation == RelationType.Cancels && !x.IsConditional) .Any()) // If B is cancelled (unconditionally) by A, that's half of what we need to know. { cancelled = true; } HashSet <TStatus> targetRelatives = GetExtendedFamily(target); // Target, any that extend it, and so on. var fedRelationships = relationships.GetAllValues(); fedRelationships = fedRelationships.Where(x => targetRelatives.Contains(x.TargetStatus)); fedRelationships = fedRelationships.Where(x => x.Relation == RelationType.Feeds && x.Path.Count == 2); bool fed = fedRelationships.Any(); // If B can be fed by another value, that's the other half of what we need to know. if (cancelled && !fed) // If its status can actually be cancelled (without still being fed) { notDangerous = true; // then this one can't be dangerous. break; } } string verbs; if (negatives.Count == 3) { verbs = "foils"; } else { verbs = string.Join(" and ", negatives.Select(x => x.ToString().ToLower())); } if (notDangerous) { if (includeWarnings) { string error = $"OKAY: Rock-paper-scissors relationship: Each of these statuses {verbs} the next:"; error += GetPathString(r.Path, false); result.Add(error); } } else { if (r.IsConditional) { if (includeWarnings) { string error = $"CRITICAL WARNING: Infinite suppression loop likely for this rock-paper-scissors relationship: Each of these statuses {verbs} the next:"; error += GetPathString(r.Path, false); result.Add(error); } } else { string error = $"CRITICAL ERROR: Infinite suppression loop guaranteed for this rock-paper-scissors relationship: Each of these statuses {verbs} the next:"; error += GetPathString(r.Path, false); result.Add(error); } } } } } }
/// <summary> /// Конструктор для полноценной задачи /// </summary> /// <param name="pname">Название задачи</param> /// <param name="ptext">Расшифровка задачи</param> /// <param name="plabel">Метка задачи</param> /// <param name="ptags">Тэги</param> /// <param name="pstatus">Статус</param> /// <param name="ptype">Тип задачи</param> /// <param name="ppriority">Приоритет</param> public TToDoItem(string pname, string ptext, string plabel, string ptags, TStatus pstatus, TType ptype, TPriority ppriority) { name = pname; text = ptext; label = plabel; tags = ptags; status = pstatus; type = ptype; priority = ppriority; dateCreated = DateTime.Now; // везде берем за отчет текущее время и дату, момент создания progress = 0; // инициализируем массив задач Items = new TToDoItem[0]; // добавляем историю теперь history = new THistory[0]; AddHistory(); }
/// <summary> /// Полчает цвет по статус работы /// </summary> /// <param name="status">Статус работы</param> /// <returns>Возвращает цвет из перечисления Color</returns> public static Color GetStatusColor(TStatus status) { return StatusColors[(int)status]; }
public static Image GetStatusImage(TStatus type) { return Image.GetInstance(DataPathGetter.GetImagesDir() + "\\" + StatusImgs[(int)type]); }
public static string GetStatusString(TStatus type) { return StatusStrs[(int)type]; }
//rechteck erster Punkt private void Rechteck1(Point pos) { TmpFigur = new TRechteck(CanvasZeichnung, pos); TmpFigur.Modus = TZeichenModus.Entwurf; status = TStatus.Linie2; }
//#region 3.0 抢单处理 ///// <summary> ///// 将普通的未处理的派工单变更为抢单 ///// </summary> ///// <param name="ids"></param> ///// <returns></returns> //public async Task<bool> ChangeToRob(List<long> ids) //{ // var orderList = await _orderRepository.GetAllListAsync(u => ids.Contains(u.Id) && u.OrderType.Equals(OrderType.Dispatch) && u.TStatus.Equals(TStatus.Init)); // if (orderList.Count == 0) // { // throw new UserFriendlyException("任务状态只有同时是未处理才能进入抢单"); // } // orderList.ForEach(u => // { // u.OrderType = OrderType.Rob; // }); // return await Task.FromResult(true); //} ///// <summary> ///// 抢单 ///// </summary> ///// <param name="orderId"></param> ///// <returns></returns> //public async Task<bool> Robber(long orderId) //{ // //1:检查订单状态 // var order = await _orderRepository.GetAsync(orderId); // if (order.TStatus != TStatus.Init) // { // throw new UserFriendlyException("订单被抢啦,下次加油..."); // } // //2:分配记录 // await Assign(new List<CreateHandlerDto>() // { // new CreateHandlerDto() // { // HandleId=AbpSession.GetUserId(), // OrderId=orderId, // OStatus=OStatus.Init // } // }); // return await Task.FromResult(true); //} //#endregion #region 4.0 报表统计 public async Task <int> GetTStatusCount(TStatus status) { return(await _orderRepository.CountAsync(u => u.TStatus.Equals(status))); }
TStatus status; // статус выполнения работы #endregion Fields #region Constructors /// <summary> /// Инициализация новой работы /// </summary> /// <param name="pname">Название работы</param> /// <param name="pdesc">Описание работы</param> /// <param name="els">Элементы работы</param> public TListItem(string pname, string pdesc, Element[] els) { name = pname; description = pdesc; elements = els; status = TStatus.NotStarted; // начальный статус работы }