public PageSolve(BaseLayer baseLayer, TaskCombinationsView task4CombinationsView) { InitializeComponent(); _baseLayer = baseLayer; localTaskLayer = task4CombinationsView; BindElements(); }
public void Task1HaveActionMethodTest() { var baseLayer = new BaseLayer(); // добавляем две комбинации в таблицу Combinations // событие null потому, что проверяется наличие только действия baseLayer.DssDbContext.Combinations.Local.Add(new Combination { Action = new Action(), Event = null }); baseLayer.DssDbContext.Combinations.Local.Add(new Combination { Action = new Action(), Event = null }); // в случае если действие act уже присутствовало при создании комбинаций действие-событие т.е. данное действие имеется в таблице Combinations var act = baseLayer.DssDbContext.Combinations.Local[0].Action; // вызываем тестируемый метод bool actual = LocalTaskLayer.HaveAction(act, baseLayer.DssDbContext.Combinations.Local); // если в таблице Combinations имеется запись содержащий действие act метод возвратит true Assert.AreEqual(true, actual, "Ошибка, так как данное действие присутствует в таблице Combinations"); // случае если было добавлено новое действие, проверяем имеется ли это действие в таблице Combinations act = new Action(); actual = LocalTaskLayer.HaveAction(act, baseLayer.DssDbContext.Combinations.Local); // если в таблице Combinations не имеется запись метод возвратит false Assert.AreEqual(false, actual, "Ошибка, так как данного действия нет в таблице Combinations"); }
public PageActions(BaseLayer baseLayer) { InitializeComponent(); _baseLayer = baseLayer; BindElements(); ErrorCount.Reset(); }
public PageActions() { InitializeComponent(); _baseLayer = new BaseLayer(); _eventsDependingActionListViewModel = new EventsDependingActionListViewModel(_baseLayer); ErrorCount.Reset(); }
public PageEvents(BaseLayer baseLayer, EventsDependingActionListViewModel eventsDependingActionListViewModel) { InitializeComponent(); _baseLayer = baseLayer; _eventsDependingActionListViewModel = eventsDependingActionListViewModel; BindElements(); }
public void Show(object pageAction, string title, string taskuniq, BaseLayer baseLayer) { if (baseLayer != null) _baseLayer = baseLayer; _baseLayer.Task.TaskUniq = taskuniq; BindElements(); NavigationWindowShower.ShowNavigationWindows(new NavigationWindow(), pageAction, title, _baseLayer, null); }
public PageCombinations(BaseLayer baseLayer) { InitializeComponent(); _baseLayer = baseLayer; LocalTaskLayer.CreateCombinations(_baseLayer); _combinationListViewModel = new CombinationListViewModel(_baseLayer); CombinationListControl.DataContext = _combinationListViewModel; }
public PageCombinations(BaseLayer baseLayer) { InitializeComponent(); _baseLayer = baseLayer; localTaskLayer = new TaskCombinationsView(baseLayer); localTaskLayer.CreateCombinations(); GrdCombinsLst.ItemsSource = localTaskLayer.CombinationWithParamViews; }
public PageSolution(BaseLayer baseLayer, Preferences preferences, Model model) { InitializeComponent(); _baseLayer = baseLayer; _preferences = preferences; _model = model; BindElements(); }
public PageActions(BaseLayer _baseLayer, Preferences _preferences, Model _model) { InitializeComponent(); baseLayer = _baseLayer; preferences = _preferences; model = _model; BindElements(); }
public CombinationWithParamListViewModel(BaseLayer baseLayer) { Combinations = baseLayer.DssDbContext.Combinations.Local; CombinationWithParamViewModels = new ObservableCollection<CombinationWithParamViewModel>(); foreach (var combination in Combinations) { CombinationWithParamViewModels.Add(new CombinationWithParamViewModel(combination.Action, combination.Event, combination.Action.ActionParams.ToList()[0], combination.Event.EventParams.ToList()[0], this)); } }
public PageCombinations(BaseLayer baseLayer, EventsDependingActionListViewModel eventsDependingActionListViewModel) { InitializeComponent(); _baseLayer = baseLayer; _eventsDependingActionListViewModel = eventsDependingActionListViewModel; _localTaskLayer = new LocalTaskLayer(baseLayer, eventsDependingActionListViewModel); _localTaskLayer.CreateCombinations(); GrdCombinsLst.ItemsSource = _localTaskLayer.CombinationWithParamViews; }
public PageEvents(BaseLayer baseLayer, Preferences preferences) { InitializeComponent(); _baseLayer = baseLayer; _preferences = preferences; _model = new Model(_baseLayer, _preferences); BindElements(); ErrorCount.Reset(); }
public PageCombinations(BaseLayer _baseLayer, Preferences _preferences, Model _model) { InitializeComponent(); baseLayer = _baseLayer; preferences = _preferences; model = _model; combinationListViewModel = new CombinationListViewModel(baseLayer); CombinationListControl.DataContext = combinationListViewModel; }
public EventsDependingActionViewModel(BaseLayer baseLayer, EventsDependingActionListViewModel eventsWithActionListViewModel) { var ev = new Event(); this.Name = ev.Name; this.Probability = ev.Probability; Actions = baseLayer.DssDbContext.Actions.Local.ToList(); EventsWithActionListViewModel = eventsWithActionListViewModel; AddEventCommand = new DelegateCommand<object>(this.OnAddEvent, this.CanAddEvent); }
public PageActions(BaseLayer _baseLayer, Preferences _preferences) { InitializeComponent(); baseLayer = _baseLayer; preferences = _preferences; model = new Model(baseLayer, preferences); model.GenerateActions(); BindElements(); }
public PageCombinations(BaseLayer baseLayer, Preferences preferences, Model model) { InitializeComponent(); _baseLayer = baseLayer; _preferences = preferences; _model = model; _combinationListViewModel = new CombinationListViewModel(_baseLayer); CombinationListControl.DataContext = _combinationListViewModel; }
public void Show(object pageOptions, string title, string taskuniq, BaseLayer baseLayer) { if (baseLayer != null) { _baseLayer = baseLayer; } _baseLayer.Task.TaskUniq = taskuniq; NavigationWindowShower.ShowNavigationWindows(new NavigationWindow(), pageOptions, title, _baseLayer, null); }
public void Show(object pageAction, string title, string taskuniq, BaseLayer baseLayer) { if (baseLayer != null) _baseLayer = baseLayer; _baseLayer.Task.TaskUniq = taskuniq; BindElements(); _eventsDependingActionListViewModel.DependingActionListViewModel(_baseLayer); NavigationWindowShower.ShowNavigationWindows(new NavigationWindow(), pageAction, title, _baseLayer, new LocalTaskLayer(_baseLayer, _eventsDependingActionListViewModel)); }
public PageActions(BaseLayer baseLayer, Preferences preferences, Model model) { InitializeComponent(); _baseLayer = baseLayer; _preferences = preferences; _model = model; BindElements(); ErrorCount.Reset(); }
public ActionListViewModel(BaseLayer baseLayer) { Actions = baseLayer.DssDbContext.Actions.Local; _baseLayer = baseLayer; ActionViewModels = new ObservableCollection<ActionViewModel>(); foreach (var act in Actions) { ActionViewModels.Add(new ActionViewModel(act, this)); } }
public PageOptions() { InitializeComponent(); baseLayer = new BaseLayer(); preferences = new Preferences(); preferences.NumberOfThrowings = 3; preferences.HeadBonus = 1m; preferences.TailCost = 1.2m; preferences.DoubleHeadBonus = 0.25m; }
public PageCombinations(BaseLayer baseLayer) { InitializeComponent(); _baseLayer = baseLayer; LocalTaskLayer.taskParams.Task = baseLayer.Task; grid_taskParam.DataContext = LocalTaskLayer.taskParams; LocalTaskLayer.CreateCombinations(_baseLayer); _combinationListViewModel = new CombinationWithParamListViewModel(_baseLayer); CombinationListControl.DataContext = _combinationListViewModel; }
public PageSolve(BaseLayer baseLayer, LocalTaskLayer localTaskLayer, EventsDependingActionListViewModel eventsDependingActionListViewModel) { InitializeComponent(); _baseLayer = baseLayer; _localTaskLayer = localTaskLayer; _eventsDependingActionListViewModel = eventsDependingActionListViewModel; BindElements(); }
public ActionListViewModelForTask9(BaseLayer baseLayer) { _baseLayer = baseLayer; Actions = _baseLayer.DssDbContext.Actions.Local; ActionViewModels = new ObservableCollection<ActionViewModelForTask9>(); foreach (var act in Actions) { // ActionViewModels.Add(new ActionViewModelForTask9(act)); } }
public ActionWithParamListViewModel(BaseLayer baseLayer) { Actions = baseLayer.DssDbContext.Actions.Local; ActionParams = baseLayer.DssDbContext.ActionParams.Local; _baseLayer = baseLayer; ActionWithParamViewModels = new ObservableCollection<ActionWithParamViewModel>(); foreach (var act in Actions) { ActionWithParamViewModels.Add(new ActionWithParamViewModel(act, act.ActionParams.ToList()[0], this)); } }
public void CheckDeletedActions(BaseLayer baseLayer) { var actions = baseLayer.DssDbContext.Actions.Local.ToList(); var deletingActions = new List<EventsDependingAction>(); foreach (var eventsDependingAction in EventsDependingActions) { if (!actions.Contains(eventsDependingAction.Action)) deletingActions.Add(eventsDependingAction); } DeleteEventsDependingAction(deletingActions, baseLayer); }
public void CheckDeletedEvents(BaseLayer baseLayer) { var events = baseLayer.DssDbContext.Events.Local.ToList(); var deletingEvents = (from eventsDependingAction in EventsDependingActions from ev in eventsDependingAction.EventListViewModel.Events where !events.Contains(ev) select ev).ToList(); foreach (var deletingEvent in deletingEvents) { DeleteEvent(deletingEvent); } }
public static void CreateCombinations(BaseLayer baseLayer) { LoadCombinations(baseLayer); var lastCombinationList = CreateLastCombinationList(baseLayer); var actions = baseLayer.DssDbContext.Actions.Local.ToList(); var events = baseLayer.DssDbContext.Events.Local.ToList(); foreach (var act in actions) foreach (var ev in events) if (!HaveAction(act, lastCombinationList) || !HaveEvent(ev, lastCombinationList)) { baseLayer.BaseMethods.AddCombination(new Combination(), act, ev, baseLayer.Task, 0); } }
/* public EventWithParamListViewModel(ObservableCollection<Event> events, BaseLayer baseLayer) { Events = events; EventParams = baseLayer.DssDbContext.EventParams.Local; _baseLayer = baseLayer; ProbabilitySumViewModel = new ProbabilitySumViewModel(); EventWithParamViewModels = new ObservableCollection<EventWithParamViewModel>(); foreach (var ev in Events) { EventWithParamViewModels.Add(new EventWithParamViewModel(ev, ev.EventParams.ToList()[0], this)); } Sum(); }*/ public EventWithParamListViewModel(BaseLayer baseLayer) { Events = baseLayer.DssDbContext.Events.Local; EventParams = baseLayer.DssDbContext.EventParams.Local; _baseLayer = baseLayer; ProbabilitySumViewModel = new ProbabilitySumViewModel(); EventWithParamViewModels = new ObservableCollection<EventWithParamViewModel>(); foreach (var ev in Events) { EventWithParamViewModels.Add(new EventWithParamViewModel(ev, ev.EventParams.ToList()[0], this)); } Sum(); }
/// <summary> /// Helper method to stack layer /// </summary> /// <param name="layer"></param> public void Add(BaseLayer layer) { Layers.Add(layer); }
public IContent ToContent(ILottieDrawable drawable, BaseLayer layer) { return(new GradientFillContent(drawable, layer, this)); }
public PageEvents(BaseLayer baseLayer) { InitializeComponent(); _baseLayer = baseLayer; BindElements(); }
public IContent ToContent(ILottieDrawable drawable, BaseLayer layer) { return(new TrimPathContent(layer, this)); }
/// <summary> /// Updates the specified iteration. /// </summary> /// <param name="iteration">The iteration.</param> /// <param name="layer">The layer.</param> public abstract void Update(int iteration, BaseLayer layer);
public IContent ToContent(Lottie drawable, BaseLayer layer) { return(new StrokeContent(drawable, layer, this)); }
public void Task1CreateCombinationsMethodTest() { // входным параметром для данного метода выступает // объект (экземпляр) класса BaseLayer // см. класс DecisionSupportSystem.Task_1.LocalTaskLayer метод CreateCombinations(BaseLayer baseLayer) // далее выполняется заполнение этого объекта (baseLayer) необходимыми для теста данными var baseLayer = new BaseLayer(); baseLayer.Task = new Task(); baseLayer.DssDbContext.Actions.Local.Add(new Action { Name = "A1" }); baseLayer.DssDbContext.Actions.Local.Add(new Action { Name = "A2" }); baseLayer.DssDbContext.Events.Local.Add(new Event { Name = "E1" }); baseLayer.DssDbContext.Events.Local.Add(new Event { Name = "E2" }); // заполнение здесь заканчивается страшного ничего нет :))) // baseLayer имеет ссылку (DssDbContext) на нашу модель БД (DbModel) // используя эту ссылку мы добавили по две записи в таблицы Actions и Events // далее создаем список комбинаций действие событие, которые мы ожидаем получить var expected = new List <CombinationTest>(); expected.Add(new CombinationTest { ActionName = "A1", EventName = "E1" }); expected.Add(new CombinationTest { ActionName = "A1", EventName = "E2" }); expected.Add(new CombinationTest { ActionName = "A2", EventName = "E1" }); expected.Add(new CombinationTest { ActionName = "A2", EventName = "E2" }); // ключевой момент вызов нашей тестируемой функции LocalTaskLayer.CreateCombinations(baseLayer); // все наша функция отработала // получаем комбинации используя ту же ссылку на нашу модель БД // список actual будет содержать список сгенерированных комбинации действие событие var actual = baseLayer.DssDbContext.Combinations.Local.ToList(); // ПРОВЕРКА количества созданных комбинаций Assert.AreEqual(4, actual.Count); // ПРОВЕРКА правильности созданных комбинаций if (actual.Count == 4) { for (int i = 0; i < 4; i++) { Assert.AreEqual(expected[i].ActionName, actual[i].Action.Name); Assert.AreEqual(expected[i].EventName, actual[i].Event.Name); } } }
public IContent ToContent(LottieDrawable drawable, BaseLayer layer) { return(new EllipseContent(drawable, layer, this)); }
protected List <Combination> GetLastCombinations(BaseLayer baseLayer) { return(baseLayer.DssDbContext.Combinations.Local.ToList()); }
public virtual void SaveBtnClick_OnPageSolve(object sender, RoutedEventArgs e) { BaseLayer.Save(); IsSaved = true; }
/// <summary> /// You can also simply add layers via the .Add() method /// </summary> /// <param name="layer">The layer.</param> public void Add(BaseLayer layer) { __self__.add(layer: layer.ToPython()); }
public IContent ToContent(LottieDrawable drawable, BaseLayer layer) { return(new ContentGroup(drawable, layer, this)); }
/// <summary> /// You can also simply add layers via the .Add() method /// </summary> /// <param name="layer">The layer.</param> public void Add(BaseLayer layer) { PyInstance.add(layer: layer.PyInstance); }
public IContent ToContent(ILottieDrawable drawable, BaseLayer layer) { return(new RectangleContent(drawable, layer, this)); }
public void ProcessAndSendToNext(T data, BaseLayer <T> nLayer, string method) { }
private static Canvas RenderVectorLayer(IViewport viewport, ILayer layer, bool rasterizing = false) { // todo: // find solution for try catch. Sometimes this method will throw an exception // when clearing and adding features to a layer while rendering var canvas = new Canvas { Opacity = layer.Opacity, IsHitTestVisible = false }; try { var features = layer.GetFeaturesInView(viewport.Extent, viewport.RenderResolution).ToList(); var layerStyles = BaseLayer.GetLayerStyles(layer); var brushCache = new BrushCache(); foreach (var layerStyle in layerStyles) { var style = layerStyle; // This is the default that could be overridden by an IThemeStyle foreach (var feature in features) { if (layerStyle is IThemeStyle) { style = (layerStyle as IThemeStyle).GetStyle(feature); } if ((style == null) || (style.Enabled == false) || (style.MinVisible > viewport.Resolution) || (style.MaxVisible < viewport.Resolution)) { continue; } RenderFeature(viewport, canvas, feature, style, rasterizing, brushCache); } } foreach (var feature in features) { var styles = feature.Styles ?? Enumerable.Empty <IStyle>(); foreach (var style in styles) { if ((feature.Styles != null) && style.Enabled) { RenderFeature(viewport, canvas, feature, style, rasterizing, brushCache); } } } return(canvas); } catch (Exception ex) { Logger.LogDelegate(LogLevel.Error, "Unexpected error in renderer", ex); return(canvas); // If exception happens inside RenderFeature function after // at -least one child has been added to the canvas, // returning new canvas will leave the previously created (but // not yet added to parent canvas) canvas abandoned, that will // cause the exception when resuing RenderedGeometry object, because // at -least one RenderedGeometry was attached to that abandoned canvas. // returning the same canvas will solve this error, as it will // be clear this canvas childs on next render call. // return new Canvas { IsHitTestVisible = false }; } }