protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); try { if (PublicParmValues.Any()) { this.ContentType = (SummaryContentType)Enum.Parse(typeof(SummaryContentType), GetParmValue("ContentType", "Blog"), true); SelectedCategories = new List <Guid>(); List <string> lstCategories = GetParmValueList("SelectedCategories"); foreach (string sCat in lstCategories) { if (!String.IsNullOrEmpty(sCat)) { SelectedCategories.Add(new Guid(sCat)); } } } if (SelectedCategories.Any()) { this.ContentType = SummaryContentType.SpecifiedCategories; } } catch (Exception ex) { } }
private void MultiSelectTreeView_OnSelectionChanged(object sender, EventArgs e) { if (DialogResult == true) { return; } var array = new CategoryVM[MultiSelectTreeView.SelectedItems.Count]; MultiSelectTreeView.SelectedItems.CopyTo(array, 0); SelectedCategories = array.ToList(); OK.IsEnabled = SelectedCategories.Any(); }
protected override void InitializePreviews() { Panel.RemoveChildren(); if (!SelectedCategories.Any()) { return; } foreach (var t in allTemplates) { if (!SelectedCategories.Overlaps(t.Categories)) { continue; } if (!string.IsNullOrEmpty(searchFilter) && !t.SearchTerms.Any(s => s.IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) >= 0)) { continue; } var tileId = t.Template.Id; var item = ScrollItemWidget.Setup(ItemTemplate, () => { var brush = Editor.CurrentBrush as EditorTileBrush; return(brush != null && brush.Template == tileId); }, () => Editor.SetBrush(new EditorTileBrush(Editor, tileId, WorldRenderer))); var preview = item.Get <TerrainTemplatePreviewWidget>("TILE_PREVIEW"); var template = tileset.Templates[tileId]; var grid = WorldRenderer.World.Map.Grid; var bounds = WorldRenderer.Theater.TemplateBounds(template, grid.TileSize, grid.Type); // Scale templates to fit within the panel var scale = 1f; while (scale * bounds.Width > ItemTemplate.Bounds.Width) { scale /= 2; } preview.Template = template; preview.GetScale = () => scale; preview.Bounds.Width = (int)(scale * bounds.Width); preview.Bounds.Height = (int)(scale * bounds.Height); item.Bounds.Width = preview.Bounds.Width + 2 * preview.Bounds.X; item.Bounds.Height = preview.Bounds.Height + 2 * preview.Bounds.Y; item.IsVisible = () => true; item.GetTooltipText = () => t.Tooltip; Panel.AddChild(item); } }
public void ExecuteSearch() { var crit = new EventLogQueryCriteria() { ProvidersName = string.IsNullOrWhiteSpace(ProviderName) ? new List <string>() : ProviderName.Split(';').ToList(), DateFrom = DateFrom, DateTo = DateTo, EventLogEntryTypeList = SelectedEntryTypeList, DescriptionContains = string.IsNullOrWhiteSpace(Contains) ? new List <string>() : Contains.Split(';').ToList() }; List <string> serversList = new List <string>(); if (SelectedCategories != null && SelectedCategories.Any()) { serversList.AddRange(SelectedCategories.SelectMany(x => x.ServerList).Select(x => x.Name)); } if (!string.IsNullOrEmpty(ManualServers)) { serversList.AddRange(ManageManualServerList(ManualServers)); } if (serversList.Any()) { var logs = _eventLogReaderManager.ReadLogs(serversList, crit); if (logs != null && logs.Any()) { EventResultList = new ObservableCollection <Event>(logs.Select(x => new Event(x)).ToList()); } else { EventResultList = new ObservableCollection <Event>(); MessageBox.Show("No events found with the current criteria"); } RaisePropertyChanged("EventResultList"); } else { MessageBox.Show("No servers has been selected!"); } }
protected override void InitializePreviews() { Panel.RemoveChildren(); if (!SelectedCategories.Any()) { return; } foreach (var a in allActors) { if (!SelectedCategories.Overlaps(a.Categories)) { continue; } if (!string.IsNullOrEmpty(searchFilter) && !a.SearchTerms.Any(s => s.IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) >= 0)) { continue; } var actor = a.Actor; var td = new TypeDictionary(); td.Add(new OwnerInit(selectedOwner.Name)); td.Add(new FactionInit(selectedOwner.Faction)); foreach (var api in actor.TraitInfos <IActorPreviewInitInfo>()) { foreach (var o in api.ActorPreviewInits(actor, ActorPreviewType.MapEditorSidebar)) { td.Add(o); } } try { var item = ScrollItemWidget.Setup(ItemTemplate, () => editorCursor.Type == EditorCursorType.Actor && editorCursor.Actor.Info == actor, () => Editor.SetBrush(new EditorActorBrush(Editor, actor, selectedOwner, WorldRenderer))); var preview = item.Get <ActorPreviewWidget>("ACTOR_PREVIEW"); preview.SetPreview(actor, td); // Scale templates to fit within the panel var scale = 1f; if (scale * preview.IdealPreviewSize.X > ItemTemplate.Bounds.Width) { scale = (ItemTemplate.Bounds.Width - Panel.ItemSpacing) / (float)preview.IdealPreviewSize.X; } preview.GetScale = () => scale; preview.Bounds.Width = (int)(scale * preview.IdealPreviewSize.X); preview.Bounds.Height = (int)(scale * preview.IdealPreviewSize.Y); item.Bounds.Width = preview.Bounds.Width + 2 * preview.Bounds.X; item.Bounds.Height = preview.Bounds.Height + 2 * preview.Bounds.Y; item.IsVisible = () => true; item.GetTooltipText = () => a.Tooltip; Panel.AddChild(item); } catch { Log.Write("debug", "Map editor ignoring actor {0}, because of missing sprites for tileset {1}.", actor.Name, World.Map.Rules.TerrainInfo.Id); continue; } } }