private void DesignerListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ViewModelDesignEditor vm = DataContext as ViewModelDesignEditor;

            if (e.AddedItems.Count > 0)
            {
                binderClass cls = e.AddedItems[0] as binderClass;
                vm.Apply(cls);
            }
        }
Example #2
0
        public void AddImage(ushort[] imagedata, int width, int height, string name, int dbID)
        {
            byte[] colorImage;

            ConvertToColor(imagedata, out colorImage, width, height);

            WriteableBitmap bmap = BitmapFactory.New(width, height);

            Int32Rect rect = new Int32Rect(0, 0, width, height);

            bmap.Lock();
            bmap.WritePixels(rect, colorImage, width * 4, 0);
            bmap.Unlock();

            binderClass bc = new binderClass();

            bc.imageData = new ushort[imagedata.Length];
            Buffer.BlockCopy(imagedata, 0, bc.imageData, 0, imagedata.Length * 2);
            bc.imageBitmap = bmap;
            bc.displayName = name;
            bc.databaseID  = dbID;

            myList.Add(bc);
        }