internal void LoadControlData(DataImagePanel dataImagePanel)
 {
     listBox.Items.Clear();
     foreach (KeyValuePair<string, DataImage> imageEntry in NuzzoliloImageFiddler.Instance.OpenImages)
     {
         listBox.Items.Add(imageEntry.Key);
     }
 }
        private void SaveButton(DataImagePanel dataImagePanel)
        {
            if (NuzzoliloImageFiddler.Instance.OpenImages.ContainsKey(dataImagePanel.CurrentImage.Name))
                NuzzoliloImageFiddler.Instance.OpenImages[dataImagePanel.CurrentImage.Name] = dataImagePanel.CurrentImage;
            else
                NuzzoliloImageFiddler.Instance.OpenImages.Add(dataImagePanel.CurrentImage.Name, dataImagePanel.CurrentImage);

            Control c = dataImagePanel.Parent.Parent.Parent;
            if (c.GetType() == typeof(MonoControlContainer))
            {
                ((MonoControlContainer)c).monoControlPanel1.checkBoxEffectEnabled.Checked = false;
            }
            else
            {
                ResultControlContainer d = ((ResultControlContainer)c);
                d.imageOperatorDual.Result = null;
                d.RefreshDrawing();

            }

            LoadImage(dataImagePanel, dataImagePanel.CurrentImage); //Overwrite the working image with a copy

            CurrentControlChanged_Trigger();
        }
 private void LoadControlData(DataImagePanel dataImagePanel)
 {
     object c = dataImagePanel.Parent.Parent.Parent;
     if (c.GetType() == typeof(MonoControlContainer)) //Do not allow image loading if it is the result control
     {
         list.LoadControlData(dataImagePanel);
         list.buttonLoad.Enabled = true;
         if (dataImagePanel.CurrentImage != null)
             list.buttonSave.Enabled = true;
     }
     else
     {
         list.listBox.Items.Clear();
         list.LoadControlData(dataImagePanel);
         if (dataImagePanel.CurrentImage != null)
             list.buttonSave.Enabled = true;
     }
 }
        private void LoadImage(DataImagePanel imagePanel, DataImage image)
        {
            Control c = imagePanel.Parent.Parent.Parent;
            if (c.GetType() == typeof(MonoControlContainer))
            {
                //Ensure that operator is properly set up
                MonoImageOperator op = new MonoImageOperator();
                MonoControlContainer mono = (MonoControlContainer)c;
                mono.imageOperator = op;
                mono.monoControlPanel1.CurrentControl = new NormalizeControl();
                mono.imageOperator.ImageOperation = mono.monoControlPanel1.CurrentControl.UnderlyingWidget;
                op.Source = image;
                imagePanel.CurrentImage = op.Result;
            }

            //Set up result panel
            if (mono1.dataImagePanel1.CurrentImage != null && mono2.dataImagePanel1.CurrentImage != null)
            {
                if (result.mono.CurrentControl == null)
                {
                    result.mono.CurrentControl = new NormalizeControl();
                    result.imageOperatorMono.ImageOperation = result.mono.CurrentControl.UnderlyingWidget;
                }
                if (result.dual.CurrentControl == null)
                {
                    result.dual.CurrentControl = new DualSubtractionControl();
                    result.imageOperatorDual.ImageOperation = result.dual.CurrentControl.UnderlyingWidget;
                }

                this.result.imageOperatorDual.Source = mono1.dataImagePanel1.CurrentImage;
                this.result.imageOperatorDual.Source2 = mono2.dataImagePanel1.CurrentImage;
                this.result.imageOperatorMono.Source = this.result.imageOperatorDual.Result;
                this.result.dataImagePanel1.CurrentImage = this.result.imageOperatorDual.Result;
                this.result.dataImagePanel1.labelImage.Text = this.result.dataImagePanel1.CurrentImage.Name;
            }

            imagePanel.labelImage.Text = imagePanel.CurrentImage.Name;
            CurrentControlChanged_Trigger();
        }
 private void LoadButton(DataImagePanel panel)
 {
     LoadImage(panel, list.SelectedImage);
 }