Exemplo n.º 1
0
        private DataGridViewTextBoxCell GetContainerCell(ISpectraContainer container)
        {
            DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();

            cell.Value = container;
            return(cell);
        }
Exemplo n.º 2
0
        new public void RemoveAt(int id)
        {
            Binding binding = this[id];

            if (binding is ParameterBinding)
            {
                foreach (IParameter parameter in ((ParameterBinding)binding).Parameters)
                {
                    ParameterLocation pl           = _parent.GetParameterLocation(parameter);
                    ISpectraContainer container    = _parent.Containers[pl.docId];
                    IParameter        topParameter = null;
                    for (int specId = 0; specId < container.Spectra.Count; specId++)
                    {
                        pl.specId = specId;
                        IParameter p = _parent.GetParameter(pl);
                        p.Status &= ~ParameterStatus.Binding;
                        p.ReferencedParameter = topParameter;
                        if (specId == 0)
                        {
                            topParameter = p;
                        }
                    }
                }
            }
            binding.Dispose();
            base.RemoveAt(id);
        }
Exemplo n.º 3
0
        public SpectraContainerTabPage(ISpectraContainer container, ProjectForm projectForm)
            : base(container.Name)
        {
            this._container       = container;
            this.Name             = container.Name;
            this._projectForm     = projectForm;
            _groupsControl        = new TabControl();
            _groupsControl.Name   = "groupsControl";
            _groupsControl.Parent = this;
            _groupsControl.Dock   = DockStyle.Fill;
            int id = 0;

            foreach (IGroup group in container.Spectra[0].Parameters)
            {
                if (!projectForm.project.BindingsManager.Contains(container, group.Definition.name))
                {
                    GroupDefinition gd = group.Definition;
                    if ((gd.Type & GroupType.Hidden) != GroupType.Hidden)
                    {
                        //_groupsControl.TabPages.Add(new GroupTabPage(container.Spectra, gd, projectForm.statusStrip1, _groupsControl));
                        InsertGroupTabPage(gd.name, id++);
                    }
                }
            }
            //if (projectForm.project.BindingsManager.Contains(container))
            //    SortableGroupGrids = false;
        }
Exemplo n.º 4
0
 public SpectraDialog(ISpectraContainer spectraContainer) : this()
 {
     foreach (ISpectrum spectrum in spectraContainer.Spectra)
     {
         //spectraList.Items.Add(spectrum.Path);
         spectraList.Items.Add(spectrum);
     }
     button1.Enabled = spectraList.Items.Count > 0;
 }
Exemplo n.º 5
0
 public ListBoxParameterItem(IParameter parameter, IGroup group, ISpectraContainer container, ListBox parent, bool inBinding)
 {
     this.parameter = parameter;
     this.group     = group;
     this.container = container;
     //this.bkBrush = bkBrush;
     this.inBinding = false;
     this.parent    = parent;
     this.inBinding = inBinding;
 }
Exemplo n.º 6
0
 public IEnumerable <Binding> GetBindings(ISpectraContainer container)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this[i].ContainsContainer(container))
         {
             yield return(this[i]);
         }
     }
 }
Exemplo n.º 7
0
 public bool ContainsContainer(ISpectraContainer container)
 {
     for (int i = 0; i < this.Containers.Length; i++)
     {
         if (this.Containers[i] == container)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 8
0
 public bool ContainsBinding(ISpectraContainer container, string groupName)
 {
     for (int i = 0; i < Containers.Length; i++)
     {
         if (Containers[i] == container)
         {
             return(ContainsGroup(groupName));
         }
     }
     return(false);
 }
Exemplo n.º 9
0
        public virtual ISpectraContainer AddSpectraContainer(ISpectraContainer container)
        {
            Type sct = GetSpectraContainerType();

            if (container.GetType() != sct)
            {
                throw new ArgumentException(String.Format("Invalid spectra container class: {0}. Expecting {1}", container.GetType(), sct));
            }
            else
            {
                this._containers.Add(container);
                return(container);
            }
        }
Exemplo n.º 10
0
 public bool Contains(ISpectraContainer container)
 {
     for (int i = 0; i < Count; i++)
     {
         if (this[i] is GroupBinding)
         {
             if (((GroupBinding)this[i]).ContainsContainer(container))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 11
0
 new public void Add(Binding binding)
 {
     base.Add(binding);
     if (binding is ParameterBinding)
     {
         foreach (IParameter parameter in ((ParameterBinding)binding).Parameters)
         {
             ParameterLocation pl        = _parent.GetParameterLocation(parameter);
             ISpectraContainer container = _parent.Containers[pl.docId];
             foreach (IParameter p in container.GetParameters(parameter, true))
             {
                 p.Status = ((ParameterBinding)binding).Source.Status;
                 p.ReferencedParameter = ((ParameterBinding)binding).Source;
             }
         }
     }
 }
Exemplo n.º 12
0
 private void populateGroupNamesList()
 {
     listGroupNames.Items.Clear();
     btnOK.Enabled = false;
     if (listChosenDocs.Items.Count > 1)
     {
         bool              bindableGroup;
         int               i, j;
         string            groupName;
         ISpectraContainer container = (ISpectraContainer)listChosenDocs.Items[0];
         ISpectraContainer currentContainer;
         for (i = 0; i < container.Spectra[0].Parameters.GroupCount; i++)
         {
             groupName = container.Spectra[0].Parameters[i].Definition.name;
             if (((container.Spectra[0].Parameters[i].Definition.Type & GroupType.Hidden) == 0))
             {
                 if (!_project.BindingsManager.Contains(container, groupName))
                 {
                     bindableGroup = true;
                     for (j = 1; j < listChosenDocs.Items.Count; j++)
                     {
                         currentContainer = (ISpectraContainer)listChosenDocs.Items[j];
                         bindableGroup   &= currentContainer.Spectra[0].Parameters.ContainsGroup(groupName) &&
                                            !_project.BindingsManager.Contains(currentContainer, groupName);
                         if (bindableGroup)
                         {
                             bindableGroup &= currentContainer.Spectra[0].Parameters[groupName].Definition == container.Spectra[0].Parameters[groupName].Definition;
                         }
                     }
                     if (bindableGroup)
                     {
                         listGroupNames.Items.Add(groupName);
                     }
                 }
                 else if (this._binding != null)
                 {
                     if (this._binding.ContainsGroup(groupName))
                     {
                         listGroupNames.Items.Add(groupName, true);
                         btnOK.Enabled = true;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
 public virtual bool RemoveContainer(ISpectraContainer container)
 {
     return(this._containers.Remove(container));
 }
Exemplo n.º 14
0
 public AnhSpectrum(string path, ISpectraContainer container, int bufferStart)
     : base(path, container, bufferStart)
 {
 }
Exemplo n.º 15
0
 public AnhSpectrum(XmlReader spectrumReader, string root, ISpectraContainer container, int bufferStart)
     : base(spectrumReader, root, container, bufferStart)
 {
 }
Exemplo n.º 16
0
        private void checkedListBox1_Format(object sender, ListControlConvertEventArgs e)
        {
            ISpectraContainer container = (ISpectraContainer)e.ListItem;

            e.Value = String.Format("{0} ({1})", container.Name, container.Model.Name);
        }