static public void RegisterDownload(String itemKey) { DatasetInfoDataSource datasetInfoDataSource = new DatasetInfoDataSource(); ViewDataSource viewDS = new ViewDataSource(); datasetInfoDataSource.RegisterDownload(itemKey); }
public override void ViewDidLoad() { base.ViewDidLoad(); NavigationItem.LeftBarButtonItem = EditButtonItem; TableView.RowHeight = 90; NavigationItem.Title = "Pull to Toggle Cell Type"; // Setup refresh control for example app UIRefreshControl refreshControl = new UIRefreshControl(); refreshControl.ValueChanged += (sender, args) => { refreshControl.BeginRefreshing(); dataSource.UseCustomCells = !dataSource.UseCustomCells; if (dataSource.UseCustomCells) { RefreshControl.TintColor = UIColor.Yellow; } else { RefreshControl.TintColor = UIColor.Blue; } TableView.ReloadData(); refreshControl.EndRefreshing(); }; refreshControl.TintColor = UIColor.Blue; TableView.AddSubview(refreshControl); RefreshControl = refreshControl; dataSource = new ViewDataSource(TableView); dataSource.UseCustomCells = false; TableView.DataSource = dataSource; }
static public void RegisterView(String itemKey, String url, String user) { DatasetInfoDataSource datasetInfoDataSource = new DatasetInfoDataSource(); ViewDataSource viewDS = new ViewDataSource(); datasetInfoDataSource.IncrementView(itemKey); }
private void AddField() { if (trvDataSources.SelectedNode == null) { return; } if (!(trvDataSources.SelectedNode.Tag is DataFormatMapItem)) { return; } var member = ((DataFormatMapItem)trvDataSources.SelectedNode.Tag).DataMember; TreeNode root = trvDataSources.Nodes[0]; ViewDataSource data = (ViewDataSource)root.Tag; member.DataFeed = data.Name; member.Path = trvDataSources.SelectedNode.FullPath.Replace($"{trvDataSources.Nodes[0].FullPath}\\", ""); member.Path = member.Path.Replace(member.Caption, member.Name); if (!CreateViewContext.ViewDataMembers.Contains(member)) { CreateViewContext.ViewDataMembers.Add(member); } }
void SetupDataSource() { _SelectedIndex = Math.Min(_SelectedIndex, lists[selectedList].Count - 1); viewDelegate = new ViewDelegate(this); viewDataSource = new ViewDataSource(this); }
public CreateViewContext() { _viewDataMembers = new BindingList <ViewDataMember>(); _viewDataSource = new ViewDataSource(); _viewListColumns = new BindingList <ViewListColumn>(); PropertyChanged += CreateViewContext_PropertyChanged; }
public AppAndDataHelpers(SxcInstance sexy, ModuleInfo module, Log parentLog) : base("Sxc.AppHlp", parentLog ?? sexy?.Log) { // ModuleInfo module = sexy.ModuleInfo; // Init things than require module-info or similar, but not 2sxc Dnn = new DnnHelper(module); Link = new DnnLinkHelper(Dnn); // todo: maybe init App & App.Data, as they don't really require a working 2sxc if (sexy == null) { return; } ViewDataSource data = sexy.Data; _sxcInstance = sexy; App = sexy.App; // app; Data = sexy.Data; // data; Sxc = new SxcHelper(sexy); Edit = new InPageEditingHelper(sexy); // If PortalSettings is null - for example, while search index runs - HasEditPermission would fail // But in search mode, it shouldn't show drafts, so this is ok. // Note that app could be null, if a user is in admin-ui of a module which hasn't actually be configured yet App?.InitData(PortalSettings.Current != null && sexy.Environment.Permissions.UserMayEditContent, sexy.Environment.PagePublishing /*new Environment.Dnn7.PagePublishing(Log)*/.IsEnabled(module.ModuleID), data.ConfigurationProvider); #region Assemble the mapping of the data-stream "default"/Presentation to the List object and the "ListContent" too List = new List <Element>(); if (data != null && sexy.Template != null) { if (data.Out.ContainsKey("Default")) { var entities = data.List.Select(e => e.Value); var elements = entities.Select(GetElementFromEntity).ToList(); List = elements; if (elements.Any()) { Content = elements.First().Content; //Presentation = elements.First().Presentation; } } if (data.Out.ContainsKey(AppConstants.ListContent)) { var listEntity = data[AppConstants.ListContent].List.Select(e => e.Value).FirstOrDefault(); var listElement = listEntity != null?GetElementFromEntity(listEntity) : null; if (listElement != null) { ListContent = listElement.Content; // ListPresentation = listElement.Presentation; } } } #endregion }
private void SetupTable() { _DataSource = new ViewDataSource(this); _Delegate = new ViewDelegate(this); DieTableView.DataSource = _DataSource; DieTableView.Delegate = _Delegate; DieTableView.ReloadData(); }
protected virtual void DisplayDataSource(ViewDataSource dataSource) { trvDataSources.Nodes.Clear(); var dataSourceNode = new TreeNode(dataSource.Caption) { Tag = dataSource }; BuildDataSourceTreeView(dataSourceNode, dataSource, ""); int baseIdx = 10; int imageIndex = 0; switch (dataSource.Name) { case "LiveFeedData": { imageIndex = baseIdx + 1; break; } case "LivePitData[]": { imageIndex = baseIdx + 2; break; } case "LiveFlagData[]": { imageIndex = baseIdx + 3; break; } case "LivePointsData[]": { imageIndex = baseIdx + 4; break; } case "LiveQualifyingData[]": { imageIndex = baseIdx + 5; break; } } dataSourceNode.ImageIndex = imageIndex; dataSourceNode.SelectedImageIndex = imageIndex; trvDataSources.Nodes.Add(dataSourceNode); trvDataSources.ExpandAll(); trvDataSources.SelectedNode = dataSourceNode; }
private IEnumerable <IEntity> TryToAddStream(IEnumerable <IEntity> list, ViewDataSource data, string key) { var cont = data.Out.ContainsKey(key) ? data[key]?.List?.ToList() : null; Log.Add($"TryToAddStream(..., ..., key:{key}), found:{cont != null} add⋮{cont?.Count ?? 0}"); if (cont != null) { list = list.Concat(cont); } return(list); }
public IEnumerable <View> GetViews(DateTime datefrom, DateTime todate) { ViewDataSource viewDS = new ViewDataSource(); var views = (from v in viewDS.SelectAll() where v.Date >= datefrom && v.Date <= todate select v).AsEnumerable(); var l = from v in views select CreateView(v); return(l); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (CalendarControl == null) { return; } CalendarControl.DayRender += CalendarControl_DayRender; CalendarControl.SelectionChanged += CalendarControl_SelectionChanged; _contentList = ViewDataSource.Select(DataSourceSelectArguments.Empty) ?? new List <Content>(); }
public OpenDialog(bool openMode) : base("OpenDialog", null) { _OpenMode = openMode; files = new List <string>(); foreach (String ext in _OpenExtensions) { files.AddRange(Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ext, SearchOption.TopDirectoryOnly)); } viewDelegate = new ViewDelegate(this); viewDataSource = new ViewDataSource(this); }
public AppAndDataHelpers(SxcInstance sexy) { ModuleInfo module = sexy.ModuleInfo; ViewDataSource data = sexy.Data; _sxcInstance = sexy; App = sexy.App; // app; Data = sexy.Data; // data; Dnn = new DnnHelper(module); Link = new DnnLinkHelper(Dnn); Sxc = new SxcHelper(sexy); Edit = new InPageEditingHelper(sexy); // If PortalSettings is null - for example, while search index runs - HasEditPermission would fail // But in search mode, it shouldn't show drafts, so this is ok. App.InitData(PortalSettings.Current != null && sexy.Environment.Permissions.UserMayEditContent /*SecurityHelpers.HasEditPermission(module)*/, data.ConfigurationProvider); #region Assemble the mapping of the data-stream "default"/Presentation to the List object and the "ListContent" too List = new List <Element>(); if (data != null && sexy.Template != null) { if (data.Out.ContainsKey("Default")) { var entities = data.List.Select(e => e.Value); var elements = entities.Select(GetElementFromEntity).ToList(); List = elements; if (elements.Any()) { Content = elements.First().Content; Presentation = elements.First().Presentation; } } if (data.Out.ContainsKey("ListContent")) { var listEntity = data["ListContent"].List.Select(e => e.Value).FirstOrDefault(); var listElement = listEntity != null?GetElementFromEntity(listEntity) : null; if (listElement != null) { ListContent = listElement.Content; ListPresentation = listElement.Presentation; } } } #endregion }
protected virtual void BuildDataSourceTreeView(TreeNode dataSourceNode, ViewDataSource dataSource, string path) { foreach (ViewDataMember field in dataSource.Fields) { var fieldNode = new TreeNode(field.Caption); field.DataFeed = dataSource.Name; field.Path = $"{path}{field.Name}"; var mapItem = new DataFormatMapItem() { DataMember = field, }; fieldNode.Tag = mapItem; dataSourceNode.Nodes.Add(fieldNode); } foreach (ViewDataSource dataList in dataSource.Lists) { var dataListPath = $"{path}{dataList.Caption}[]\\"; var listNode = new TreeNode(dataList.Caption + "[]") { Tag = dataList }; BuildDataSourceTreeView(listNode, dataList, dataListPath); dataSourceNode.Nodes.Add(listNode); } foreach (ViewDataSource dataList in dataSource.NestedClasses) { var dataListPath = $"{path}{dataList.Caption}\\"; var listNode = new TreeNode(dataList.Caption) { Tag = dataList }; BuildDataSourceTreeView(listNode, dataList, dataListPath); dataSourceNode.Nodes.Add(listNode); } }
protected virtual ViewDataSource GetNestedDataSource(PropertyInfo sourcePropertyInfo, string dataFeedName, Type dataFeedType, string path, string parentMember) { ViewDataSource source = new ViewDataSource() { Name = sourcePropertyInfo.Name, DataFeed = dataFeedName, DataFeedType = dataFeedType, Path = $"{path}{parentMember}", Type = sourcePropertyInfo.PropertyType.IsGenericType ? sourcePropertyInfo.PropertyType.GenericTypeArguments[0] : sourcePropertyInfo.PropertyType }; var memberPath = $"{source.Path}\\"; foreach (PropertyInfo propertyInfo in source.Type.GetProperties()) { if (propertyInfo.PropertyType.Name.Contains("List")) { var innerSource = GetNestedDataSource(propertyInfo, dataFeedName, dataFeedType, $"{memberPath}", $"{propertyInfo.Name}[]"); source.Lists.Add(innerSource); } else if (propertyInfo.PropertyType.Name.StartsWith("System")) { var innerSource = GetNestedDataSource(propertyInfo, dataFeedName, dataFeedType, $"{memberPath}", $"{propertyInfo.Name}"); source.NestedClasses.Add(innerSource); } else { source.Fields.Add(new ViewDataMember() { Name = propertyInfo.Name, Path = $"{memberPath}{propertyInfo.Name}", Type = propertyInfo.PropertyType, DataFeed = dataFeedName, DataFeedType = source.DataFeedType }); } } return(source); }
// Top-level data feed protected virtual ViewDataSource GetFeedDataSource(Type dataFeedType) { var path = ""; var dataFeedName = dataFeedType.IsGenericType ? $"{ dataFeedType.GenericTypeArguments[0].Name}[]" : dataFeedType.Name; ViewDataSource source = new ViewDataSource() { Name = dataFeedName, DataFeed = dataFeedName, DataFeedType = dataFeedType, Type = dataFeedType.IsGenericType ? dataFeedType.GenericTypeArguments[0] : dataFeedType }; foreach (PropertyInfo propertyInfo in source.Type.GetProperties()) { if (propertyInfo.PropertyType.Name.Contains("List")) { var innerSource = GetNestedDataSource(propertyInfo, dataFeedName, dataFeedType, $"{path}", $"{propertyInfo.Name}[]"); source.Lists.Add(innerSource); } else if (propertyInfo.PropertyType.Name.StartsWith("System")) { var innerSource = GetNestedDataSource(propertyInfo, dataFeedName, dataFeedType, $"{path}", propertyInfo.Name); source.NestedClasses.Add(innerSource); } else { source.Fields.Add(new ViewDataMember() { Name = propertyInfo.Name, Path = $"{path}{propertyInfo.Name}", Type = propertyInfo.PropertyType, DataFeed = dataFeedName, DataFeedType = source.DataFeedType }); } } return(source); }
static public void RegisterView(String itemKey, String url, String user) { DatasetInfoDataSource datasetInfoDataSource = new DatasetInfoDataSource(); ViewDataSource viewDS = new ViewDataSource(); datasetInfoDataSource.IncrementView(itemKey); // No logging if analytics are disabled if (OgdiConfiguration.GetValue("IsAnalytics") == "0") { return; } viewDS.AddView(new ViewEntry() { Date = DateTime.Now, ItemKey = itemKey, User = user, RequestedUrl = url, }); }
public AppAndDataHelpers(SexyContent sexy, ModuleInfo module, ViewDataSource data, App app) { _sexy = sexy; App = app; Data = data; Dnn = new DnnHelper(module); List = new List <Element>(); if (data != null) { if (data.Out.ContainsKey("Default")) { var entities = data.List.Select(e => e.Value); var elements = entities.Select(GetElementFromEntity).ToList(); List = elements; if (elements.Any()) { Content = elements.First().Content; Presentation = elements.First().Presentation; } } if (data.Out.ContainsKey("ListContent")) { var listEntity = data["ListContent"].List.Select(e => e.Value).FirstOrDefault(); var listElement = listEntity != null?GetElementFromEntity(listEntity) : null; if (listElement != null) { ListContent = listElement.Content; ListPresentation = listElement.Presentation; } } } // If PortalSettings is null - for example, while search index runs - HasEditPermission would fail // But in search mode, it shouldn't show drafts, so this is ok. App.InitData(PortalSettings.Current != null && SexyContent.HasEditPermission(module)); }
private void BuildDataSourceTreeView(TreeNode dataSourceNode, ViewDataSource dataSource) { foreach (ViewDataMember field in dataSource.Fields) { var fieldNode = new TreeNode(field.Name) { Tag = field }; dataSourceNode.Nodes.Add(fieldNode); } foreach (ViewDataSource dataList in dataSource.Lists) { var listNode = new TreeNode(dataList.Name + "[]") { Tag = dataList }; BuildDataSourceTreeView(listNode, dataList); dataSourceNode.Nodes.Add(listNode); } foreach (ViewDataSource dataList in dataSource.NestedClasses) { var listNode = new TreeNode(dataList.Name) { Tag = dataList }; BuildDataSourceTreeView(listNode, dataList); dataSourceNode.Nodes.Add(listNode); } }
protected virtual void BuildDataSourceTreeView(TreeNode dataSourceNode, ViewDataSource dataSource) { bool mapAdded = false; foreach (ViewDataMember viewDataMember in dataSource.Fields) { var dataFormatMapItem = new DataFormatMapItem() { DataMember = viewDataMember }; var fieldNode = new TreeNode(viewDataMember.Caption); if (!MapService.Map.ContainsKey(viewDataMember) || MapService.Map[viewDataMember].Name == "Default") { var displayFormat = MapService.DisplayFormats.FirstOrDefault(f => f.Name == viewDataMember.Name); if (displayFormat != null) { MapService.Map[viewDataMember] = displayFormat; } else { var newViewDisplayFormat = new ViewDisplayFormat() { Name = viewDataMember.Name }; if (viewDataMember.Type.Name.ToString() == "String") { newViewDisplayFormat.Sample = "Abcdefg Hijklmnop"; } else if (viewDataMember.Type.Name.ToString() == "Int32") { newViewDisplayFormat.Sample = "12345"; newViewDisplayFormat.Format = "###"; } else if (viewDataMember.Type.Name.ToString() == "Decimal" || viewDataMember.Type.Name.ToString() == "Double") { newViewDisplayFormat.Sample = "123.456"; newViewDisplayFormat.Format = "###.##0"; } else if (viewDataMember.Type.Name.ToString() == "TimeSpan") { newViewDisplayFormat.Sample = "12:34:56.78"; newViewDisplayFormat.Format = "hh\\:mm\\:ss.fff"; } else if (viewDataMember.Type.Name.ToString() == "Boolean") { newViewDisplayFormat.Sample = "True"; } else if (viewDataMember.Type.Name.ToString() == "Boolean") { newViewDisplayFormat.Sample = "True"; } else if (viewDataMember.Type.Name.ToString() == "TrackState") { newViewDisplayFormat.Sample = "Caution"; } else if (viewDataMember.Type.Name.ToString() == "SeriesType") { newViewDisplayFormat.Sample = "XFinity"; } else if (viewDataMember.Type.Name.ToString() == "RunType") { newViewDisplayFormat.Sample = "Practice"; } else if (viewDataMember.Type.Name.ToString() == "VehicleStatus") { newViewDisplayFormat.Sample = "OnTrack"; } else { Console.WriteLine($"Unrecognized field type: {viewDataMember.Type.Name.ToString()}, field: {viewDataMember.Name}"); } MapService.AddNewFormatToMap(viewDataMember, newViewDisplayFormat); mapAdded = true; } } var viewDisplayFormat = MapService.Map[viewDataMember]; dataFormatMapItem.DisplayFormat = viewDisplayFormat; fieldNode.Tag = dataFormatMapItem; UpdateNodeState(fieldNode, viewDisplayFormat); dataSourceNode.Nodes.Add(fieldNode); } if (mapAdded) { MapService.Save(); } foreach (ViewDataSource dataList in dataSource.Lists) { var listNode = new TreeNode(dataList.Caption + "[]") { Tag = dataList, ImageIndex = ClosedFolderImageIndex, SelectedImageIndex = ClosedFolderImageIndex, }; BuildDataSourceTreeView(listNode, dataList); dataSourceNode.Nodes.Add(listNode); } foreach (ViewDataSource dataList in dataSource.NestedClasses) { var listNode = new TreeNode(dataList.Caption) { Tag = dataList, ImageIndex = ClosedFolderImageIndex, SelectedImageIndex = ClosedFolderImageIndex, }; BuildDataSourceTreeView(listNode, dataList); dataSourceNode.Nodes.Add(listNode); } }
public CharacterListView(CombatState state, bool monsters) { listView = new UITableView(); listView.SeparatorStyle = UITableViewCellSeparatorStyle.None; listView.SeparatorColor = CMUIColors.PrimaryColorMedium; listView.BackgroundColor = UIExtensions.ARGBColor(0x0); BackgroundColor = CMUIColors.PrimaryColorDarker; AddSubview(listView); viewDelegate = new ViewDelegate(this); viewDataSource = new ViewDataSource(this); listView.Delegate = viewDelegate; listView.DataSource = viewDataSource; _combatState = state; _monsters = monsters; _combatState.Characters.CollectionChanged += Handle_combatStateCombatListCollectionChanged; _combatState.CharacterSortCompleted += Handle_combatStateCharacterSortCompleted; _combatState.PropertyChanged += Handle_combatStatePropertyChanged; blankButton = new GradientButton(); StyleButton(blankButton); blankButton.SetTitle("", UIControlState.Normal); blankButton.SetImage(UIExtensions.GetSmallIcon("invisible"), UIControlState.Normal); blankButton.TouchUpInside += HandleBlankButtonTouchUpInside; AddSubview(blankButton); monsterButton = new GradientButton(); StyleButton(monsterButton); monsterButton.SetTitle("", UIControlState.Normal); monsterButton.SetImage(UIExtensions.GetSmallIcon("monster"), UIControlState.Normal); monsterButton.TouchUpInside += HandleMonsterButtonTouchUpInside; AddSubview(monsterButton); openButton = new GradientButton(); StyleButton(openButton); openButton.SetText(""); openButton.SetImage(UIExtensions.GetSmallIcon("openhs"), UIControlState.Normal); openButton.TouchUpInside += HandleOpenButtonTouchUpInside; AddSubview(openButton); saveButton = new GradientButton(); StyleButton(saveButton); saveButton.SetText(""); saveButton.SetImage(UIExtensions.GetSmallIcon("savehs"), UIControlState.Normal); saveButton.TouchUpInside += HandleSaveButtonTouchUpInside; AddSubview(saveButton); bottomView = new GradientView(); AddSubview(bottomView); bottomLabel = new UILabel(); bottomView.AddSubview(bottomLabel); bottomView.CornerRadius = 0f; bottomView.Gradient = new GradientHelper( CMUIColors.PrimaryColorLight, CMUIColors.PrimaryColorLight); clearButton = new GradientButton(); StyleButton(clearButton); clearButton.SetText(""); clearButton.SetImage(UIExtensions.GetSmallIcon("delete"), UIControlState.Normal); clearButton.TouchUpInside += HandleClearButtonTouchUpInside; AddSubview(clearButton); _monsterAddView = new MonsterAddView(); _monsterAddView.IsMonsters = monsters; _monsterAddView.ShouldClose += Handle_monsterAddViewShouldClose; _controller = new UIPopoverController(_monsterAddView); _monsterAddView.CombatState = _combatState; SetBottomText(); }
private System.Text.StringBuilder PrintViewDataSource(System.Text.StringBuilder sb, ViewDataSource source, int level) { var indent = new String(' ', level * indentMultiplier); sb.AppendFormat("{0}-{1, -23}{2, -40}{3, -40}{4, -74}\r\n", indent, source.Name, source.Path, source.DataFeed, source.Type.Name); sb.AppendLine(); //sb.AppendLine($"{indent}source.Name: {source.Name}"); //sb.AppendLine($"{indent}> {source.Name}: {source.Path}"); //sb.AppendLine($"{indent}source.TypeName: {source.TypeName}"); //sb.AppendLine($"{indent}source.Type: {source.Type.ToString()}"); indent = new String(' ', (level + 1) * indentMultiplier); if (source.Fields.Count > 0) { sb.AppendLine($"{indent}[ Properties ]"); sb = PrintHeader(sb, level + 1); sb = PrintViewDataMembers(sb, source.Fields, level + 1); } if (source.Lists.Count > 0) { sb.AppendLine($"{indent}[ Lists ]"); sb = PrintViewDataSources(sb, source.Lists, level + 1); } if (source.NestedClasses.Count > 0) { sb.AppendLine($"{indent}[ Classes ]"); sb = PrintViewDataSources(sb, source.NestedClasses, level + 1); } return(sb); }