public WidgetZoneTagHelper(IWidgetConfigurationService widgetConfigurationService, IWidgetViewInvoker widgetViewInvoker, IWidgetComponentFactory widgetComponentFactory, IWidgetContainer widgetContainer) { _widgetConfigurationService = widgetConfigurationService; _widgetViewInvoker = widgetViewInvoker; _widgetComponentFactory = widgetComponentFactory; _widgetContainer = widgetContainer; }
public void Next(IWidgetContainer container) { Widget focusedWidget = container.Widgets.FirstOrDefault(widget => widget.Focused == true); if (focusedWidget != null) { int currentIndex = container.Widgets.IndexOf(focusedWidget); if (currentIndex >= container.Widgets.Count) { currentIndex = 0; } currentIndex++; if (currentIndex >= container.Widgets.Count) { currentIndex = 0; } while (!container.Widgets[currentIndex].Focusable) { currentIndex++; if (currentIndex >= container.Widgets.Count) { currentIndex = 0; } } container.Widgets[currentIndex].Focused = true; } }
public void Next(IWidgetContainer container) { Widget focusedWidget = container.Widgets.FirstOrDefault(widget => widget.Focused == true); if (focusedWidget != null) { int currentIndex = container.Widgets.IndexOf(focusedWidget); if (currentIndex >= container.Widgets.Count) { currentIndex = 0; } currentIndex++; if (currentIndex >= container.Widgets.Count) { currentIndex = 0; } while (!container.Widgets[currentIndex].Focusable) { currentIndex++; if (currentIndex >= container.Widgets.Count) { currentIndex = 0; } } container.Widgets[currentIndex].Focused = true; } }
private WidgetPosition FindMaxContainerChildPoisition(Grid container) { // find the maximum child position in a container int maxRows = 0; int maxCols = 0; for (int iter = 0; iter < container.Children.Count; iter++) { if (container.Children[iter] is IWidgetContainer) { IWidgetContainer widgetContainer = container.Children[iter] as IWidgetContainer; int rowCountReq = widgetContainer.Position.Row + widgetContainer.Position.RowSpan; int colCountReq = widgetContainer.Position.Column + widgetContainer.Position.ColSpan; if (rowCountReq > maxRows) { maxRows = rowCountReq; } if (colCountReq > maxCols) { maxCols = colCountReq; } } } return(new WidgetPosition { Row = maxRows - 1, Column = maxCols - 1 }); }
void __newFoldout_OnClick(IUEditorWidgetClickable sender, System.EventArgs e) { if (this._controlKeyPressed) { UEditorWidgetBase __castSender = (UEditorWidgetBase)sender; //TODO: if the current object is the root form bail out!!!!! //Is the selected widget a container if (__castSender.BoundObject.GetType().IsSubclassOf(typeof(UEditorPanelBase)) || __castSender.BoundObject.GetType().IsSubclassOf(typeof(UEditorPanelBase))) { IWidgetContainer __newParent = (IWidgetContainer)__castSender.BoundObject; UEditorWidgetBase __widgetToMove = (UEditorWidgetBase)this.SelectedFoldout.BoundObject; IWidgetContainer __oldParent = ((UEditorWidgetBase)this.SelectedFoldout.BoundObject).parent; __oldParent.RemoveChild(__widgetToMove); __newParent.AddChild(__widgetToMove); } } //Update the selected foldout //TODO: Consider wrapping some type saftey around this this.SelectedFoldout = (UEditorWidgetFoldout)sender; }
public static bool AlertsAre(this IWidgetContainer container, int attended, int alerted, int future) { return (attended == container.AlertCount(AlertCurrentState.Attended) && alerted == container.AlertCount(AlertCurrentState.Alerted) && future == container.AlertCount(AlertCurrentState.Future)); }
// This function will be passed as the timer trigger function public void Fetch_Timer_Tick(object sender, EventArgs e) { // Refresh data of all widgetContainers for (int containerIter = 0; containerIter < CellsContainer.Children.Count; containerIter++) { IWidgetContainer container = (IWidgetContainer)CellsContainer.Children[containerIter]; if (!AutoFetchManager.DashboardAutoFetchState.IsDominatingSchedule) { // handle non dominating schedule case. // Here we refresh container widget only if it's scheduler is disabled WidgetContainerAutoFetchState containerState = container.AutoFetchState; containerState.IsSuppressed = false; container.AutoFetchState = containerState; if (container.AutoFetchState.SchedulerState.Mode == ScheduleMode.Disabled) { container.RefreshData(); } } else { // handle dominating schedule case // here we disable container scheduler and refresh its data WidgetContainerAutoFetchState containerState = container.AutoFetchState; containerState.IsSuppressed = true; container.AutoFetchState = containerState; container.RefreshData(); } } }
// Constructor public Box(IWidgetContainer container) : base(container) { BackgroundColor = Color.Black; BorderColor = Color.Gray; BorderStyle = BorderStyle.None; BorderSize = 1; }
// Constructor public Box(IWidgetContainer container) : base(container) { BackgroundColor = Color.Black; BorderColor = Color.Gray; BorderStyle = BorderStyle.None; BorderSize = 1; }
public static int AlertCount(this IWidgetContainer container, AlertCurrentState state) { var result = (string)container.Selenium.ExecuteScript("return $('{0} span.sf-widget-count.{1}').html()".FormatWith( container.WidgetContainerLocator().CssSelector(), GetCssClass(state))); return(int.Parse(result)); }
public void DeleteWidgetFromContainer(Grid container, IWidgetContainer widgetContainer) { // tell the widget to do memory free up and connection closing widgetContainer.DoWidgetCleanUp(); container.Children.Remove(widgetContainer as UserControl); // todo make user opt for this in the future RemoveEmptyRowsAndColumns(container); }
public static SearchPopupProxy QuickLinkClickSearch(this IWidgetContainer container, string name) { container.QuickLinkClick(name); var result = new SearchPopupProxy(container.Selenium, "_".Combine(container.Prefix, "New")); container.Selenium.WaitElementPresent(result.PopupLocator); result.SearchControl.WaitInitialSearchCompleted(); return(result); }
public static void QuickLinkClick(this IWidgetContainer container, string name) { container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-quicklinks")); By quickLinkSelector = container.WidgetContainerLocator().CombineCss(" ul li.sf-quick-link[data-name='{0}'] > a".FormatWith(name)); container.Selenium.WaitElementPresent(quickLinkSelector); container.Selenium.FindElement(quickLinkSelector).ButtonClick(); }
public static By WidgetContainerLocator(this IWidgetContainer container) { if (container.Prefix.HasText()) { throw new NotImplementedException("WidgetContainerSelector not implemented for popups"); } return(By.CssSelector("#divMainPage ul.sf-widgets")); }
public void ChangeWidgetPosition(Grid container, IWidgetContainer widgetContainer, WidgetPosition newPosition) { WidgetPosition legitPosition = newPosition.GetLegitPosition(); EnsureWidgetPositon(container, legitPosition); widgetContainer.Position = legitPosition; // todo make user opt for this in the future RemoveEmptyRowsAndColumns(container); }
private void RefreshAllWidgets() { // Refresh data of all widgetContainers for (int containerIter = 0; containerIter < CellsContainer.Children.Count; containerIter++) { IWidgetContainer container = (IWidgetContainer)CellsContainer.Children[containerIter]; container.RefreshData(); } }
void Hierarchy_onContainerChange(IWidgetContainer sender) { //Find the widget in the hierarchy UEditorWidgetBase __hierarchyContainer = UWidget.FindWidgetById(this.HierarchyContainer, sender.ObjectID); if (__hierarchyContainer != null) { BuildHericRecursive((UEditorWidgetFoldout)__hierarchyContainer, sender.Children); } }
public void RemoveContainer(IWidgetContainer container) { var cnt = container as ContainerType; if (cnt != null) { this.Container.Remove(cnt); OnPropertyChanged(nameof(Container)); } }
public PageController(IPageRepository PageRepo, IJSONRepository JSONRepo, IFormRepository FormRepo, IFAQRepository FAQRepo, IBlogPostRepository BlogPostRepo, IImageRepository ImageRepo, IWidgetContainer WidgetContainerRepo) { PageRepository = PageRepo; JSONRepository = JSONRepo; FormRepository = FormRepo; FAQRepository = FAQRepo; BlogPostRepository = BlogPostRepo; ImageRepository = ImageRepo; WidgetContainerRepository = WidgetContainerRepo; }
public WidgetContainerViewModel(IWidgetContainer widgetContainer, IFactory<IWidget, IWidgetViewModel> factory) { this.WidgetViewModels = new ObservableCollection<IWidgetViewModel>(); foreach (var w in widgetContainer.Widgets) this.WidgetViewModels.Add(factory.Create(w)); //Write to console to see widgets foreach (var wvm in this.WidgetViewModels) Console.WriteLine(wvm); }
public void RemoveContainer(IWidgetContainer container) { var cnt = container as ContainerType; if (cnt != null) { this.Container.Remove(cnt); OnPropertyChanged("Container"); //NOXLATE } }
public static IWebElement QuickLinkClick(this IWidgetContainer container, string name) { var ql = container.WidgetContainer().CombineCss("dropdown .sf-quicklinks").Find(); ql.Click(); var element = ql.GetParent().WaitElementPresent(By.CssSelector("ul.dropdown-menu a[data-name='{0}']".FormatWith(name))); return(element.CaptureOnClick()); }
protected override void OnWidgetContainerChanged(IWidgetContainer old) { base.OnWidgetContainerChanged(old); if (old != null) { NotifyParentAutoCalculation(old); } NotifyParentAutoCalculation(null); }
private TreeNode CreateContainerNode(IWidgetContainer cnt) { var node = new TreeNode(); node.Name = cnt.Name; node.Text = cnt.Name; node.ImageIndex = IDX_CONTAINER; node.Tag = cnt; return(node); }
public static PopupControl <AlertEntity> AlertCreateClick(this IWidgetContainer container) { container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-alerts-toggler")).Click(); By createLocator = container.WidgetContainerLocator().CombineCss(" a.sf-alert-create"); container.Selenium.WaitElementVisible(createLocator); container.Selenium.FindElement(createLocator).Click(); PopupControl <AlertEntity> result = new PopupControl <AlertEntity>(container.Selenium, "New"); container.Selenium.WaitElementPresent(result.PopupLocator); return(result); }
void _btnMoveDown_OnClick(IUEditorWidgetClickable sender, System.EventArgs e) { IWidgetContainer __parentContainer = Canvas.SelectedWidget.parent; int __widgetIndex = __parentContainer.Children.IndexOf(Canvas.SelectedWidget); //Did we find the widget and is it in a position we can move down from if (__widgetIndex != -1 && __widgetIndex <= __parentContainer.Children.Count - 2) { //Update the canvas __parentContainer.Children.RemoveAt(__widgetIndex); __parentContainer.Children.Insert(__widgetIndex + 1, Canvas.SelectedWidget); __parentContainer.Raise_onContainerChange(); } }
public static SearchPopupProxy NotesViewClick(this IWidgetContainer container) { container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-notes-toggler")).Click(); By viewSelector = container.WidgetContainerLocator().CombineCss(" a.sf-note-view"); container.Selenium.WaitElementVisible(viewSelector); container.Selenium.FindElement(viewSelector).Click(); SearchPopupProxy result = new SearchPopupProxy(container.Selenium, "New"); container.Selenium.WaitElementPresent(result.PopupLocator); result.SearchControl.WaitInitialSearchCompleted(); return(result); }
private DashboardState GenerateState() { DashboardState state = DashboardState; // Create WidgetContainerStates and append to list DashboardState.WidgetContainerStates.Clear(); for (int widgetContIter = 0; widgetContIter < CellsContainer.Children.Count; widgetContIter++) { IWidgetContainer container = (IWidgetContainer)CellsContainer.Children[widgetContIter]; IWidgetContainerState containerState = container.GenerateState(); DashboardState.WidgetContainerStates.Add(containerState); } return(state); }
public static SearchPopupProxy AlertsViewClick(this IWidgetContainer container, AlertCurrentState state) { container.Selenium.FindElement(container.WidgetContainerLocator().CombineCss(" .sf-alerts-toggler")).Click(); By viewSelector = container.WidgetContainerLocator().CombineCss(" .sf-alert-view .{0}.sf-alert-count-label".FormatWith(GetCssClass(state))); container.Selenium.WaitElementVisible(viewSelector); container.Selenium.FindElement(viewSelector).Click(); SearchPopupProxy result = new SearchPopupProxy(container.Selenium, "alerts"); container.Selenium.WaitElementPresent(result.PopupLocator); result.SearchControl.WaitInitialSearchCompleted(); return(result); }
private void EnsureWidgetPositon(Grid container, WidgetPosition position) { WidgetPosition maxPosition = FindMaxContainerRowColumnDefinitions(container); // find max rows and columns in the container int maxRows = maxPosition.Row + 1; int maxCols = maxPosition.Column + 1; for (int iter = 0; iter < container.Children.Count; iter++) { if (container.Children[iter] is IWidgetContainer) { IWidgetContainer widgetContainer = container.Children[iter] as IWidgetContainer; int rowCountReq = widgetContainer.Position.Row + widgetContainer.Position.RowSpan; int colCountReq = widgetContainer.Position.Column + widgetContainer.Position.ColSpan; if (rowCountReq > maxRows) { maxRows = rowCountReq; } if (colCountReq > maxCols) { maxCols = colCountReq; } } } // Add adequate number of row and column definitions // Find rows deficit int rowDeficit = position.Row + position.RowSpan - maxRows; int colDeficit = position.Column + position.ColSpan - maxCols; if (rowDeficit > 0) { // add deficit rows for (int i = 0; i < rowDeficit; i++) { container.RowDefinitions.Add(GetNewRowDefinition()); } } if (colDeficit > 0) { // add deficit columns for (int i = 0; i < colDeficit; i++) { container.ColumnDefinitions.Add(GetNewColDefinition()); } } }
public WidgetManager(IHostEnvironment hostEnvironment, IJsonSerializer jsonSerializer, IServiceProvider serviceProvider, IWidgetContainer widgetContainer) { _hostEnvironment = hostEnvironment; _jsonSerializer = jsonSerializer; _serviceProvider = serviceProvider; _configFile = Path.Combine(hostEnvironment.ContentRootPath, "App_Data", _configFileName); LoadFromConfigFile(); _fileSystemWatcher = new FileSystemWatcher(Path.GetDirectoryName(_configFile)) { EnableRaisingEvents = true }; _fileSystemWatcher.Changed += FileSystemWatcher_Changed; _widgetContainer = widgetContainer; }
// Constructor public Label(IWidgetContainer container) : base(container) { AutoSize = true; Text = Name; Font = Font.Default; FontColor = Color.White; BackgroundColor = Color.Transparent; ShadowColor = Color.Gray; TextAlignment = TextAlignment.None; Width = Font.MeasureString(Text).Width; Height = Font.MeasureString(Text).Height; }
// Constructor public Label(IWidgetContainer container) : base(container) { AutoSize = true; Text = Name; Font = Font.Default; FontColor = Color.White; BackgroundColor = Color.Transparent; ShadowColor = Color.Gray; TextAlignment = TextAlignment.None; Width = Font.MeasureString(Text).Width; Height = Font.MeasureString(Text).Height; }
// Constructor public Widget(IWidgetContainer container) { _focused = false; _enabled = true; _currentMouse = Core.Components.Require<Mouse>(); _lastMouse = new MouseEventArgs(_currentMouse); Visible = true; Opacity = 1.0f; Tag = string.Empty; Name = GetType().Name + GetHashCode(); Position = new Vector2(0, 0); Container = container; Container.Widgets.Add(this); Widgets = new List<Widget>(); OnLoad(); }
// Constructor public Widget(IWidgetContainer container) { _focused = false; _enabled = true; _currentMouse = Core.Components.Require <Mouse>(); _lastMouse = new MouseEventArgs(_currentMouse); Visible = true; Opacity = 1.0f; Tag = string.Empty; Name = GetType().Name + GetHashCode(); Position = new Vector2(0, 0); Container = container; Container.Widgets.Add(this); Widgets = new List <Widget>(); OnLoad(); }
void NotifyParentAutoCalculation(IWidgetContainer container) { if (container == null) { container = this.WidgetContainer; } var topic = container as Topic; if (topic != null && topic.ParentTopic != null) { var bars = (from widget in topic.ParentTopic.Widgets where widget is ProgressBarWidget select(ProgressBarWidget) widget).ToArray(); foreach (var bar in bars) { if (bar.AutoCalculation) { bar.AutoCalculateValue(); } } } }
// Constructor public ContextMenu(IWidgetContainer container) : base(container) { Font = Font.Default; Text = "Context Menu Item"; FontColor = Color.White; BackgroundColor = Color.Black; ShadowColor = Color.Gray; TextAlignment = TextAlignment.Center; ContextMenuItems = new List<Label>(); Widgets.Add(new Label(this)); Widgets.Add(new Label(this)); foreach (var contextMenuItem in Widgets) { contextMenuItem.MouseEnter += (sender, e) => { ((Label)sender).BackgroundColor = Color.FromArgb(75, 0, 0, 0); }; contextMenuItem.MouseLeave += (sender, e) => { ((Label)sender).BackgroundColor = Color.FromArgb(50, 0, 0, 0); }; //contextMenuItem.Paint += (sender, e) => { System.Windows.Forms.MessageBox.Show("Test"); }; } }
private TreeNode CreateContainerNode(IWidgetContainer cnt) { var node = new TreeNode(); node.Name = cnt.Name; node.Text = cnt.Name; node.ImageIndex = IDX_CONTAINER; node.Tag = cnt; return node; }
public void Next(IWidgetContainer container) { Container.Next(container); }
public WidgetContainerController(IWidgetContainer WidgetContainerRepo, IHTMLWidgetRepository HTMLWidgetRepo) { HTMLWidgetRepository = HTMLWidgetRepo; WidgetContainerRepository = WidgetContainerRepo; }
public void RemoveContainer(IWidgetContainer container) { var cnt = container as ContainerType; if (cnt != null) { this.Container.Remove(cnt); OnPropertyChanged("Container"); //NOXLATE } }
protected override void InnerAdapt(IWidgetContainer container) { _scatterView = (ScatterView)container.Target; container.WidgetHosts.CollectionChanged += WidgetHosts_CollectionChanged; }
// Properties // Constructor public Frame(IWidgetContainer container) : base(container) { }