private void OnHamburgerMenuItemClicked(object obj) { var glyphItem = obj as HamburgerMenuGlyphItem; if (glyphItem == null) { return; } switch (glyphItem.Label) { case "Qualifier Group Maintainence": //Check if already exists or not if (ActionItems.Any(tabItem => string.Compare("mnuQualGroup", tabItem.Name, StringComparison.OrdinalIgnoreCase) == 0)) { return; } ActionItems.Add(new MetroTabItem() { Name = "mnuQualGroup", Header = "Qualifier Group Maintenance", CloseButtonEnabled = true, IsSelected = true, Content = new QualifierGroupUc() }); break; default: break; } }
public RetirementsView(RetirementsViewModel viewModel) : base(viewModel) { InitializeComponent(); ActionItems.Add(new CommandItem("Сохранить", PackIconKind.Download, viewModel.SaveAsCommand)); }
public void AddActionItem(string name) { var res = Database.Instance.ActionItems.Where(x => x.Name == name).FirstOrDefault(); if (res != null) { ActionItems.Add(res.Id); } }
public PriplodsView(PriplodsViewModel viewModel) : base(viewModel) { InitializeComponent(); ActionItems.Add(new ActionItem("Фильтр", PackIconKind.Filter, PackIconKind.FilterOutline, new RelayCommand(sender => { if (sender is ActionItem item) { UpdateContent(item, new PriplodsFilterView() { DataContext = ViewModel }); } }))); ActionItems.Add(new CommandItem("Сохранить", PackIconKind.Download, viewModel.SaveAsCommand)); }
public void UpdateInventoryCategories() { Weapons.Clear(); ActionItems.Clear(); foreach (var gameItemQuantity in _Inventory) { if (gameItemQuantity.GameItem is Weapon) { Weapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is ActionItem) { ActionItems.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Currency) { Booty.Add(gameItemQuantity); } } }
private void AddItemControl(ActionItemModel action, IActionBuilder builder = null) { isRendering = true; double Y = 0; if (ActionItems.Count > 0) { var lastItem = ActionItems.Last(); var lastItemTTF = lastItem.RenderTransform as TranslateTransform; Y = lastItemTTF.Y + lastItem.ActualHeight; } var item = new ActionItem(); item.ActionContainer = this; item.DataContext = this; item.VMDataContext = this.DataContext; BindingOperations.SetBinding(item, ActionItem.ContainerStateProperty, new Binding() { Source = this, Path = new PropertyPath(nameof(State)), Mode = BindingMode.Default, }); BindingOperations.SetBinding(item, ActionItem.RuningIDProperty, new Binding() { Source = DataContext, Path = new PropertyPath("RuningActionID"), Mode = BindingMode.Default, }); BindingOperations.SetBinding(item, ActionItem.RuningStateProperty, new Binding() { Source = DataContext, Path = new PropertyPath("RuningActionState"), Mode = BindingMode.Default, }); item.ID = action.ID; //item.InputDataModel = inputdata == null ? ActionData.GetCreateDefaultInputData(action.ActionType) : inputdata; item.Builder = builder == null?ActionBuilder.BuilderByActionItem(action) : builder; item.Action = action; item.VerticalAlignment = VerticalAlignment.Top; var ttf = item.RenderTransform as TranslateTransform; ttf.Y = Y; item.Y = Y; item.MouseLeftButtonDown += Item_MouseLeftButtonDown; item.MouseLeftButtonUp += Item_MouseLeftButtonUp; item.MouseMove += Item_MouseMove; ttf.Changed += (e, c) => { item.Y = ttf.Y; }; item.OnRenderDone += (e, c) => { if (item.Tag != null) { //如果tag不为null表示已加载完成了 return; } item.Tag = string.Empty; if (ActionItems.Count == 1) { //仅存在一个时使用auto height ActionPanel.Height = Double.NaN; } else { ActionPanel.Height = ActionPanel.ActualHeight + item.ActualHeight; } //ActionPanel.Height += item.ActualHeight; //if (double.IsNaN(ActionPanel.Height)) //{ // ActionPanel.Height = item.ActualHeight; //} UpdateActionHeight(item); ActionTempPanel.Children.Remove(item); ActionPanel.Children.Add(item); //继续队列 appendActionItemTempList.RemoveAt(0); appendBuilderTempList.RemoveAt(0); isRendering = false; if (appendActionItemTempList.Count > 0) { AddItem(appendActionItemTempList[0], appendBuilderTempList[0]); } else { ResetAllActionsMarigin(); } //继续监控item高度变化 item.LayoutUpdated += (e, v) => { UpdateActionHeight(item); }; }; //ActionPanel.Children.Add(item); //添加到临时容器中 ActionTempPanel.Children.Add(item); ActionItems.Add(item); SortAction(); }
public void Append(Layout layout) { ViewModels.Add(layout.ViewModels); ActionItems.Add(layout.ActionItems); Contracts.Add(layout.Contracts); }