Пример #1
0
 public SplitChannelSettings(Image previewControl, Image tooltipControl, CheckBox invertCheckbox, Button saveButton, ImagePicker imagePicker, EChannel targetChannel)
 {
     this.previewControl = previewControl;
     this.tooltipControl = tooltipControl;
     this.invertCheckbox = invertCheckbox;
     this.saveButton     = saveButton;
     this.targetChannel  = targetChannel;
     this.imagePicker    = imagePicker;
 }
Пример #2
0
        public Canvas BarCode128(string code)
        {
            //var b = new BarcodeLib.Barcode(code, BarcodeLib.TYPE.CODE128);
            BarcodeLib.Barcode b = new BarcodeLib.Barcode(code, BarcodeLib.TYPE.CODE128);
            b.Alignment    = AlignmentPositions.CENTER;
            b.IncludeLabel = false;
            b.Height       = 75;
            b.Width        = 350;
            //b.BarWidth = 1000;
            while (true)
            {
                try
                {
                    b.Encode(BarcodeLib.TYPE.CODE128, code);
                    break;
                }
                catch (Exception)
                {
                    b.Width += 5;
                }
            }

            MemoryStream ms = new MemoryStream();

            b.SaveImage(ms, SaveTypes.BMP);             // GIF

            BitmapImage imageSource = new BitmapImage();

            imageSource.BeginInit();
            imageSource.StreamSource = ms;
            imageSource.EndInit();
            Image image = new System.Windows.Controls.Image();

            image.HorizontalAlignment = HorizontalAlignment.Stretch;
            image.Source = imageSource;
            image.Width  = 250;
            Canvas canvas = new Canvas()
            {
                Height = 60, HorizontalAlignment = HorizontalAlignment.Center,
            };

            canvas.Margin = new System.Windows.Thickness(0, 0, 0, 0);
            canvas.Children.Add(image);
            canvas.Width = 250;

            return(canvas);
        }
Пример #3
0
        private static async void OnSourceChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var inlineImage = (InlineImage)sender;
            var bitmapImage = await WpfFactory.LoadBitmapAsync(inlineImage.Source);

            if (bitmapImage == null)
            {
                inlineImage.Height  = new FigureLength(0);
                inlineImage.Width   = new FigureLength(0);
                inlineImage.Margin  = new Thickness(0);
                inlineImage.Padding = new Thickness(0);
                return;
            }
            var setImage = new Action <object, EventArgs>((ob, ev) =>
            {
                var image = new System.Windows.Controls.Image
                {
                    Source           = bitmapImage,
                    Stretch          = Stretch.Uniform,
                    StretchDirection = StretchDirection.Both,
                    Margin           = new Thickness(0),
                    MaxHeight        = inlineImage.Height.IsAuto ? bitmapImage.PixelHeight : inlineImage.Height.Value,
                    MaxWidth         = inlineImage.Width.IsAuto ? bitmapImage.PixelWidth : inlineImage.Width.Value,
                };

                inlineImage.Width = new FigureLength(image.MaxWidth, FigureUnitType.Pixel);
                inlineImage.Blocks.Clear();
                inlineImage.Blocks.Add(new BlockUIContainer {
                    Child = image, Padding = new Thickness(0), Margin = new Thickness(0),
                });
                inlineImage.ToolTip = inlineImage.ToolTip;
            });

            if (bitmapImage.IsDownloading)
            {
                bitmapImage.DownloadCompleted += (ob, ev) => setImage(ob, ev);
            }
            else
            {
                setImage(bitmapImage, EventArgs.Empty);
            }
        }
Пример #4
0
        /// <summary>
        /// 生成菜单
        /// </summary>
        /// <param name="menuInstanceKey">菜单关键字</param>
        /// <param name="hasShortCuts">是否具有快捷键</param>
        /// <param name="arguData">菜单参数 </param>
        /// <returns>菜单 不存在在返回空的list</returns>
        public static ObservableCollection <IIMenuItem> BulidCm(string menuInstanceKey, Boolean hasShortCuts,
                                                                object arguData)
        {
            if (hasShortCuts)
            {
                ServicesShortCuts.ClearRegisterLst();
            }
            var items   = new ObservableCollection <IIMenuItem>();
            var lstMenu = ServerInstanceRelation.GetInstanceRelationsByfatherId(menuInstanceKey, 0);

            if (lstMenu == null || lstMenu.Count == 0)
            {
                return(items);
            }

            foreach (var t in lstMenu)
            {
                if (t.FatherId == 0)
                {
                    if (t.Id >= MenuIdControlAssign.MenuFileGroupIdMin) //File
                    {
                        var menuItemFile = new MenuItemBase()
                        {
                            IsCheckable = false, IsEnabled = true, Id = t.Id, Visibility = Visibility.Visible
                        };

                        BulidChild(menuItemFile, menuInstanceKey, t.Id, hasShortCuts, arguData);

                        menuItemFile.Text    = t.Name;
                        menuItemFile.TextTmp = t.Name;
                        var textid = ImageSourceHelper.MySelf.GetTextById(t.Id);
                        if (!string.IsNullOrEmpty(textid))
                        {
                            menuItemFile.Text = textid;
                        }
                        if (menuItemFile.CmItems.Count > 0)
                        {
                            items.Add(menuItemFile);
                        }
                        else
                        {
                            menuItemFile = null;
                        }
                    }
                    else //末端 菜单 功能性部件
                    {
                        if (t.Id >= MenuIdControlAssign.MenuIdMin && t.Id <= MenuIdControlAssign.MenuIdMax)
                        {
                            //var eng = I36N.Services.I36N.ConvertByCoding( t.Id.ToString());
                            var menuItem = MenuComponentHolding.GetMenuItemById(t.Id);

                            if (menuItem != null) //末端 菜单 功能性部件
                            {
                                menuItem.InitDataWhenBeforeUse(arguData);
                                bool rwx = menuItem.IsCanBeShowRwx();
                                if (rwx == false)
                                {
                                    continue;
                                }

                                if (_imagesourcesss.ContainsKey(t.Id))
                                {
                                    menuItem.Image = _imagesourcesss[t.Id];
                                }
                                else
                                {
                                    var imagesource = //ImageSourceHelper.MySelf.GetImageSourceById(1001);
                                                      ImageSourceHelper.MySelf.GetImageSourceById(t.Id);
                                    if (imagesource != null)
                                    {
                                        var img = new System.Windows.Controls.Image
                                        {
                                            Source = imagesource
                                        };
                                        img.Stretch = Stretch.UniformToFill;
                                        img.Height  = ImageHeight;
                                        img.Width   = ImageHeight;


                                        if (!_imagesourcesss.ContainsKey(t.Id))
                                        {
                                            _imagesourcesss.Add(t.Id, img);
                                        }
                                        menuItem.Image = img;
                                    }
                                    var textid = ImageSourceHelper.MySelf.GetTextById(t.Id);
                                    if (!string.IsNullOrEmpty(textid))
                                    {
                                        menuItem.Text = textid;
                                    }
                                }


                                //if (!string.IsNullOrEmpty(eng) && !eng.Contains("issing")) //汉化内容
                                //{
                                //    menuItem.Text = eng;
                                //}


                                menuItem.Tag = "";
                                if (string.IsNullOrEmpty(menuItem.ExText))
                                {
                                    menuItem.TextTmp = menuItem.Text;
                                }
                                else
                                {
                                    menuItem.TextTmp = menuItem.Text + " - " + menuItem.ExText;
                                }
                                if (hasShortCuts)
                                {
                                    var shortcut = ServicesShortCuts.GetShortCutValue(t.Id);
                                    if (!string.IsNullOrEmpty(shortcut)) //注册快捷键
                                    {
                                        menuItem.ShortCuts = shortcut;
                                        ServicesShortCuts.AddRegisterMenuItem(menuItem, shortcut);
                                    }
                                }
                                items.Add(menuItem);
                            }
                        }
                    }
                }
            }
            return(items);
        }