Exemplo n.º 1
0
        public void AddPage(int number, int rows, int columns)
        {
            try
            {
                PreviewTabItem previewTabItem = new PreviewTabItem();
                previewTabItem.PreviewWidth  = 30;
                previewTabItem.PreviewHeight = 30;
                previewTabItem.TouchDown    += new EventHandler <TouchEventArgs>(previewTabItem_TouchDown);

                Grid       grid       = new Grid();
                WidgetPage widgetPage = new WidgetPage();

                previewTabItem.Content = grid;
                WidgetTabControl.Items.Add(previewTabItem);

                widgetPage.Number = number;
                widgetPage.Grid   = grid;
                _WidgetPages.Add(widgetPage);

                for (int row = 0; row < rows; row++)
                {
                    grid.RowDefinitions.Add(new RowDefinition());
                }

                for (int column = 0; column < columns; column++)
                {
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }
        }
Exemplo n.º 2
0
        private WidgetPage FindWidgetLocation(Widget widget)
        {
            WidgetPage ret = null;

            try
            {
                foreach (WidgetPage widgetPage in _WidgetPages)
                {
                    if (widgetPage.Widgets.ContainsValue(widget))
                    {
                        foreach (string name in widgetPage.Widgets.Keys)
                        {
                            if (widget.Name.Equals(name))
                            {
                                ret = widgetPage;
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }

            return(ret);
        }
Exemplo n.º 3
0
        public void Remove(Widget widget)
        {
            try
            {
                WidgetPage widgetPage = FindWidgetLocation(widget);

                if (widgetPage != null)
                {
                    widgetPage.Grid.Children.Remove(widget.Display);
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }
        }
Exemplo n.º 4
0
        private WidgetPage FindWidgetLocation(string name)
        {
            WidgetPage ret = null;

            try
            {
                foreach (WidgetPage widgetPage in _WidgetPages)
                {
                    if (widgetPage.Widgets.ContainsKey(name))
                    {
                        ret = widgetPage;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }

            return(ret);
        }
Exemplo n.º 5
0
        private WidgetPage FindPage(int number)
        {
            WidgetPage ret = null;

            try
            {
                foreach (WidgetPage widgetPage in _WidgetPages)
                {
                    if (widgetPage.Number.Equals(number))
                    {
                        ret = widgetPage;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }

            return(ret);
        }
Exemplo n.º 6
0
        public void Add(Widget widget)
        {
            try
            {
                WidgetPage widgetPage = FindWidgetLocation(widget.Name);

                if (widgetPage == null)
                {
                    widgetPage = FindPage(widget.Page);
                }

                if (widgetPage != null)
                {
                    if (widgetPage.Widgets.ContainsKey(widget.Name))
                    {
                        widget.Column     = widgetPage.Widgets[widget.Name].Column;
                        widget.ColumnSpan = widgetPage.Widgets[widget.Name].ColumnSpan;
                        widget.Row        = widgetPage.Widgets[widget.Name].Row;
                        widget.RowSpan    = widgetPage.Widgets[widget.Name].RowSpan;

                        widgetPage.Grid.Children.Remove(widgetPage.Widgets[widget.Name].Display);
                        widgetPage.Widgets[widget.Name] = widget;
                        widgetPage.Grid.Children.Add(widget.Display);
                    }
                    else
                    {
                        widgetPage.Widgets.Add(widget.Name, widget);
                        widgetPage.Grid.Children.Add(widget.Display);
                    }
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }
        }
Exemplo n.º 7
0
        public void AddPage(int number, int rows, int columns)
        {
            try
            {
                PreviewTabItem previewTabItem = new PreviewTabItem();
                previewTabItem.PreviewWidth = 30;
                previewTabItem.PreviewHeight = 30;
                previewTabItem.TouchDown += new EventHandler<TouchEventArgs>(previewTabItem_TouchDown);

                Grid grid = new Grid();
                WidgetPage widgetPage = new WidgetPage();

                previewTabItem.Content = grid;
                WidgetTabControl.Items.Add(previewTabItem);

                widgetPage.Number = number;
                widgetPage.Grid = grid;
                _WidgetPages.Add(widgetPage);

                for (int row = 0; row < rows; row++)
                {
                    grid.RowDefinitions.Add(new RowDefinition());
                }

                for (int column = 0; column < columns; column++)
                {
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex);
            }
        }