Пример #1
0
        private void Mask_Load_Click(object sender, EventArgs e)
        {
            ListSelectionDialog diag = new ListSelectionDialog();

            bool success = wgDB.GetAllMasks();

            if (success)
            {
                for (int i = 0; i < wgDB.m_maskList.Count(); i++)
                {
                    diag.AddItemToList(wgDB.m_maskList[i].Description, wgDB.m_maskList[i].MaskID);
                }

                diag.ShowDialog();

                if (diag.m_itemSelected)
                {
                    MaskContainer mask;
                    success = wgDB.GetMask(diag.m_databaseID, out mask);

                    if (success)
                    {
                        m_mask.SetupMaskFromContainer(mask);

                        //success = wgDB.GetReferenceImage(mask.ReferenceImageID, out m_refImage);

                        //if (success)
                        //{
                        //    if (m_colorModel.m_maxPixelValue != m_refImage.MaxPixelValue)
                        //    {
                        //        m_colorModel.SetMaxPixelValue(m_refImage.MaxPixelValue);
                        //        m_colorModel.BuildColorMap();
                        //    }

                        //    SetImage(m_refImage.ImageData, m_refImage.Width, m_refImage.Height);
                        //}

                        DrawMask();
                    }
                }
            }
        }
Пример #2
0
        void EditMask(MaskContainer mask)
        {
            //MessageBox.Show("not yet implemented","Edit Mask: " + mask.Description, MessageBoxButton.OK, MessageBoxImage.Error);

            MaskManager mm = new MaskManager();

            mm.Owner = Window.GetWindow(this);

            mm.m_mask.SetupMaskFromContainer(mask);

            if (mask.ReferenceImageID != 0)
            {
                mm.LoadReferenceImage(mask.ReferenceImageID);
            }

            mm.DrawMask();

            mm.ShowDialog();


            if (wgDB == null)
            {
                wgDB = new WaveguideDB();
            }

            MaskContainer mc;
            bool          success = wgDB.GetMask(mask.MaskID, out mc);

            if (success)
            {
                mask.Angle            = mc.Angle;
                mask.Cols             = mc.Cols;
                mask.Description      = mc.Description;
                mask.IsDefault        = mc.IsDefault;
                mask.MaskID           = mc.MaskID;
                mask.PlateTypeID      = mc.PlateTypeID;
                mask.ReferenceImageID = mc.ReferenceImageID;
                mask.Rows             = mc.Rows;
                mask.Shape            = mc.Shape;
                mask.XOffset          = mc.XOffset;
                mask.XSize            = mc.XSize;
                mask.XStep            = mc.XStep;
                mask.YOffset          = mc.YOffset;
                mask.YSize            = mc.YSize;
                mask.YStep            = mc.YStep;
            }
        }