public IOption Create(IContentContainer parent, string optionType) { IOption option; switch (optionType) { case "header": option = new HeaderOption(parent); break; case "toggle": option = new ToggleOption(parent); break; case "slider": option = new SliderOption(parent); break; case "empty": option = new EmptyOption(parent); break; case "menu": option = new MenuOption(parent); break; case "color": option = new ColorOption(parent); break; case "keymap": option = new KeymapOption(parent); break; case "text": option = new TextOption(parent); break; default: option = null; break; } return option; }
/// <summary> /// </summary> /// <param name="parent"> </param> public Option(IContentContainer parent) { _parent = parent; _parent.Items.Add(this); _isGlobalVariable = false; _flags = OptionFlags.None; }
public MenuOption(IContentContainer parent) : base(parent) { VariableName = "Menu"; Value = "0"; _defaultIndex = 0; _values = new List<MenuItem>(); }
public AbstractTypedContentContainer(IContentContainer parent, String mimeType) : base(parent) { if (mimeType == null) { throw new ArgumentNullException("mimeType"); } _mimeType = mimeType; }
public void PushItem(IContentContainer container) { var item = CreateBarItem(container); if (item != null) { this.tileBarGroupNav.Items.Insert(0, item); this.simpleButton1.Visible = true; } }
/// <summary> /// /// </summary> /// <param name="parent"></param> public SliderOption(IContentContainer parent) : base(parent) { base.VariableName = "Slider"; base.Value = "0"; _minValue = 0.0f; _maxValue = 100.0f; _interval = 1.0f; }
internal BindStream(Stream stream, long maxBytes, Uri uri, IContentContainer cc, Dispatcher callbackDispatcher) { _bytesRead = 0; _maxBytes = maxBytes; _lastProgressEventByte = 0; _stream = stream; _uri = uri; _cc = cc; _callbackDispatcher = callbackDispatcher; }
public void PushItem(IContentContainer container) { var item = new NavigationBarItem(); var view = container.Manager.View as WindowsUIView; if (view == null) { return; } item.Text = String.IsNullOrEmpty(container.Subtitle) ? container.Caption + " >" : container.Subtitle + " >"; item.Tag = container; officeNavigationBar1.Items.Insert(0,item); }
public AbstractContentObject(IContentContainer parent) { _parent = parent; if (_parent != null) { _parent.Children.Add(this); } else if (!(this is IRootFolder)) { //Else, a null parent and this object isn't an IRootFolder implememtation. //A non-null parent is required throw new ArgumentNullException("parent"); } }
public override void Move(IContentContainer newParent) { if (newParent == null) { throw new ArgumentNullException("newParent"); } //Documents can only be moved to folders if (!(newParent is IFolder)) { throw new ArgumentException(); } base.Move (newParent); }
public static TileContainer CreateTileContainer(WindowsUIView view, Tile activationTile, string caption = "", String subCaption = "", IContentContainer parent = null) { TileContainer container = new TileContainer() { Caption = caption, Subtitle = subCaption, Parent = parent }; if (activationTile != null) { (container as IContentContainer).Name = activationTile.Tag.ToString(); activationTile.ActivationTarget = container; } container.Properties.IndentBetweenItems = 1; container.Properties.IndentBetweenGroups = 16; container.Properties.ItemSize = 128; container.Properties.ShowGroupText = DefaultBoolean.True; container.AppearanceGroupText.Font = new Font("Segoe UI Light", 18); container.Properties.AllowItemHover = DefaultBoolean.True; return container; }
public static object CreateFormTile(IForm fd, IContentContainer parent, bool isArchive = false) { var dTile = CreateTile(TileItemSize.Wide, 5); dTile.Tag = TagHelper.GetFormDataTag(TagHelper.TagType.Tile, fd); dTile.Elements[0].Appearance.Assign(AppearanceMid); dTile.Elements[0].Text = fd.form.name; dTile.Elements[0].Appearance.Normal.TextOptions.WordWrap = WordWrap.Wrap; dTile.Elements[0].Appearance.Normal.TextOptions.Trimming = Trimming.EllipsisPath; dTile.Elements[0].TextAlignment = TileItemContentAlignment.TopLeft; dTile.Elements[0].Height = 32; dTile.Elements[1].Appearance.Assign(AppearanceText); dTile.Elements[1].TextAlignment = TileItemContentAlignment.BottomLeft; dTile.Elements[2].Appearance.Assign(AppearanceMid); dTile.Elements[2].TextAlignment = TileItemContentAlignment.MiddleRight; dTile.Elements[2].Text = fd.send_date.ToString("yyyy"); dTile.Elements[3].Appearance.Assign(AppearanceMid); dTile.Elements[3].TextAlignment = TileItemContentAlignment.MiddleLeft; dTile.Elements[3].Text = string.Format("Срок подачи {0:dd.MM}\nЗагружена {1:dd.MM}", fd.form.submission_date, fd.send_date); dTile.Elements[4].ImageAlignment = TileItemContentAlignment.BottomRight; dTile.Elements[4].ImageIndex = fd.status; var doc = new Document { Tag = TagHelper.GetFormDataTag(TagHelper.TagType.Document, fd), Caption = fd.form.name, ControlName = string.Format("{1}FormData{0}", fd.form.form_type_id, isArchive ? "Archive" : "") }; var page = new Page { Document = doc, Subtitle = String.Format("{0} {1:d MMMM yyyy}", doc.Caption, fd.send_date), Caption = doc.Caption, Tag = TagHelper.GetFormDataTag(TagHelper.TagType.Container, fd), Parent = parent }; dTile.ActivationTarget = page; dTile.SearchTags = new[] { fd.form.name, fd.send_date.ToString("yyyy MMMM dd"), TileResources.FormDataText[(Status)fd.status] }; return new { Page = page, Document = doc, Tile = dTile }; }
/// <summary>Creates a fresh view-model and assigns it to the ViewModel property.</summary> /// <remarks> /// Typically the a view-model is bound to this property, and so for performance reasons /// a default view-model is not created. This method allows a "View First" usage of the control. /// </remarks> public IContentContainer CreateViewModel() { ViewModel = new ContentContainerViewModel(); return ViewModel; }
public virtual void Move(IContentContainer newParent) { if (newParent == null) { throw new ArgumentNullException("newParent"); } Move(newParent, newParent.Children.Count); }
public virtual void Move(IContentContainer newParent, int destIdx) { if (newParent == null) { throw new ArgumentNullException("newParent"); } if (destIdx > newParent.Children.Count) { throw new ArgumentOutOfRangeException("destIdx"); } if (newParent != _parent) { //Remove from old parent's Children collection, and add to new _parent.Children.Remove(this); _parent = newParent; _parent.Children.Insert(destIdx, this); OnChanged(new EventArgs()); } }
public TextLine(IContentContainer parent) : base(parent) { }
/// <summary> /// /// </summary> /// <param name="parent"></param> public EmptyOption(IContentContainer parent) : base(parent) { base.VariableName = "Empty"; }
/// <summary> /// /// </summary> /// <param name="parent"></param> public ToggleOption(IContentContainer parent) : base(parent) { base.VariableName = "Toggle"; base.Value = "false"; }
private TileBarItem CreateBarItem(IContentContainer container) { var view = container.Manager.View as WindowsUIView; if (view == null) { return null; } var tileBarItem = new TileBarItem() { Text = String.IsNullOrEmpty(container.Caption) ? container.Subtitle : container.Caption, TextAlignment = TileItemContentAlignment.MiddleLeft, ItemSize = TileBarItemSize.Wide, SuperTip = new SuperToolTip() }; tileBarItem.SuperTip.Items.Add(tileBarItem.Text); tileBarItem.ItemClick += (s, e) => view.ActivateContainer(container); tileBarItem.DropDownOptions.AutoHeight = DefaultBoolean.True; var tileContainer = container as TileContainer; if (tileContainer != null && tileContainer.Items.Count > 0) { var ddContainer = new TileBarDropDownContainer { Height = (int) (view.Manager.ContainerControl.Height*0.33f), BorderStyle = BorderStyles.Flat }; ddContainer.Appearance.BorderColor = Color.FromArgb(160,160,160); var ddTileBar = new TileBar { ItemSize = 25, Dock = DockStyle.Fill, Orientation = Orientation.Horizontal, BackColor = this.tileBarNavigation.BackColor }; //ddTileBar.AppearanceItem.Normal.BackColor = Color.FromArgb(37, 116, 169); ddTileBar.AppearanceItem.Normal.BackColor = Color.Transparent; ddTileBar.AppearanceItem.Normal.ForeColor = Color.FromArgb(59, 59, 59); ddTileBar.AppearanceItem.Normal.TextOptions.HAlignment = HorzAlignment.Near; ddTileBar.AppearanceItem.Normal.TextOptions.VAlignment = VertAlignment.Center; ddTileBar.AppearanceItem.Normal.TextOptions.Trimming = Trimming.EllipsisCharacter; ddTileBar.AppearanceItem.Normal.TextOptions.WordWrap = WordWrap.NoWrap; ddTileBar.ScrollMode = TileControlScrollMode.ScrollButtons; var ddTileGroup = new TileBarGroup(); ddTileBar.Groups.Add(ddTileGroup); foreach (var item in tileContainer.Items) { if (item == null) { continue; } var tile = (Tile)item; var childContainer = tile.ActivationTarget; var childDocument = tile.Document; var menuItem = new TileBarItem() { ItemSize = TileBarItemSize.Wide }; if (childContainer != null) { menuItem.Text = String.IsNullOrEmpty(childContainer.Subtitle) ? childContainer.Caption : childContainer.Subtitle; menuItem.ItemClick += (s, e) => view.ActivateContainer(childContainer); } else if (childDocument != null) { menuItem.Text = childDocument.Caption; menuItem.ItemClick += (s, e) => view.ActivateDocument(childDocument); } else { continue; } ddTileGroup.Items.Add(menuItem); } ddContainer.Controls.Add(ddTileBar); tileBarItem.DropDownControl = ddContainer; } return tileBarItem; }
private void RebuildNavBar(IContentContainer container) { if (container == null) return; xtraNavPane.ClearItems(); if (container == tileContainerMain) return; while (container != null && container != tileContainerMain) { xtraNavPane.PushItem(container); container = container.Parent; } }
public void CreateParent() { _root = new GenericRootFolder("Foo", ContentModelMockObjectFactory.CreateObjectPersistor()); _parent = new GenericFolder(_root, "Bar"); _doc = new GenericDocument(_parent, "Boo", "text/plain"); _cont = new GenericContentContainer(_doc); }
public TextBlock(IContentContainer parent) : base(parent) { }
public HeaderOption(IContentContainer parent) : base(parent) { base.VariableName = "Header"; base.Value = string.Empty; }
/// <summary> /// /// </summary> /// <param name="parent"></param> public TextOption(IContentContainer parent) : base(parent) { base.VariableName = "Text"; base.Value = string.Empty; }
public GenericContentObject(IContentContainer parent) : base(parent) { }
/// <summary> /// /// </summary> /// <param name="parent"></param> public ColorOption(IContentContainer parent) : base(parent) { base.VariableName = "Color"; base.Value = "0"; }
public string Invoke(IPage Page, IContentContainer ContentContainer) { string content = Page.Content; List <IPage> pages = (from IPage item in ContentContainer.Pages where item.Type == FileType.Custom select item).ToList(); IPage mainpage = (from IPage item in ContentContainer.Pages where item.Type == FileType.Index && item.ContinueNumber == 0 select item).First(); for (int i = 0; i < this.RegexTokens.Length; i++) { if (!Regex.IsMatch(content, this.RegexTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline)) { continue; } while (Regex.IsMatch(content, this.RegexTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline)) { string tokenStart = string.Empty; int tokenStartIndex = 0; string tokenEnd = Regex.Match(content, this.RegexTokensStart[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline).Value; int tokenEndIndex = content.IndexOf(tokenEnd); MatchCollection tokenStartMatchCollection = Regex.Matches(content, this.RegexTokensStart[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); tokenStartIndex = content.IndexOf(tokenStartMatchCollection[0].Value); // Looking for last [randomcustomblock:X:X] before [/randomcustomblock] for (int k = 0; k < tokenStartMatchCollection.Count; k++) { int tokenIndex = content.LastIndexOf(this.RegexTokensStart[i], tokenStartMatchCollection[k].Value, tokenEndIndex); if (tokenEndIndex < tokenIndex || tokenIndex < 0) { break; } tokenStartIndex = tokenIndex; } // Replacing string tokenValue = content.Substring(tokenStartIndex, tokenEndIndex + tokenEnd.Length - tokenStartIndex); content = content.Remove(tokenStartIndex, tokenEndIndex + tokenEnd.Length - tokenStartIndex); tokenStart = Regex.Match(tokenValue, this.RegexTokensStart[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline).Value; // Minimum and maximum List <int> minmax = this.GetMinMaxExtensions(tokenStart); int multiplyCount = this.Random.Next(minmax[0], minmax[1]); if (minmax[0] == 0 && minmax[1] == 0) { multiplyCount = pages.Count; } // Preparing content to multiply tokenValue = tokenValue.Replace(tokenStart, pages.Count != 0 ? string.Empty : string.Format("[MenuBlock:{0}:{1}]", minmax[0], minmax[1])); tokenValue = tokenValue.Replace(tokenEnd, pages.Count != 0 ? string.Empty : "[/MenuBlock]"); // Multiplying int pageIndex = 0; StringBuilder blockContent = new StringBuilder(tokenValue.Length * multiplyCount); for (int k = 0; k < multiplyCount; k++) { if (pages.Count == 0) { blockContent.Append(this.ReplaceBlockTokens(mainpage, tokenValue, ContentContainer)); } else { if (pages.Count <= pageIndex) { pageIndex = 0; } blockContent.Append(this.ReplaceBlockTokens(pages[pageIndex], tokenValue, ContentContainer)); pageIndex++; } } // Inserting new content content = content.Insert(tokenStartIndex, blockContent.ToString()); } // Cleaning for left tokens content = Regex.Replace(content, this.RegexTokensStart[i], string.Empty, RegexOptions.Compiled | RegexOptions.IgnoreCase); content = Regex.Replace(content, this.RegexTokensEnd[i], string.Empty, RegexOptions.Compiled | RegexOptions.IgnoreCase); } // Replace out of blocks tokens // Tokens for (int i = 0; i < this.RegexTokenTokens.Length; i++) { if (!Regex.IsMatch(content, this.RegexTokenTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline)) { continue; } MatchCollection matchCollection = Regex.Matches(content, this.RegexTokenTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); for (int k = 0; k < matchCollection.Count; k++) { List <string> extensions = this.GetExtensions(matchCollection[k].Value); while (content.Contains(matchCollection[k].Value)) { content = content.ReplaceOne(matchCollection[k].Value, pages.Count != 0 ? this.ProcessExtensions(pages[this.Random.Next(pages.Count)].Keywords, extensions) : "[RandomKeyword" + (extensions.Count == 0 ? string.Empty : ":" + extensions.AsString(":")) + "]"); } } } // Links for (int i = 0; i < this.RegexLinkTokens.Length; i++) { if (!Regex.IsMatch(content, this.RegexLinkTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline)) { continue; } MatchCollection matchCollection = Regex.Matches(content, this.RegexLinkTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); for (int k = 0; k < matchCollection.Count; k++) { while (content.Contains(matchCollection[k].Value)) { content = content.ReplaceOne(matchCollection[k].Value, pages.Count != 0 ? pages[this.Random.Next(pages.Count)].URL : "[RandomKeywordLink]"); } } } return(content); }
/// <summary> /// /// </summary> /// <param name="parent"></param> public KeymapOption(IContentContainer parent) : base(parent) { base.VariableName = "Keymap"; base.Value = "0"; }
public string Invoke(IPage Page, IContentContainer ContentContainer) { string content = Page.Content; for (int i = 0; i < this.RegexTokens.Length; i++) { if (!Regex.IsMatch(content, this.RegexTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline)) { continue; } MatchCollection matchCollection = Regex.Matches(content, this.RegexTokens[i], RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); for (int k = 0; k < matchCollection.Count; k++) { int tokenIndex = 0; while (content.Contains(matchCollection[k].Value)) { tokenIndex = content.IndexOf(matchCollection[k].Value); content = content.Remove(tokenIndex, matchCollection[k].Value.Length); int multiplyCount = this.Random.Next(200, 300); if (this.CheckMinMaxExtensions(matchCollection[k].Value)) { List <int> minmax = this.GetMinMaxExtensions(matchCollection[k].Value); multiplyCount = this.Random.Next(minmax[0], minmax[1]); } int startIndex = GetNextWordIndexInText(Random.Next(ContentContainer.Text.Length), ContentContainer.Text); int endIndex = ContentContainer.Text.Length; while (startIndex >= 0 || ContentContainer.Text.Length <= endIndex || ContentContainer.Text.IndexOf(" ", endIndex) < 0) { startIndex = GetNextWordIndexInText(Random.Next(ContentContainer.Text.Length), ContentContainer.Text); if (startIndex < 0 || ContentContainer.Text.Length <= startIndex) { continue; } // Get number of words for (int l = 0; l < multiplyCount; l++) { startIndex = GetNextWordIndexInText(startIndex + 1, ContentContainer.Text); if (ContentContainer.Text.Length <= startIndex) { startIndex = -1; break; } } endIndex = startIndex + 1; } string text = ContentContainer.Text.Substring(startIndex, ContentContainer.Text.IndexOf(" ", endIndex) - startIndex).Clear().ToLower(); if (this.GetExtensions(matchCollection[k].Value).Contains("Big", true)) { text = text.ToUpper(StringToUpperType.FirstWord); } content = content.Insert(tokenIndex, text); } } } return(content); }
public static Tile CreateQuestionaryTile(questionary questionary, WindowsUIView view, IContentContainer parent) { var qTile = CreateTile(TileItemSize.Wide, 1); qTile.Elements[0].Appearance.Assign(AppearanceMid); qTile.Elements[0].Text = questionary.ToString(); qTile.Tag = TagHelper.GetQuestionaryTag(questionary, TagHelper.TagType.Tile); var questionaryDocument = new Document() { Caption = questionary.ToString(), ControlName = "Questionary", Tag = TagHelper.GetQuestionaryTag(questionary, TagHelper.TagType.Document) }; var questionaryPage = new Page { Caption = questionaryDocument.Caption, Document = questionaryDocument, Parent = parent, Tag = TagHelper.GetQuestionaryTag(questionary, TagHelper.TagType.Container) }; qTile.ActivationTarget = questionaryPage; view.Documents.Add(questionaryDocument); view.ContentContainers.Add(questionaryPage); return qTile; }
public override void Move(IContentContainer newParent) { //Root folders cannot be moved, as they are roots throw new InvalidOperationException(); }
public AbstractContentContainer(IContentContainer parent) : base(parent) { _children = null; }