예제 #1
0
 public WidgetZoneTagHelper(IWidgetConfigurationService widgetConfigurationService, IWidgetViewInvoker widgetViewInvoker, IWidgetComponentFactory widgetComponentFactory, IWidgetContainer widgetContainer)
 {
     _widgetConfigurationService = widgetConfigurationService;
     _widgetViewInvoker          = widgetViewInvoker;
     _widgetComponentFactory     = widgetComponentFactory;
     _widgetContainer            = widgetContainer;
 }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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
            });
        }
예제 #5
0
        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;
        }
예제 #6
0
 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();
                }
            }
        }
예제 #8
0
 // Constructor
 public Box(IWidgetContainer container)
     : base(container)
 {
     BackgroundColor = Color.Black;
     BorderColor     = Color.Gray;
     BorderStyle     = BorderStyle.None;
     BorderSize      = 1;
 }
예제 #9
0
파일: Box.cs 프로젝트: Rewtek/GameLibrary
 // Constructor
 public Box(IWidgetContainer container)
     : base(container)
 {
     BackgroundColor = Color.Black;
     BorderColor = Color.Gray;
     BorderStyle = BorderStyle.None;
     BorderSize = 1;
 }
예제 #10
0
        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);
 }
예제 #12
0
        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);
        }
예제 #13
0
        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();
        }
예제 #14
0
        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();
     }
 }
예제 #17
0
        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));
            }
        }
예제 #19
0
 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
            }
        }
예제 #22
0
        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());
        }
예제 #23
0
        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);
        }
예제 #25
0
        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);
        }
예제 #26
0
        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();
            }
        }
예제 #27
0
        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);
        }
예제 #29
0
        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());
                }
            }
        }
예제 #31
0
        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;
        }
예제 #32
0
        // 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;
        }
예제 #33
0
파일: Label.cs 프로젝트: Rewtek/GameLibrary
        // 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;
        }
예제 #34
0
        // 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();
        }
예제 #35
0
        // 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();
        }
예제 #36
0
        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();
                    }
                }
            }
        }
예제 #37
0
        // 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"); };
            }
        }
예제 #38
0
        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;
        }
예제 #39
0
 public void Next(IWidgetContainer container)
 {
     Container.Next(container);
 }
 public WidgetContainerController(IWidgetContainer WidgetContainerRepo, IHTMLWidgetRepository HTMLWidgetRepo)
 {
     HTMLWidgetRepository = HTMLWidgetRepo;
     WidgetContainerRepository = WidgetContainerRepo;
 }
예제 #41
0
 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;
 }
예제 #43
0
파일: Frame.cs 프로젝트: Rewtek/GameLibrary
 // Properties
 // Constructor
 public Frame(IWidgetContainer container)
     : base(container)
 {
 }