void HandleQueueDownloaderOnStart(LocalProgram startedProgram, int queueSize)
        {
            InvokeOnMainThread(delegate {
                Console.WriteLine("{0} has started", startedProgram.Name);

                TitleLabel.Text = startedProgram.Name;
                TitleLabel.SetNeedsDisplay();
                ImageView.Image = RemoteProgramHelper.GetFullsizeImageFromFile(startedProgram.ThumbnailPath, ImageView.Bounds);
                if (queueSize == 0)
                {
                    SubLabel.Text = "Downloading. No more items in the queue";
                }
                else if (queueSize == 1)
                {
                    SubLabel.Text = String.Format("Downloading. {0} item remaining to download", queueSize);
                }
                else
                {
                    SubLabel.Text = string.Format("Downloading. {0} items remaining to download", queueSize);
                }

                SubLabel.SetNeedsDisplay();
                ProgressBar.Progress = 0;
                ProgressBar.SetNeedsDisplay();
            });
        }
Exemplo n.º 2
0
        public void Label_GetStyle_Invoke_ReturnsExpected(ControlStyles flag, bool expected)
        {
            using var control = new SubLabel();
            Assert.Equal(expected, control.GetStyle(flag));

            // Call again to test caching.
            Assert.Equal(expected, control.GetStyle(flag));
        }
Exemplo n.º 3
0
        public override void CopyFrom(BindableObject bindableObject)
        {
            base.CopyFrom(bindableObject);

            if (bindableObject is DefaultLinearItemStyle RecyclerViewItemStyle)
            {
                Label.CopyFrom(RecyclerViewItemStyle.Label);
                SubLabel.CopyFrom(RecyclerViewItemStyle.SubLabel);
                Icon.CopyFrom(RecyclerViewItemStyle.Icon);
                Extra.CopyFrom(RecyclerViewItemStyle.Extra);
                Seperator.CopyFrom(RecyclerViewItemStyle.Seperator);
            }
        }
Exemplo n.º 4
0
        void ReleaseDesignerOutlets()
        {
            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (SubLabel != null)
            {
                SubLabel.Dispose();
                SubLabel = null;
            }
        }
Exemplo n.º 5
0
        public void Label_ImageKey_setting_empty_resets_ImageIndex()
        {
            string key = string.Empty;

            using var control = new SubLabel();
            Assert.NotEqual(IntPtr.Zero, control.Handle);
            Assert.Equal(key, control.ImageKey);
            Assert.Equal(-1, control.ImageIndex);

            control.ImageIndex = 2;
            control.ImageKey   = key;

            Assert.Equal(key, control.ImageKey);
            Assert.Equal(-1, control.ImageIndex);
        }
Exemplo n.º 6
0
        public void Label_ImageIndex_setting_minus_one_resets_ImageKey()
        {
            int index = -1;

            using var control = new SubLabel();
            Assert.NotEqual(IntPtr.Zero, control.Handle);
            Assert.Equal(index, control.ImageIndex);
            Assert.Equal(string.Empty, control.ImageKey);

            control.ImageKey   = "key";
            control.ImageIndex = index;

            Assert.Equal(index, control.ImageIndex);
            Assert.Equal(string.Empty, control.ImageKey);
        }
Exemplo n.º 7
0
        public void Label_CreateParams_GetDefault_ReturnsExpected()
        {
            using var control = new SubLabel();
            CreateParams createParams = control.CreateParams;

            Assert.Null(createParams.Caption);
            Assert.Equal("Static", createParams.ClassName);
            Assert.Equal(0x8, createParams.ClassStyle);
            Assert.Equal(0, createParams.ExStyle);
            Assert.Equal(23, createParams.Height);
            Assert.Equal(IntPtr.Zero, createParams.Parent);
            Assert.Null(createParams.Param);
            Assert.Equal(0x5600000D, createParams.Style);
            Assert.Equal(100, createParams.Width);
            Assert.Equal(0, createParams.X);
            Assert.Equal(0, createParams.Y);
            Assert.Same(createParams, control.CreateParams);
            Assert.False(control.IsHandleCreated);
        }
Exemplo n.º 8
0
        public void Label_Ctor_Default()
        {
            using var control = new SubLabel();
            Assert.Null(control.AccessibleDefaultActionDescription);
            Assert.Null(control.AccessibleDescription);
            Assert.Null(control.AccessibleName);
            Assert.Equal(AccessibleRole.Default, control.AccessibleRole);
            Assert.False(control.AllowDrop);
            Assert.Equal(AnchorStyles.Top | AnchorStyles.Left, control.Anchor);
            Assert.False(control.AutoEllipsis);
            Assert.False(control.AutoSize);
            Assert.Equal(Control.DefaultBackColor, control.BackColor);
            Assert.Null(control.BackgroundImage);
            Assert.Equal(ImageLayout.Tile, control.BackgroundImageLayout);
            Assert.Null(control.BindingContext);
            Assert.Equal(BorderStyle.None, control.BorderStyle);
            Assert.Equal(23, control.Bottom);
            Assert.Equal(new Rectangle(0, 0, 100, 23), control.Bounds);
            Assert.False(control.CanEnableIme);
            Assert.False(control.CanFocus);
            Assert.True(control.CanRaiseEvents);
            Assert.False(control.CanSelect);
            Assert.False(control.Capture);
            Assert.True(control.CausesValidation);
            Assert.Equal(new Size(100, 23), control.ClientSize);
            Assert.Equal(new Rectangle(0, 0, 100, 23), control.ClientRectangle);
            Assert.Null(control.Container);
            Assert.False(control.ContainsFocus);
            Assert.Null(control.ContextMenuStrip);
            Assert.Empty(control.Controls);
            Assert.Same(control.Controls, control.Controls);
            Assert.False(control.Created);
            Assert.Same(Cursors.Default, control.Cursor);
            Assert.Same(Cursors.Default, control.DefaultCursor);
            Assert.Equal(ImeMode.Disable, control.DefaultImeMode);
            Assert.Equal(new Padding(3, 0, 3, 0), control.DefaultMargin);
            Assert.Equal(Size.Empty, control.DefaultMaximumSize);
            Assert.Equal(Size.Empty, control.DefaultMinimumSize);
            Assert.Equal(Padding.Empty, control.DefaultPadding);
            Assert.Equal(new Size(100, 23), control.DefaultSize);
            Assert.False(control.DesignMode);
            Assert.Equal(new Rectangle(0, 0, 100, 23), control.DisplayRectangle);
            Assert.Equal(DockStyle.None, control.Dock);
            Assert.True(control.DoubleBuffered);
            Assert.True(control.Enabled);
            Assert.NotNull(control.Events);
            Assert.Same(control.Events, control.Events);
            Assert.Equal(FlatStyle.Standard, control.FlatStyle);
            Assert.False(control.Focused);
            Assert.Equal(Control.DefaultFont, control.Font);
            Assert.Equal(control.Font.Height, control.FontHeight);
            Assert.Equal(Control.DefaultForeColor, control.ForeColor);
            Assert.False(control.HasChildren);
            Assert.Equal(23, control.Height);
            Assert.Null(control.Image);
            Assert.Equal(ContentAlignment.MiddleCenter, control.ImageAlign);
            Assert.Equal(-1, control.ImageIndex);
            Assert.Empty(control.ImageKey);
            Assert.Null(control.ImageList);
            Assert.Equal(ImeMode.Disable, control.ImeMode);
            Assert.Equal(ImeMode.Disable, control.ImeModeBase);
            Assert.False(control.IsAccessible);
            Assert.False(control.IsMirrored);
            Assert.NotNull(control.LayoutEngine);
            Assert.Same(control.LayoutEngine, control.LayoutEngine);
            Assert.Equal(0, control.Left);
            Assert.Equal(Point.Empty, control.Location);
            Assert.Equal(new Padding(3, 0, 3, 0), control.Margin);
            Assert.Equal(Size.Empty, control.MaximumSize);
            Assert.Equal(Size.Empty, control.MinimumSize);
            Assert.Equal(Padding.Empty, control.Padding);
            Assert.Null(control.Parent);
            Assert.Equal("Microsoft\u00AE .NET", control.ProductName);
            Assert.Equal(0, control.PreferredSize.Width);
            Assert.True(control.PreferredSize.Height > 0);
            Assert.True(control.PreferredHeight > 0);
            Assert.Equal(0, control.PreferredWidth);
            Assert.False(control.RecreatingHandle);
            Assert.Null(control.Region);
            Assert.False(control.RenderTransparent);
            Assert.True(control.ResizeRedraw);
            Assert.Equal(100, control.Right);
            Assert.Equal(RightToLeft.No, control.RightToLeft);
            Assert.True(control.ShowFocusCues);
            Assert.True(control.ShowKeyboardCues);
            Assert.Null(control.Site);
            Assert.Equal(new Size(100, 23), control.Size);
            Assert.Equal(0, control.TabIndex);
            Assert.False(control.TabStop);
            Assert.Empty(control.Text);
            Assert.Equal(ContentAlignment.TopLeft, control.TextAlign);
            Assert.Equal(0, control.Top);
            Assert.Null(control.TopLevelControl);
            Assert.True(control.UseCompatibleTextRendering);
            Assert.True(control.UseMnemonic);
            Assert.False(control.UseWaitCursor);
            Assert.True(control.Visible);
            Assert.Equal(100, control.Width);

            Assert.False(control.IsHandleCreated);
        }
Exemplo n.º 9
0
 public void Label_GetTopLevel_Invoke_ReturnsExpected()
 {
     using var control = new SubLabel();
     Assert.False(control.GetTopLevel());
 }
Exemplo n.º 10
0
 public void Label_GetAutoSizeMode_Invoke_ReturnsExpected()
 {
     using var control = new SubLabel();
     Assert.Equal(AutoSizeMode.GrowOnly, control.GetAutoSizeMode());
 }
Exemplo n.º 11
0
        public static XMLLabel ParseXML(XmlElement xLabel)
        {
            // -------------------------------------------------------------------------
            System.Globalization.NumberFormatInfo nfi     = null;
            System.Globalization.CultureInfo      culture = null;

            nfi = new System.Globalization.CultureInfo("en-US", false).NumberFormat;
            nfi.CurrencySymbol           = "€";
            nfi.CurrencyDecimalDigits    = 2;
            nfi.CurrencyDecimalSeparator = ".";
            nfi.NumberGroupSeparator     = "";
            nfi.NumberDecimalSeparator   = ".";

            culture = new System.Globalization.CultureInfo("en-US");
            // -------------------------------------------------------------------------

            XMLLabel label = new XMLLabel();

            label.LABEL_ID = Convert.ToInt32(xLabel.GetElementsByTagName("id")[0].InnerText);
            label.NAME     = xLabel["name"].InnerText;
            if (xLabel["contactinfo"] != null)
            {
                label.CONTACTINFO = xLabel["contactinfo"].InnerText;
            }
            if (xLabel["profile"] != null)
            {
                label.PROFILE = xLabel["profile"].InnerText;
            }
            if (xLabel["data_quality"] != null)
            {
                label.DATA_QUALITY = xLabel["data_quality"].InnerText;
            }
            if (xLabel["parentLabel"] != null)
            {
                label.PARENTLABEL          = new SubLabel();
                label.PARENTLABEL.LABEL_ID = Convert.ToInt32(xLabel["parentLabel"].Attributes["id"].Value);
                label.PARENTLABEL.NAME     = xLabel["parentLabel"].InnerText;
            }

            if (xLabel.GetElementsByTagName("images")[0] != null)
            {
                foreach (XmlNode xn in xLabel.GetElementsByTagName("images")[0].ChildNodes)
                {
                    XmlElement xImage = (XmlElement)xn;
                    Image      image  = new Image();
                    image.HEIGHT = Convert.ToInt32(xImage.Attributes["height"].Value);
                    image.WIDTH  = Convert.ToInt32(xImage.Attributes["width"].Value);
                    image.TYPE   = xImage.Attributes["type"].Value;
                    image.URI    = xImage.Attributes["uri"].Value;
                    image.URI150 = xImage.Attributes["uri150"].Value;
                    label.IMAGES.Add(image);
                } //foreach
            }

            if (xLabel.GetElementsByTagName("urls")[0] != null)
            {
                foreach (XmlNode xn in xLabel.GetElementsByTagName("urls")[0].ChildNodes)
                {
                    XmlElement xUrl = (XmlElement)xn;
                    if (!string.IsNullOrEmpty(xUrl.InnerText))
                    {
                        label.URLS.Add(xUrl.InnerText.Trim());
                    }
                } //foreach
            }

            if (xLabel.GetElementsByTagName("sublabels")[0] != null)
            {
                foreach (XmlNode xn in xLabel.GetElementsByTagName("sublabels")[0].ChildNodes)
                {
                    XmlElement xSublabel = (XmlElement)xn;
                    SubLabel   subLabel  = new SubLabel();
                    if (!string.IsNullOrEmpty(xSublabel.InnerText))
                    {
                        subLabel.LABEL_ID = Convert.ToInt32(xSublabel.Attributes["id"].Value);
                        subLabel.NAME     = xSublabel.InnerText;
                        label.SUBLABELS.Add(subLabel);
                    }
                } //foreach
            }


            return(label);
        }