示例#1
0
        public static void ShowScan(IList <MessageModel> list, MessageModel target)
        {
            if (list == null || list.Count == 0 || target == null)
            {
                return;
            }

            if (_current != null)
            {
                _current.Close();
            }

            ImageScanWindow scan = _current = new ImageScanWindow();

            scan.img.Source = null;
            scan._sources   = list;
            scan._target    = target;
            scan.ShowCurrent();
        }
示例#2
0
        public static void ShowScan(string imgPath)
        {
            if (imgPath != IMAssets.ImageDeal.DefaultHeadImage && !System.IO.File.Exists(imgPath))
            {
                return;
            }
            bool isCreate;

            if (_current != null)
            {
                _current.Close();
                _current = null;
            }
            ImageScanWindow scan = CreateOrActiveWindow(out isCreate);

            scan.rotate.Angle   = 0;
            scan.scale.ScaleX   = scan.scale.ScaleY = 1;
            scan.img.Visibility = Visibility.Visible;
            BitmapImage img = new BitmapImage(new Uri(imgPath, UriKind.RelativeOrAbsolute));

            SetProperty(imgPath, scan, img, false);

            if (isCreate)
            {
                scan.ShowCurrent(imgPath);
            }
            else
            {
                Task.Delay(50).ContinueWith(task =>
                {
                    scan.Dispatcher.Invoke(new Action(() =>
                    {
                        if (scan.WindowState == WindowState.Minimized)
                        {
                            scan.WindowState = WindowState.Normal;
                        }
                        scan.Activate();
                    }));
                });
            }
        }
示例#3
0
        public static void ShowScan(ImageSource img)
        {
            if (img == null)
            {
                return;
            }
            bool isCreate;

            ImageScanWindow scan = CreateOrActiveWindow(out isCreate);

            scan.rotate.Angle = 0;
            scan.scale.ScaleX = scan.scale.ScaleY = 1;

            scan.img.Visibility = Visibility.Visible;
            SetProperty(img.ToString(), scan, img, false);
            string imgPath = img.ToString().Contains("file:///") ? img.ToString().Remove(0, "file:///".Length) : img.ToString();

            if (isCreate)
            {
                scan.ShowCurrent(imgPath);
            }
            else
            {
                Task.Delay(50).ContinueWith(task =>
                {
                    scan.Dispatcher.Invoke(new Action(() =>
                    {
                        if (scan.WindowState == WindowState.Minimized)
                        {
                            scan.WindowState = WindowState.Normal;
                        }
                        scan.Activate();
                    }));
                });
            }
        }