public void ClearTest() { model.GetTotalShapes.Add(new Line()); model.Clear(); Assert.AreEqual(model.CurrentMode, -1); model.Clear(); }
public void DrawShapeTest1() { Line line = new Line(); _model.DrawShape(line); Assert.AreEqual(line, _model.GetShapeList()[0]); _model.Clear(); Rectangle rectangle = new Rectangle(); _model.DrawShape(rectangle); Assert.AreNotEqual(line, _model.GetShapeList()[0]); Assert.AreEqual(rectangle, _model.GetShapeList()[0]); }
protected void GenerateOutput() { while (!Model.GenerationFinished) { Model.Observe(); if (Model.Contradiction) { Debug.Log($"Generation Failed after {Model.NumGen} iterations!"); Model.Clear(); } } Debug.Log($"Generation finished after {Model.NumGen} iterations!"); }
public static void BuildMesh(double width, double height, double stepX, double stepY) { model.Clear(); GenerateNodesConstraintsAndLoads(width, height, stepX, stepY); GenerateElements(width, height, stepX, stepY); Subdomain subdomain = new Subdomain(); subdomain.ID = 1; foreach (Element element in model.Elements) { subdomain.ElementsDictionary.Add(element.ID, element); } model.SubdomainsDictionary.Add(subdomain.ID, subdomain); GenerateClusters(); }
public void DoClose() { if (ContractsListView.Items.Count != 0) { Model.Clear(); foreach (ListViewItem item in ContractsListView.Items) { var subItem = item.SubItems; DateTime.TryParse(subItem[1]?.Text, CultureInfo.GetCultureInfo("ru-RU"), DateTimeStyles.None, out var dateOfStart); DateTime.TryParse(subItem[3]?.Text, CultureInfo.GetCultureInfo("ru-RU"), DateTimeStyles.None, out var dateOfEnd); Model.Add(new Contract { NumberOfContract = subItem[0]?.Text, DateOfStart = dateOfStart, SidesOfContract = subItem[2]?.Text, DateOfEnd = dateOfEnd, ConditionsOfContract = subItem[4]?.Text, ContractStage = subItem[5]?.Text }); } } IsDirty = false; }
private void toolCmbPrimitives_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Model.Clear(); //MessageBox.Show(toolCmbPrimitives.Text); foreach (Cube primitive in primitives) { MessageBox.Show(primitive.primitiveName); if (primitive.primitiveName == toolCmbPrimitives.Text) { Cube newCube = new Cube(); newCube.Initialize(primitive); newCube.Origin = new Cube(); newCube.Origin.Initialize(primitive); newCube.TransCube = new Cube(); newCube.TransCube.Initialize(primitive); Model.Add(newCube); } // break; } scaledShapes.Clear(); DefineScaledShapes(); } }
public void Clear(string name, UUID id) { /* * Queue.Paused = true; * int queued = 0; * int processed = 0; * ForAllLinks(name, id, link => { * Queue.QWork("Clear Link " + link.Name, () => { * Record.RemoveLink(link.ID, new Parameters("Clearing", true)); * processed++; * }); * queued++; * }); */ //Queue.Paused = false; //Queue.BlockWhileWorking(); //Console.WriteLine("Removed all links - {0} queued - {1} processed.", queued, processed); //Queue.Paused = true; List <UUID> nodeList = new List <UUID>(); ForAllNodes(name, id, node => nodeList.Add(node.ID)); UUID[] nodes = nodeList.ToArray(); Logger.Info("Clearing " + nodes.Length + " nodes."); Record.Clear(nodes.ToArray()); Model.Clear(nodes.ToArray()); //Queue.Paused = false; //Queue.BlockWhileWorking(); }
public void PointerPressedTest() { _model.ClickLine(); _model.PointerPressed(X1, Y1); _model.PointerMoved(X2, Y2); _model.PointerReleased(X3, Y3); _model.ClickRectangle(); _model.PointerPressed(X1, Y1); _model.PointerMoved(X2, Y2); _model.PointerReleased(X3, Y3); _model.ClickEllipse(); _model.PointerPressed(X1, Y1); _model.PointerMoved(X2, Y2); _model.PointerReleased(X3, Y3); _model.ClickArrow(); _model.PointerPressed(X1, Y1); _model.PointerMoved(X2, Y2); _model.PointerReleased(X3, Y3); _model.ClickSelect(); _model.PointerPressed(X1, Y1); _model.PointerMoved(X2, Y2); _model.PointerReleased(X3, Y3); _model.ClickDelete(); _model.ClickUndo(); _model.ClickRedo(); _model.Clear(); Assert.AreEqual(1, 1); }
protected override void DisposeManagedResources() { Filters.IgnoreEvents = true; EventTypesTimeline.IgnoreEvents = true; FullTimeline.IgnoreEvents = true; if (Model != null) { Model.IgnoreEvents = true; } if (Model != null) { Model.Clear(); } if (eventTypes != null) { eventTypes.ViewModels.CollectionChanged -= HandleEventTypesCollectionChanged; } Filters.Dispose(); EventTypesTimeline.Dispose(); FullTimeline.ViewModels.CollectionChanged -= HandleTimelineCollectionChanged; FullTimeline.Dispose(); TeamsTimeline.Dispose(); Model = null; Filters = null; EventTypesTimeline = null; FullTimeline = null; TeamsTimeline = null; base.DisposeManagedResources(); }
public void DoClose() { if (LicenseListView.Items.Count != 0) { Model.Clear(); foreach (ListViewItem item in LicenseListView.Items) { var subItem = item.SubItems; DateTime.TryParse(subItem[1]?.Text, CultureInfo.GetCultureInfo("ru-RU"), DateTimeStyles.None, out var dateOfIssue); DateTime.TryParse(subItem[2]?.Text, CultureInfo.GetCultureInfo("ru-RU"), DateTimeStyles.None, out var dateOfExpiration); Model.Add(new License { NumberOfLicense = subItem[0]?.Text, DateOfIssue = dateOfIssue, DateOfExpiration = dateOfExpiration, LicenseType = subItem[3]?.Text }); } } IsDirty = false; }
/// <summary> /// Clears all data and prepares UI for new project. Optionally it can also show the new project dialog (in this case, <see cref="Model.Name"/> will be updated if user confirms it). /// </summary> private void CreateNewProject(bool showDialog = false) { if (showDialog) { if (!ShowProjectNameDialog()) { return; } } Model.Clear(); SetForm(); ClearBitmap(Model.BlocksBitmap); blocksPictureBox.Image = Model.BlocksBitmap; blocksPictureBox.Height = Model.BlocksBitmap.Height; blocksPictureBox.Width = Model.BlocksBitmap.Width; blocksPictureBox.Invalidate(true); blocksPictureBox.Refresh(); ClearBitmap(Model.CharsBitmap); charsPictureBox.Image = Model.CharsBitmap; charsPictureBox.Invalidate(true); charsPictureBox.Refresh(); isPaletteSet = false; SetForm(); DisposeImageWindows(); }
public void DoClose() { if (ProductsListView.Items.Count != 0) { Model.Clear(); foreach (ListViewItem item in ProductsListView.Items) { var subItem = item.SubItems; double.TryParse(subItem[3]?.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out var costFromSeller); double.TryParse(subItem[5]?.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out var costForCustomer); Model.Add(new Product { NumberOfContract = subItem[0]?.Text, Name = subItem[1]?.Text, Description = subItem[2]?.Text, CostFromSeller = costFromSeller, CostFromSellerCurrency = subItem[4]?.Text, CostForCustomer = costForCustomer, CostForCustomerCurrency = subItem[6]?.Text, RateCurrency = subItem[7]?.Text, Count = subItem[8]?.Text, GenericCost = subItem[9]?.Text, GenericCostCurrency = subItem[10]?.Text }); } } IsDirty = false; }
protected override void Dispose(bool disposing) { Model?.Clear(); Model = null; Service = null; ErrorModel = null; }
public virtual async Task RefreshModelInformation(int id, bool totalRefresh) { if (id <= 0) { return; } Model.Id = id; OperationResult <TDataOrder> operation = await RunOperationThroughNonCriticalState(() => _interactor.LookupAsync(Model)); if (operation.WasSuccessful) { await RefreshSuccessful(operation.Result); if (totalRefresh) { await RefreshDependentLocators(_adminToken); } } else { await BackForwardNavigator.UpdateCurrentItem(-1); Model.Clear(); ClearAndDisableDependentLocators(_adminToken); } }
private async void RefreshFeed() { try { IsRefreshing = true; var result = await _dataService.GetNewsfeed(); Model.Clear(); foreach (var item in result) { IFeedItemViewModel vm; if (item.Type == typeof(Video)) { vm = new VideoViewModel(_dataService, (Video)item); Model.Add(vm); } else if (item.Type == typeof(Wiki)) { vm = new WikiViewModel(_dataService, _navigationService, (Wiki)item); Model.Add(vm); } } } catch (Exception e) { var dialog = ServiceLocator.Current.GetInstance <IDialogService>(); dialog.ShowError(e, "Error Refreshing", "Ok", null); } finally { IsRefreshing = false; } }
/// <summary> /// The logic to run when the <see cref="ModelSearcher" /> is cleared. /// </summary> protected virtual void OnModelSearcherCleared() { _backForwardNavigator.UpdateCurrentItem(-1); _backForwardNavigator.UpdateNavigationCollection(new int[0]); DependentLocators.ForEach(locator => locator.RequestDisable(_adminToken)); Model.Clear(); ClearAndDisableDependentLocators(_adminToken); }
public void ClearTest() { model.Name = "test"; model.Facets.Add(new Facet()); model.Clear(); Assert.IsTrue(string.IsNullOrEmpty(model.Name)); Assert.AreEqual(0, model.Facets.Count); }
// 清除畫面 public void HandleClearButtonClick(object sender, System.EventArgs e) { _model.Clear(); SetButtonDisable(int.Parse(((Button)sender).Tag.ToString())); _model.CurrentMode = -1; _model.IsSelected = false; _model.CurrentState = _pointerState; RefreshUserInterface(); }
private void ClearCommandHandler(object?_) { Model.Clear(); foreach (Models.Cell cell in Model.Cells) { Cells.UpdateCell(cell); } }
public void ParseFile(string fileName) { Model.Clear(); viewController.OpenIFCFile(fileName); Rect3D bounds = FindBounds(); ZoomExtents(Viewport3D, bounds); Viewport3D.ReAttach(); Viewport3D.ReAttach(); }
public void OnAfterDeactivate() { CoreHelper.SetSipButton(true); Model.Clear(); klvMessagesList.DataSource = Model; klvMessagesList.Reload(); }
protected override void Load() { var albums = _session.QueryOver <Album>().Fetch(x => x.Artist).Eager.List(); Model.Clear(); if (albums.Any()) { albums.Select(album => new AlbumViewModel(album)).ToList().ForEach(Model.Add); } }
private async void Refresh() { var result = await _dataService.GetWikis(); Model.Clear(); foreach (var item in result) { Model.Add(new WikiViewModel(_dataService, _navigationService, item)); } }
/// <summary> /// Handles view OnKeyPressed /// </summary> /// <param name="sender">sender of the event</param> /// <param name="args">arguments of the event. It contains the typed key.</param> private void HandleKeyPressed(object sender, CalculatorKeyPressedEventArgs args) { //is clear or result has already been computed if (args.Key == "CE" || resultComputed) { Model.Clear(); resultComputed = false; operationGiven = false; } //is a digit if (Regex.IsMatch(args.Key, "^[0-9]$")) { if (!operationGiven) { Model.FirstOperand = int.Parse(Model.FirstOperand + args.Key); } else { Model.SecondOperand = int.Parse(Model.SecondOperand + args.Key); } } //is an operand else if (Regex.IsMatch(args.Key, @"^[\+\-\*\/]$")) { operationGiven = true; switch (args.Key) { case "+": Model.Operation = CalculatorOperation.Add; break; case "-": Model.Operation = CalculatorOperation.Sub; break; case "*": Model.Operation = CalculatorOperation.Mul; break; case "/": Model.Operation = CalculatorOperation.Div; break; } } //is = button else if (args.Key == "=") { if (!resultComputed && operationGiven) { Model.ComputeResult(); } } }
public void Import(Stream stream) { model.Clear(); if (IsBinary(stream)) { ReadBinary(stream); } else { ReadASCII(stream); } }
public void ClearTest() { _model.PressPointer(ShapeType.Line, 1, 1); _model.ReleasePointer(2, 2); _model.PressPointer(ShapeType.Rectangle, 3.2, 4.3); _model.ReleasePointer(1, 2.3); _model.Clear(); List <Shape> list = (List <Shape>)_target.GetField("_shapes"); Assert.AreEqual(list.Count, 0); Assert.AreEqual(_isNotify, true); }
public void OnAfterDeactivate() { klvDetailed.ReleaseUserPhotos(); //проверить //klvDetailed.Clear(); Model.Clear(); klvDetailed.DataSource = Model; klvDetailed.Reload(); }
public void Merge(ReportCollection reports, bool clearCodeCoverage) { if (clearCodeCoverage) { Model.Clear(); } foreach (Report report in reports) { Model.Merge(report); } OnModelChanged(); }
public void Load(string fileName) { Model.Clear(); Console.WriteLine($"Reading {Tools.GetShortPath(fileName)}..."); foreach (var t in System.Ai.Model.Read(fileName)) { var y = Model.Push(t.Id); y.SetScore(t.GetScore()); y.SetVector( t.GetVector()); } Console.WriteLine($"Done."); CreateNegativeDistribution((int)1e7); }
void ScenarioViewModel_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { switch (e.Action) { case System.Collections.Specialized.NotifyCollectionChangedAction.Add: for (int i = e.NewStartingIndex; i < e.NewStartingIndex + e.NewItems.Count; i++) { this[i].OwnerScenario = this; Model.Insert(i, this[i].Model); } break; case System.Collections.Specialized.NotifyCollectionChangedAction.Replace: for (int i = e.NewStartingIndex; i < e.NewStartingIndex + e.NewItems.Count; i++) { this[i].OwnerScenario = this; Model[i] = this[i].Model; } break; case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: foreach (AtomViewModel atom in e.OldItems) { atom.OwnerScenario = null; Model.RemoveAt(e.OldStartingIndex); if (OwnerDocument != null) { OwnerDocument.ClearLinks(atom); } } IsComplex = Items.Any(atom => atom.Model.Type == AtomTypes.Marker); break; case System.Collections.Specialized.NotifyCollectionChangedAction.Reset: Model.Clear(); foreach (AtomViewModel atom in this) { atom.OwnerScenario = this; Model.Add(atom.Model); } IsComplex = Items.Any(atom => atom.Model.Type == AtomTypes.Marker); break; } UpdateCommands(); }