示例#1
0
文件: MainVm.cs 项目: ki0ki0/WiFiMap
        public void OnNewProject(object param)
        {
            var openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Select image with the plan";
            openFileDialog.Filter = "Images|*.jpg;*.png" +
                                    "|All Files|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                var project       = new Project();
                var bitmapDecoder = BitmapDecoder.Create(new Uri(openFileDialog.FileName), BitmapCreateOptions.None,
                                                         BitmapCacheOption.Default);
                var bitmap = bitmapDecoder.Frames[0];
                project.Bitmap = ImageCoder.ImageToByte(bitmap);
                ScanVm.Project = project;
            }
        }