Ejemplo n.º 1
0
        public ComPanel(Window parent, ComService comService)
            : base(parent)
        {
            _comService                = comService;
            _comService.DataArrived   += ComDataArrived;
            _comService.StatusChanged += ComStatusChanged;

            var sizer = new BoxSizer(Orientation.Vertical);

            _dataFont = new Font(10, FontFamily.Teletype, FontStyle.Normal, FontWeight.Normal);

            Panel controlPanel = CreateControlPanel();

            sizer.Add(controlPanel, 0, SizerFlag.Expand | SizerFlag.All, 0);

            _history = new TextCtrl(this, "", WxDefaultPosition, WxDefaultSize,
                                    WindowStyles.TextCtrlMultiline | WindowStyles.TextCtrlReadonly)
            {
                Font = _dataFont
            };
            sizer.Add(_history, 1, SizerFlag.Expand | SizerFlag.All, 0);

            Panel sendPanel = CreateSendPanel();

            sizer.Add(sendPanel, 0, SizerFlag.Expand | SizerFlag.All, 5);

            SetSizer(sizer);
            sizer.SetSizeHints(this);

            EvtSize((e, s) => Sizer.SetDimension(0, 0, Width, Height));
            EvtClose((e, s) => OnClose());

            DisableInput();
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            var hashCode = 0;

            foreach (var processExclusion in ProcessExclusions)
            {
                hashCode ^= processExclusion.GetHashCode();
            }

            foreach (var item in MenuItems.WindowSizeItems)
            {
                hashCode ^= item.Title.GetHashCode() ^ item.Width.GetHashCode() ^ item.Height.GetHashCode();
            }

            foreach (var item in MenuItems.StartProgramItems)
            {
                hashCode ^= item.Title.GetHashCode() ^ item.FileName.GetHashCode() ^ item.Arguments.GetHashCode();
            }

            foreach (var item in MenuItems.Items)
            {
                hashCode ^= item.Name.GetHashCode() ^ item.Key1.GetHashCode() ^ item.Key2.GetHashCode() ^ item.Key3.GetHashCode();
            }

            hashCode ^= Closer.Type.GetHashCode();
            hashCode ^= Closer.Key1.GetHashCode();
            hashCode ^= Closer.Key2.GetHashCode();
            hashCode ^= Closer.MouseButton.GetHashCode();
            hashCode ^= Sizer.GetHashCode();
            hashCode ^= LanguageName.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 3
0
 private void ThemedForm_Shown(object sender, EventArgs e)
 {
     if (!canResize)
     {
         Sizer.Hide();
     }
 }
Ejemplo n.º 4
0
        private void ImageListView_OnDrop(object sender, DragEventArgs e)
        {
            Reference.ImageCollection.Clear();

            if (e.Data == null)
            {
                return;
            }
            string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
            switch (data)
            {
            case null:
                break;

            default:
                foreach (string file in data)
                {
                    FileInfo info = new FileInfo(file);
                    if (!Reference.ImageTypes.Contains(info.Extension.ToLower()))
                    {
                        continue;
                    }
                    Reference.ImageCollection.Add(new ImageFile()
                    {
                        Name      = Path.GetFileNameWithoutExtension(file),
                        Type      = info.Extension,
                        Location  = info.DirectoryName,
                        Converted = false,
                        Size      = Sizer.GetSizeSuffix(file)
                    });
                }
                break;
            }
        }
Ejemplo n.º 5
0
 private void handleDataSent(int length)
 {
     lock (dataSentValueLabel)
     {
         _dataSent += length;
         dataSentValueLabel.Text = Sizer.convertSize(_dataSent);
     }
 }
Ejemplo n.º 6
0
 private void handleDataReceived(int length)
 {
     lock (dataReceivedValueLabel)
     {
         _dataReceived += length;
         dataReceivedValueLabel.Text = Sizer.convertSize(_dataReceived);
     }
 }
Ejemplo n.º 7
0
 public override void UpdateSelf(GameTime gameTime)
 {
     base.UpdateSelf(gameTime);
     if (Sizer.TargetElement != null && Sizer.TargetElement.ShouldRecalculate)
     {
         Sizer.AttachTo(Sizer.TargetElement);
     }
 }
Ejemplo n.º 8
0
 public void Draw(PointD location, RectangleD measured, string text, int count)
 {
     // For computation explanation, see
     // https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/basics/text.
     textPaint.TextSize = (float)Sizer.GetFontSize(count);
     canvas.DrawText(text, (float)(location.X - measured.Left),
                     (float)(location.Y - measured.Top), textPaint);
 }
Ejemplo n.º 9
0
        public CreditViewer()
        {
            InitializeComponent();
            this.canResize        = false;
            this.moveCenterScreen = true;

            //this.TitleBar_LeftCorner.SendToBack();
            Sizer.Hide();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Generates a Standard (Industrial) 2 of 5 barcode of a specified size, using the data that has been set previously by its corresponding
        /// encoder.
        /// </summary>
        /// <param name="size">The size of the barcode to return.</param>
        /// <returns>A bitmap of the barcode, of the specified size.</returns>
        /// <exception cref="System.ArgumentException">The specified size is invalid.</exception>
        /// <exception cref="System.InvalidOperationException">The data that is to be encoded has not been set yet.</exception>
        public override Bitmap GenerateBarcode(Size size)
        {
            if (data == null)
            {
                throw new InvalidOperationException("The data for the generator has not been set.");
            }
            if (!Sizer.IsValidSize(size))
            {
                throw new ArgumentException("The specified size is not valid.");
            }
            EncodeData();

            Bitmap   bm = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppRgb);
            Graphics g  = Graphics.FromImage(bm);

            int module, guard;

            module = ((S2of5Sizer)Sizer).ModuleWidth;
            guard  = ((S2of5Sizer)Sizer).GuardWidth;

            S2of5Sizer sSizer = (S2of5Sizer)Sizer;

            if (sSizer.TopWidth != 0)
            {
                g.FillRectangle(Brushes.White, Rectangle.FromLTRB(sSizer.SideBrace, sSizer.TopWidth, size.Width - sSizer.SideBrace, size.Height - sSizer.BottomWidth));
            }
            else
            {
                g.FillRectangle(Brushes.White, 0, 0, size.Width, size.Height);
            }

            int pos = guard;

            for (int i = 0; i < encodedData.Length; i++)
            {
                if (encodedData[i])
                {
                    g.FillRectangle(Brushes.Black, pos, 0, module, size.Height);
                }
                pos += module;
            }

            if (sSizer.FontHeight != 0)
            {
                string text = "";
                foreach (byte b in data)
                {
                    text += b.ToString();
                }

                g.FillRectangle(Brushes.White, Rectangle.FromLTRB(0, size.Height - sSizer.FontHeightAddon, size.Width, size.Height));
                g.DrawString(text, FontHolder.GenerateFont(sSizer.FontHeight), Brushes.Black, Rectangle.FromLTRB(0, size.Height - sSizer.FontHeightAddon, size.Width, size.Height), FontHolder.CenterJustify);
            }

            g.Dispose();
            return(bm);
        }
Ejemplo n.º 11
0
        protected virtual void SetSize(Vector2 size, bool instant)
        {
            if (_contentRect)
            {
                _contentRect.SetPadding(Padding);
            }

            Sizer.SetTargetSize(size, instant);
        }
Ejemplo n.º 12
0
 public IEnumerable <(LayoutItem Item, double FontSize)> Arrange()
 {
     return(Process((engine, items) =>
     {
         // Just transform result.
         return items.Select(item =>
                             (item, engine.Sizer.GetFontSize(item.Entry.Count)));
     }));
 }
Ejemplo n.º 13
0
        public RectangleD Measure(string text, int count)
        {
            textPaint.TextSize = (float)Sizer.GetFontSize(count);
            SKRect rect = new SKRect();

            textPaint.MeasureText(text, ref rect);
            var m = wordCloud.ItemMargin;

            return(new RectangleD(rect.Left + m, rect.Top + m, rect.Width + 2 * m, rect.Height + 2 * m));
        }
Ejemplo n.º 14
0
 public void PlaceSizer(UIElement element)
 {
     if (element == null)
     {
         Sizer.UnAttach();
         Sizer.IsActive = false;
         return;
     }
     Sizer.IsActive = true;
     Sizer.AttachTo(element);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Generates a Codabar barcode of a specified size, using the data that has been set previously by its corresponding
        /// encoder.
        /// </summary>
        /// <param name="size">The size of the barcode to return.</param>
        /// <returns>A bitmap of the barcode, of the specified size.</returns>
        /// <exception cref="System.ArgumentException">The specified size is invalid.</exception>
        /// <exception cref="System.InvalidOperationException">The data that is to be encoded has not been set yet.</exception>
        public override Bitmap GenerateBarcode(Size size)
        {
            if (data == null)
            {
                throw new InvalidOperationException("The data for the generator has not been set.");
            }
            if (!Sizer.IsValidSize(size))
            {
                throw new ArgumentException("The specified size is not valid.");
            }
            EncodeData();

            Bitmap   bm = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppRgb);
            Graphics g  = Graphics.FromImage(bm);

            g.FillRectangle(Brushes.White, 0, 0, size.Width, size.Height);

            int module, guard;

            module = ((CodabarSizer)Sizer).ModuleWidth;
            guard  = ((CodabarSizer)Sizer).GuardWidth;

            int pos = guard;

            for (int i = 0; i < encodedData.Length; i++)
            {
                if (encodedData[i])
                {
                    g.FillRectangle(Brushes.Black, pos, 0, module, size.Height);
                }
                pos += module;
            }


            if (((CodabarSizer)Sizer).FontHeight != 0)
            {
                string text = "";
                foreach (byte b in data)
                {
                    text += "0123456789-$:/.+ABCD"[b];
                }

                Rectangle textArea = Rectangle.FromLTRB(0, size.Height - ((CodabarSizer)Sizer).FontHeightAddon, size.Width, size.Height);
                g.FillRectangle(Brushes.White, textArea);
                g.DrawString(text, FontHolder.GenerateFont(((CodabarSizer)Sizer).FontHeight), Brushes.Black, textArea, FontHolder.CenterJustify);
            }

            g.Dispose();
            return(bm);
        }
Ejemplo n.º 16
0
        public override int GetHashCode()
        {
            var hashCode = 0;

            foreach (var processExclusion in ProcessExclusions)
            {
                hashCode ^= processExclusion.GetHashCode();
            }

            foreach (var item in MenuItems.WindowSizeItems)
            {
                hashCode ^= item.Title.GetHashCode() ^ item.Left.GetHashCode() ^ item.Top.GetHashCode() ^ item.Width.GetHashCode() ^ item.Height.GetHashCode() ^ item.Key1.GetHashCode() ^ item.Key2.GetHashCode() ^ item.Key3.GetHashCode();
            }

            foreach (var item in MenuItems.StartProgramItems)
            {
                hashCode ^= item.Title.GetHashCode() ^ item.FileName.GetHashCode() ^ item.Arguments.GetHashCode() ^ item.UseWindowWorkingDirectory.GetHashCode() ^ item.RunAs.GetHashCode() ^ item.BeginParameter.GetHashCode() ^ item.EndParameter.GetHashCode();
            }

            foreach (var item in MenuItems.Items)
            {
                hashCode ^= item.Show.GetHashCode() ^ item.Type.GetHashCode() ^ item.Name.GetHashCode() ^ item.Key1.GetHashCode() ^ item.Key2.GetHashCode() ^ item.Key3.GetHashCode();
                foreach (var subItem in item.Items)
                {
                    hashCode ^= subItem.Show.GetHashCode() ^ subItem.Type.GetHashCode() ^ subItem.Name.GetHashCode() ^ subItem.Key1.GetHashCode() ^ subItem.Key2.GetHashCode() ^ subItem.Key3.GetHashCode();
                }
            }

            hashCode ^= Closer.Type.GetHashCode();
            hashCode ^= Closer.Key1.GetHashCode();
            hashCode ^= Closer.Key2.GetHashCode();
            hashCode ^= Closer.MouseButton.GetHashCode();
            hashCode ^= SaveSelectedItems.AeroGlass.GetHashCode();
            hashCode ^= SaveSelectedItems.AlwaysOnTop.GetHashCode();
            hashCode ^= SaveSelectedItems.HideForAltTab.GetHashCode();
            hashCode ^= SaveSelectedItems.Alignment.GetHashCode();
            hashCode ^= SaveSelectedItems.Transparency.GetHashCode();
            hashCode ^= SaveSelectedItems.Priority.GetHashCode();
            hashCode ^= SaveSelectedItems.MinimizeToTrayAlways.GetHashCode();
            hashCode ^= Sizer.GetHashCode();
            hashCode ^= LanguageName.GetHashCode();
            hashCode ^= ShowSystemTrayIcon.GetHashCode();
            hashCode ^= EnableHighDPI.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 17
0
        void ResizeButton_Click(Object sender, RoutedEventArgs e)
        {
            try {
                IList <ActiveWindow> allWindows         = ActiveWindowCollector.GetActiveWindows();
                IList <ActiveWindow> selectedWindowList = allWindows
                                                          .Where(wnd => !new[] { "start", "chiisanairoiro" }.Contains(wnd.Name.ToLowerInvariant()))
                                                          .ToList();

                foreach (ActiveWindow item in selectedWindowList)
                {
                    var profile = (Profile)WindowSizeDropdownList.SelectedItem;
                    Sizer.Set(item.Id, (Int32)profile.Size.Width, (Int32)profile.Size.Height, ConsiderScalingFactor);
                }
            }
            catch (Exception ex) {
                ex.ShowInTaskDialog();
            }
        }
Ejemplo n.º 18
0
 // called every frame
 public virtual void Refresh(bool instant)
 {
     if (StyleDirty)
     {
         ApplyStyle(instant);
     }
     if (IsVisible && Positioner.Transporting)
     {
         Positioner.Refresh(instant || Revealer.CurrentVisibility == 0);
     }
     if (Revealer.Transitioning)
     {
         Revealer.Refresh(instant);
     }
     if (Sizer.Resizing)
     {
         Sizer.Refresh(instant);
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Generates a bitmap of the barcode, of the specified size and data.
        /// </summary>
        /// <param name="size">The size of barcode to generate.</param>
        /// <returns>A bitmap of the generated barcode.</returns>
        /// <remarks>As the dimensions of the Postnet/Planet barcode are strictly defined, the only valid size is
        /// the size returned by <see cref="Barcodes.BarcodeSizer.Size"/>.</remarks>
        /// <exception cref="System.ArgumentException">The specified size is invalid.</exception>
        /// <exception cref="System.InvalidOperationException">The data that is to be encoded has not been set yet.</exception>
        public override Bitmap GenerateBarcode(Size size)
        {
            if (data == null)
            {
                throw new InvalidOperationException("The data to encode has not been set.");
            }
            if (!Sizer.IsValidSize(size))
            {
                throw new ArgumentException("The specified size is invalid.");
            }
            EncodeData();

            PostnetSizer postnetSizer = (PostnetSizer)Sizer;
            int          longBar      = postnetSizer.LongBarHeight;
            int          shortBar     = postnetSizer.ShortBarHeight;
            int          barWidth     = postnetSizer.BarWidth;
            int          moduleWidth  = barWidth + postnetSizer.GapWidth;

            int      bHeight = size.Height;
            Bitmap   bm      = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppRgb);
            Graphics g       = Graphics.FromImage(bm);

            g.FillRectangle(Brushes.White, 0, 0, bm.Width, bm.Height);

            int i;

            for (i = 0; i < encodedData.Length; i++)
            {
                int length = (encodedData[i] ^ isPlanet) ? longBar : shortBar; //PLANET exchanges short and long bars.
                if (i == 0 || i == encodedData.Length - 1)
                {
                    length = longBar; //The guard bars are always long.
                }
                g.FillRectangle(Brushes.Black, moduleWidth * i, bHeight - length, barWidth, length);
            }

            g.Dispose();
            return(bm);
        }
Ejemplo n.º 20
0
        public static Size Measure2(IEnumerable <UIElement> children, Size availableSize, Func <UIElement, Sizing, bool> includeWidth, Func <UIElement, Sizing, bool> includeHeight)
        {
            List <UIElement> leftWidth = new List <UIElement>(), centerWidth = new List <UIElement>(), rightWidth = new List <UIElement>();
            List <UIElement> topHeight = new List <UIElement>(), middleHeight = new List <UIElement>(), bottomHeight = new List <UIElement>();

            List <UIElement> left2Width = new List <UIElement>(), center2Width = new List <UIElement>(), right2Width = new List <UIElement>();
            List <UIElement> top2Height = new List <UIElement>(), middle2Height = new List <UIElement>(), bottom2Height = new List <UIElement>();

            double leftCount = 0, centerCount = 0, rightCount = 0;
            double topCount = 0, middleCount = 0, bottomCount = 0;

            double center2Count = 0, middle2Count = 0;


            int bottomleftWidthCount = 0, bottomrightWidthCount = 0;
            int topleftWidthCount = 0, toprightWidthCount = 0;

            int bottomleftHeightCount = 0, bottomrightHeightCount = 0;
            int topleftHeightCount = 0, toprightHeightCount = 0;

            foreach (UIElement child in children)
            {
                var region       = EdgeLegacyPanel.GetCircleRegion(child);
                var heightSizing = EdgeLegacyPanel.GetHeightSizing(child);
                var widthSizing  = EdgeLegacyPanel.GetWidthSizing(child);

                //var aSize = asizes[region] = asizes.GetValueOrDefault(region, new A());

                child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                int widthCount  = includeWidth(child, widthSizing) ? 1 : 0;
                int heightCount = includeHeight(child, widthSizing) ? 1 : 0;


                switch (region)
                {
                case CircleRegion.TopLeft:

                    topleftWidthCount  += widthCount;
                    topleftHeightCount += heightCount;

                    break;

                case CircleRegion.BottomLeft:

                    bottomleftWidthCount  += widthCount;
                    bottomleftHeightCount += heightCount;

                    break;

                case CircleRegion.BottomRight:

                    bottomrightWidthCount  += widthCount;
                    bottomrightHeightCount += heightCount;

                    break;

                case CircleRegion.TopRight:

                    toprightWidthCount  += widthCount;
                    toprightHeightCount += heightCount;

                    break;

                case CircleRegion.Left:

                    leftCount += widthCount;

                    middle2Count = Math.Max(1, heightCount);
                    break;

                case CircleRegion.Right:

                    rightCount += widthCount;

                    middle2Count = Math.Max(1, heightCount);
                    break;


                case CircleRegion.Top:
                    center2Count = Math.Max(1, widthCount);

                    topCount += heightCount;
                    break;

                case CircleRegion.Bottom:
                    center2Count = Math.Max(1, widthCount);
                    bottomCount += heightCount;
                    break;


                case CircleRegion.Middle:
                    centerCount += widthCount;
                    middleCount += heightCount;
                    break;
                }
                ;
            }

            bottomCount = Math.Max(bottomCount, Math.Max(Sizer.GetCount(bottomleftHeightCount), Sizer.GetCount(bottomrightHeightCount)));
            topCount    = Math.Max(topCount, Math.Max(Sizer.GetCount(topleftHeightCount), Sizer.GetCount(toprightHeightCount)));
            leftCount   = Math.Max(leftCount, Math.Max(Sizer.GetCount(bottomleftWidthCount), Sizer.GetCount(bottomrightWidthCount)));
            rightCount  = Math.Max(rightCount, Math.Max(Sizer.GetCount(bottomleftHeightCount), Sizer.GetCount(bottomrightHeightCount)));

            //var remainingWidth = availableSize.Width - leftWidth.Sum() - centerWidth.Sum() - rightWidth.Sum();
            //var remainingHeight = availableSize.Height - topHeight.Sum() - middleHeight.Sum() - bottomHeight.Sum();



            var newMethod1 = NewMethod(availableSize.Height, GetHeight, new[] { bottomHeight, middleHeight, topHeight }).ToArray();

            var wrappedHeight = newMethod1
                                .SelectMany(a => a.Select((c, i) => (c, i)))
                                .GroupBy(a => a.i)
                                .Select(a => a.Max(c => c.c.Sum(GetHeight))).ToOptionalArray();

            var grouped = newMethod1
                          .SelectMany(a => a.Select((c, i) => (c, i)))
                          .GroupBy(a => a.i).ToArray();

            var wrappedWidth = grouped
                               .Select(a => a.Where(a => a.c.Any()).Sum(c => c.c.Max(GetWidth))).ToArray();

            var offsetCount = grouped.Select(a => a.Count(c => c.c.Any())).ToOptionalArray();



            var newMethod2 = NewMethod(availableSize.Width, GetWidth, new[] { leftWidth, centerWidth, rightWidth }).ToArray();

            var wrappedWidth2 = newMethod2
                                .SelectMany(a => a.Select((c, i) => (c, i)))
                                .GroupBy(a => a.i)
                                .Select(a => a.Max(c => c.c.Sum(GetWidth))).ToOptionalArray();

            var grouped2 = newMethod2
                           .SelectMany(a => a.Select((c, i) => (c, i)))
                           .GroupBy(a => a.i).ToArray();

            var wrappedHeight2 = grouped2
                                 .Select(a => a.Where(a => a.c.Any()).Sum(c => c.c.Max(GetHeight))).ToArray();

            var offsetCount2 = grouped2.Select(a => a.Count(c => c.c.Any())).ToOptionalArray();



            var newMethod3 = NewMethod(availableSize.Height, GetHeight, new[] {
                bottom2Height.OrderByDescending(GetHeight).Take(1).ToArray(),
                middle2Height.OrderByDescending(GetHeight).Take(1).ToArray(),
                top2Height.OrderByDescending(GetHeight).Take(1).ToArray()
            }).ToArray();

            var wrappedHeight3 = newMethod3
                                 .SelectMany(a => a.Select((c, i) => (c, i)))
                                 .GroupBy(a => a.i)
                                 .Select(a => a.Max(c => c.c.Sum(GetHeight))).ToOptionalArray();

            var grouped3 = newMethod3
                           .SelectMany(a => a.Select((c, i) => (c, i)))
                           .GroupBy(a => a.i).ToArray();


            var wrappedWidth3 = grouped3
                                .Select(a => a.Where(a => a.c.Any()).Sum(c => c.c.Max(GetWidth))).ToArray();

            var offsetCount3 = grouped3.Select(a => a.Count(c => c.c.Any())).ToOptionalArray();



            var newMethod4 = NewMethod(availableSize.Width, GetWidth, new[] {
                left2Width.OrderByDescending(GetWidth).Take(1).ToArray(),
                center2Width.OrderByDescending(GetWidth).Take(1).ToArray(),
                right2Width.OrderByDescending(GetWidth).Take(1).ToArray()
            }).ToArray();

            var wrappedWidth4 = newMethod4
                                .SelectMany(a => a.Select((c, i) => (c, i)))
                                .GroupBy(a => a.i)
                                .Select(a => a.Max(c => c.c.Sum(GetWidth))).ToOptionalArray();

            var grouped4 = newMethod4
                           .SelectMany(a => a.Select((c, i) => (c, i)))
                           .GroupBy(a => a.i).ToArray();

            var wrappedHeight4 = grouped4
                                 .Select(a => a.Where(a => a.c.Any()).Sum(c => c.c.Max(GetHeight))).ToArray();

            var offsetCount4 = grouped4.Select(a => a.Count(c => c.c.Any())).ToOptionalArray();


            //actualLeftOffset = Common.Max(offsetCount4[0], offsetCount2[0]).GetValueOrDefault(0);
            //actualCenterOffset = Common.Max(offsetCount4[1], offsetCount2[1]).GetValueOrDefault(0);
            //actualRightOffset = Common.Max(offsetCount4[2], offsetCount2[2]).GetValueOrDefault(0);

            //actualBottomOffset = Common.Max(offsetCount3[0], offsetCount[0]).GetValueOrDefault(0);
            //actualMiddleOffset = Common.Max(offsetCount3[1], offsetCount[1]).GetValueOrDefault(0);
            //actualTopOffset = Common.Max(offsetCount3[2], offsetCount[2]).GetValueOrDefault(0);

            //actualLeftWidth = Common.Max(wrappedWidth4[0], wrappedWidth2[0]).GetValueOrDefault(0);
            //actualCenterWidth = Common.Max(wrappedWidth4[1], wrappedWidth2[1]).GetValueOrDefault(0);
            //actualRightWidth = Common.Max(wrappedWidth4[2], wrappedWidth2[2]).GetValueOrDefault(0);

            //actualBottomHeight = Common.Max(wrappedHeight3[0], wrappedHeight[0]).GetValueOrDefault(0);
            //actualMiddleHeight = Common.Max(wrappedHeight3[1], wrappedHeight[1]).GetValueOrDefault(0);
            //actualTopHeight = Common.Max(wrappedHeight3[2], wrappedHeight[2]).GetValueOrDefault(0);

            var remainingWidth  = 0; //= availableSize.Width - actualLeftWidth - actualCenterWidth - actualRightWidth;
            var remainingHeight = 0; //= availableSize.Height - actualBottomHeight - actualMiddleHeight - actualTopHeight;


            //if (middleCount > 0)
            //{
            //var ax = remainingHeight * HeightRatio;
            //remainingHeight -= ax;
            //middleRequiredHeight = ax / middleCount;
            //}
            //else
            //    middleRequiredHeight= 0;

            //if (centerCount > 0)
            //{
            //var ax2 = remainingWidth * WidthRatio;
            //remainingWidth -= ax2;
            //centerRequiredWidth = ax2 / centerCount;
            //}
            //else
            //    centerRequiredWidth = 0;

            double individualWidth  = 0; //= remainingWidth / ((leftCount > 0 ? 1 : 0) + (rightCount > 0 ? 1 : 0) + (center2Count > 0 ? 1 : 0));
            double individualHeight = 0; //= remainingHeight / ((topCount > 0 ? 1 : 0) + (bottomCount > 0 ? 1 : 0) + (middle2Count > 0 ? 1 : 0));


            //if (leftCount > 0)
            //{
            //    remainingWidth -= individualWidth;
            //    leftRequiredWidth = individualWidth / leftCount;
            //    leftRegionWidth = individualWidth;
            //}
            //if (rightCount > 0)
            //{
            //    remainingWidth -= individualWidth;
            //    rightRequiredWidth = individualWidth / rightCount;
            //    rightRegionWidth = individualWidth;
            //}
            //if (center2Count > 0)
            //{
            //    remainingWidth -= individualWidth;
            //    centerRequiredWidth = individualWidth / center2Count;
            //    centerRegionWidth = individualWidth;
            //}
            //if (topCount > 0)
            //{
            //    remainingHeight -= individualHeight;
            //    topRequiredHeight = individualHeight / topCount;
            //    topRegionHeight = individualHeight;
            //}
            //if (bottomCount > 0)
            //{
            //    remainingHeight -= individualHeight;
            //    bottomRequiredHeight = individualHeight / bottomCount;
            //    bottomRegionHeight = individualHeight;
            //}
            //if (middle2Count > 0)
            //{
            //    remainingHeight -= individualHeight;
            //    middleRequiredHeight = individualHeight / middle2Count;
            //    middleRegionHeight = individualHeight;
            //}



            double finalWidth;

            if (individualWidth != double.PositiveInfinity)
            {
                finalWidth = availableSize.Width;
            }
            else
            {
                finalWidth = availableSize.Width - remainingWidth;
            }

            double finalHeight;

            if (individualHeight != double.PositiveInfinity)
            {
                finalHeight = availableSize.Height;
            }
            else
            {
                finalHeight = availableSize.Height - remainingHeight;
            }


            return(new Size(finalWidth, finalHeight));
        }
Ejemplo n.º 21
0
        public void updateFiles(Packet p)
        {
            filesListView.safeInvoke(() =>
            {
                filesListView.Items.Clear();

                for (int i = 0; i < p.Data.Length; i++)
                {
                    string s = Encoding.Unicode.GetString(p.Data[i]);

                    if (s.StartsWith("-"))
                    {
                        filesListView.Items.Add(new ListViewItem(new string[] { s.Substring(1) })
                        {
                            ImageIndex = 1
                        });
                    }
                    else if (s.StartsWith("_"))
                    {
                        long size = Convert.ToInt64(Encoding.Unicode.GetString(p.Data[i + 1]));
                        filesListView.Items.Add(new ListViewItem(new string[] { s.Substring(1), Sizer.convertSize(size) })
                        {
                            ImageIndex = 2, Tag = size
                        });
                        i++;
                    }
                }
            });
        }
Ejemplo n.º 22
0
        public void updateRootDrives(Packet p)
        {
            locationTextBox.safeInvoke(() =>
            {
                locationTextBox.Clear();
            });

            filesListView.safeInvoke(() =>
            {
                filesListView.Items.Clear();

                for (int i = 0; i < p.Data.Length; i += 2)
                {
                    filesListView.Items.Add(new ListViewItem(new string[] { Encoding.Unicode.GetString(p.Data[i]), Sizer.convertSize(Encoding.Unicode.GetString(p.Data[i + 1])) })
                    {
                        ImageIndex = 0
                    });
                }
            });
        }
Ejemplo n.º 23
0
 public UpdateChangelog()
 {
     InitializeComponent();
     this.TitleBar_LeftCorner.SendToBack();
     Sizer.Hide();
 }
Ejemplo n.º 24
0
 private void DecodeData_Load(object sender, EventArgs e)
 {
     Sizer.Start();
     Data.Text = Properties.Settings.Default.D;
 }