예제 #1
0
        public override string GetHTML(int deep = 0)
        {
            if (autofocus)
            {
                SetAttribute("autofocus", null);
            }

            if (disabled)
            {
                SetAttribute("disabled", null);
            }

            if (multiple)
            {
                SetAttribute("multiple", null);
            }

            if (required)
            {
                SetAttribute("required", null);
            }

            if (size > 0)
            {
                SetAttribute("size", size);
            }

            Childs.Clear();
            Childs.AddRange(Options);

            return(base.GetHTML(deep));
        }
예제 #2
0
 public void AddProperties(IEnumerable <NodeViewModel> properties)
 {
     foreach (var property in properties)
     {
         Childs.ElementAt(0).Childs.Add(property);
     }
 }
예제 #3
0
        /// ///////////////////////////////////////
        public override bool AddChild(I2iObjetGraphique child)
        {
            if (child is C2iWndDataGridColumn)
            {
                return(base.AddChild(child));
            }
            else
            {
                C2iWnd wnd = child as C2iWnd;
                if (wnd != null)
                {
                    if (wnd is IWndIncluableDansDataGrid)
                    {
                        wnd.AutoBackColor = false;
                        C2iWndDataGridColumn col = new C2iWndDataGridColumn();
                        col.Text = "col " + (Childs.Count() + 1);

                        col.Control = wnd;
                        base.AddChild(col);
                        col.ForeColor = DefaultColumnHeaderForeColor;
                        col.BackColor = DefaultColumnHeaderBackColor;
                        col.Parent    = this;
                        return(true);
                    }
                }
            }
            return(false);
        }
예제 #4
0
 public void Offset(float dx, float dy)
 {
     foreach (var f in Childs.OfType <IMoveable>())
     {
         f.Offset(dx, dy);
     }
 }
예제 #5
0
        public Color4VM(string Name, Color4 Color) : base(Name, true)
        {
            var red   = new JMXAttribute("Red", Color.Red);
            var green = new JMXAttribute("Green", Color.Green);
            var blue  = new JMXAttribute("Blue", Color.Blue);

            // Add nodes
            Childs.Add(red);
            Childs.Add(green);
            Childs.Add(blue);
            Childs.Add(new JMXAttribute("Alpha", Color.Alpha));
            // Add handlers to update color brush
            void OnColorChange(object s, PropertyChangedEventArgs e)
            {
                DemoBrush = new SolidColorBrush(new Color()
                {
                    R = (byte)((float)red.Value * 255),
                    G = (byte)((float)green.Value * 255),
                    B = (byte)((float)blue.Value * 255),
                    A = 255
                });
                ;
                OnPropertyChanged(nameof(DemoBrush));
            };
            red.PropertyChanged   += OnColorChange;
            green.PropertyChanged += OnColorChange;
            blue.PropertyChanged  += OnColorChange;
            // Update it
            OnColorChange(null, null);
        }
 public ADLElement this[string key]
 {
     get
     {
         return(Childs.FirstOrDefault(row => row.Name == key));
     }
 }
예제 #7
0
 public void Insert(LPOperator op)
 {
     op.Parent   = this;
     op.Function = Function;
     op.Module   = Module;
     Childs.Add(op);
 }
예제 #8
0
        public TemplateNodeInfo CloneNotSavedTree(
            Dictionary <TemplateNodeInfo, TemplateNodeInfo> originalsAndClones,
            ConnectionData connectionData,
            TemplateNodeInfo parent = null
            )
        {
            TemplateNodeInfo clone = (TemplateNodeInfo)MemberwiseClone();

            clone._templateNodeId = null;
            clone.Parent          = parent;
            clone.Connection      = connectionData;
            clone.Childs          = new List <TemplateNodeInfo>(
                Childs.Select(
                    ch => ch.CloneNotSavedTree(
                        originalsAndClones,
                        connectionData,
                        clone
                        )
                    )
                );

            originalsAndClones.Add(this, clone);

            return(clone);
        }
예제 #9
0
        public void UpdateChildren(NodeUpdatingSource mode, CancellationTokenSource cancellationSource)
        {
            if (IsDisabled)
            {
                mode = NodeUpdatingSource.LocallyOnly;
            }

            Debug.Assert(this.IsInstance);

            IStorageManager vault   = this._model.GetVaultProcessor(Connection.ConnectionGroup);
            bool            updated = false;

            if (mode == NodeUpdatingSource.FromServerIfNotSavedLocally || mode == NodeUpdatingSource.LocallyOnly)
            {
                updated = vault.CurrentStorage.NodeInstances.TryLoadChildren(this);
            }

            if (updated || mode == NodeUpdatingSource.LocallyOnly)
            {
                return;
            }

            Childs.Clear();
            Childs.AddRange(InstantiateStaticNodes(this.Template.Childs, Connection, this));

            vault.CurrentStorage.NodeInstances.SaveChildren(this);

            if (MayHaveDynamicChildren && Connection.IsLiveConnection)
            {
                UpdateDynamicChildren(cancellationSource.Token);
            }
        }
예제 #10
0
 public ModDataSetVM(string Name, ModDataSet DataSet) : base(Name, true)
 {
     // Add new format
     m_SupportedFormats.Add(typeof(IModData), (s, e) => {
         e.Childs.Add(new ModDataVM("[" + e.Childs.Count + "]",
                                    JMXAbstract.GetTypes(
                                        typeof(ModDataMtrl),
                                        typeof(ModDataTexAni),
                                        typeof(ModDataMultiTex),
                                        typeof(ModDataMultiTexRev),
                                        typeof(ModDataParticle),
                                        typeof(ModDataEnvMap),
                                        typeof(ModDataBumpEnv),
                                        typeof(ModDataSound),
                                        typeof(ModDataDyVertex),
                                        typeof(ModDataDyJoint),
                                        typeof(ModDataDyLattice),
                                        typeof(ModDataProgEquipPow)),
                                    e.Obj?.GetType(), e.Obj));
     });
     // Create nodes
     Childs.Add(new JMXAttribute("Type", DataSet.Type));
     Childs.Add(new JMXOption("AnimationType", DataSet.AnimationType, JMXOption.GetValues <object>(typeof(PrimAnimationType))));
     Childs.Add(new JMXAttribute("Name", DataSet.Name));
     AddChildArray("ModsData", DataSet.ModData.ToArray(), true, true);
 }
예제 #11
0
        public FuncNode(string name, IList <MathFuncNode> args)
        {
            var lowercasename = name.ToLower();

            if (args.Count >= 2)
            {
                KnownFuncType functionType;
                if (KnownFunc.BinaryNamesFuncs.TryGetValue(lowercasename, out functionType))
                {
                    FunctionType = functionType;
                }
            }
            else if (args.Count == 1)
            {
                KnownFuncType functionType;
                if (KnownFunc.UnaryNamesFuncs.TryGetValue(lowercasename, out functionType))
                {
                    FunctionType = functionType;
                }
                else if (KnownFunc.BinaryNamesFuncs.TryGetValue(lowercasename, out functionType))
                {
                    FunctionType = functionType;
                }
            }
            Name = lowercasename;
            foreach (var arg in args)
            {
                Childs.Add(arg);
            }
            if (FunctionType == KnownFuncType.Sqrt)
            {
                FunctionType = KnownFuncType.Pow;
                Childs.Add(new ValueNode(new Rational <long>(1, 2)));
            }
        }
예제 #12
0
        /// <summary>
        /// This Methods is used to Generate the complete tree
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        public ObjectTreeItem CreateTree(ObjectTreeItem root = null)
        {
            //if (treeItem == null)
            //{
            //    return null;
            //}

            if (root == null)
            {
                root = this;
            }

            foreach (var child in CreateChildLayer())
            {
                if (child == null)
                {
                    throw new NullReferenceException();
                }

                Childs.Add(child);

                if (ReferenceEquals(child.Item, root.Item))
                {
                    root.RecursionObjectTreeItems.Add(child);
                }
                else
                {
                    child.CreateTree(root);
                }
            }

            return(root);
        }
예제 #13
0
        /// <summary>
        /// Child <see cref="IPanel.Closed"/> event handler.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event params.</param>
        private void OnChildClose(object sender, EventArgs e)
        {
            var panel = sender as IPanel;

            if (Childs.Contains(panel))
            {
                int panelIndex = Childs.IndexOf(panel);
                Childs.Remove(panel);

                if (Active == panel && Childs.Count > 0)
                {
                    // Todo: Make this configurable - after child panel is closed, make next OR prev child panel active.
                    int newActiveIndex = panelIndex < Childs.Count
                                                                ? panelIndex
                                                                : Childs.Count - 1;
                    Active = Childs[newActiveIndex];
                }
            }

            if (Childs.Count == 0 && !isClosing)
            {
                active = null;
                RequestClose();
            }
        }
예제 #14
0
        /// <summary>
        /// Add a (projected) Field
        /// </summary>
        /// <returns>Fluent <see cref="ProjectedFields"/></returns>
        public ProjectedFields AddField(string name, string type, string list, string showField)
        {
            var field = new ProjectedField(name, type, list, showField);

            Childs.Add(field);
            return(this);
        }
예제 #15
0
        /// <summary>
        /// Add a RowLimit to this View
        /// </summary>
        /// <param name="rowLimit"></param>
        /// <returns></returns>
        public View RowLimit(int rowLimit)
        {
            var child = new RowLimit(rowLimit);

            Childs.Add(child);
            return(this);
        }
예제 #16
0
        public override string GetHTML(int deep = 0)
        {
            if (string.IsNullOrEmpty(Select.Id_DOM))
            {
                if (!string.IsNullOrEmpty(Select.Name))
                {
                    Select.Id_DOM = Select.Name;
                }
                else
                {
                    Select.Id_DOM   = Guid.NewGuid().ToString().Replace("-", "");
                    Select.Name_DOM = Select.Id_DOM;
                }
            }
            Childs.Clear();
            if (!(LabelSelectMenu is null))
            {
                LabelSelectMenu.@for = Select.Id_DOM;
                Childs.Add(LabelSelectMenu);
            }
            if (!(SizeSelect is null))
            {
                Select.AddCSS("form-control-" + SizeSelect?.ToString("g"));
            }

            if (isCustomBootstrapSelect)
            {
                Select.AddCSS("custom-select");
            }

            Childs.Add(Select);

            return(base.GetHTML(deep));
        }
예제 #17
0
        public override string GetHTML(int deep = 0)
        {
            /// <summary>
            /// Вложеные элементы могут быть только source
            /// </summary>
            Childs = Childs.Where(x => x is source).ToList();
            if (Childs.Count == 0)
            {
                SetAttribute("src", src);
            }

            if (autoplay)
            {
                SetAttribute("autoplay", "autoplay");
            }
            else
            {
                SetAttribute("preload", preload.ToString("g"));
            }

            if (controls)
            {
                SetAttribute("controls", "controls");
            }

            if (loop)
            {
                SetAttribute("loop", "loop");
            }

            return(base.GetHTML(deep));
        }
예제 #18
0
 /// <summary>
 /// Add a &lt;Where>-Tag
 /// </summary>
 /// <returns><see cref="Query"/></returns>
 public Query Where(Action <Where> action)
 {
     var where = new Where();
     action(where);
     Childs.Add(where);
     return(this);
 }
예제 #19
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("{");

            sb.AppendFormat("Id={0}", Id ?? string.Empty);
            if (Name != null)
            {
                sb.AppendFormat(", Name={0}", Name);
            }
            if (Parent != null)
            {
                sb.AppendFormat(", Parent={0}", Parent.Id);
            }
            if (Childs.Count != 0)
            {
                sb.AppendFormat(", Childs={0}", Childs.Select(x => x.Id).Sketch());
            }
            if (Countries.Count != 0)
            {
                sb.AppendFormat(", Countries={0}", Countries.Select(x => x.Id).Sketch());
            }
            if (RowVersion != null)
            {
                sb.AppendFormat(", RowVersion={0}", RowVersion.Sketch());
            }
            sb.Append("}"); return(sb.ToString());
        }
예제 #20
0
 public void RemoveDescendant(GroupInfo group)
 {
     if (group != null && Childs.Remove(group))
     {
         group.Parent = null;
     }
 }
예제 #21
0
        public ImageBuilder DefineImage(string image = null)
        {
            var builder = new ImageBuilder(this).AsImageName(image);

            Childs.Add(builder);
            return(builder);
        }
예제 #22
0
        public ContainerBuilder UseContainer()
        {
            var builder = new ContainerBuilder(this);

            Childs.Add(builder);
            return(builder);
        }
예제 #23
0
        public CompositeBuilder UseCompose()
        {
            var builder = new CompositeBuilder(this);

            Childs.Add(builder);
            return(builder);
        }
예제 #24
0
 public override string GetHTML(int deep = 0)
 {
     ////////////////////////////
     // Вложеные элементы не предусмотрены
     Childs.Clear();
     return(base.GetHTML(deep));
 }
        public override void OnEnter()
        {
            PriorityIndex.Clear();
            Children.Clear();
            Children.AddRange(Childs.ToArray());
            RandList.Clear();
            PriorityList = new List <int>();
            RepeatIntFieldDesigner repeatIntField = Node["Priority"].Field as RepeatIntFieldDesigner;
            List <int>             tempList       = repeatIntField.Value;

            if (Childs.Count == 1)
            {
                Status = DebugNodeStatus.Error;
                return;
            }

            if (tempList.Count != Childs.Count)
            {
                Status = DebugNodeStatus.Error;
                return;
            }

            PriorityList.AddRange(tempList.ToArray());

            RateSortChildren();
        }
예제 #26
0
파일: Node.cs 프로젝트: edotom/VisioTool
 public void AddNode <T>(T node) where T : INode
 {
     if (Childs != null)
     {
         Childs.Add(node);
     }
 }
예제 #27
0
        public VolumeBuilder UseVolume(string name = null)
        {
            var builder = new VolumeBuilder(this, name);

            Childs.Add(builder);
            return(builder);
        }
예제 #28
0
        public NetworkBuilder UseNetwork(string name = null)
        {
            var builder = new NetworkBuilder(this, name);

            Childs.Add(builder);
            return(builder);
        }
예제 #29
0
        public RemoteSshHostBuilder UseSsh(string ipAddress = null)
        {
            var builder = new RemoteSshHostBuilder(this, ipAddress);

            Childs.Add(builder);
            return(builder);
        }
예제 #30
0
        public override string GetHTML(int deep = 0)
        {
            AddCSS("form-group " + ClassInputGroup, true);

            if (!(LabelInput is null))
            {
                Childs.Add(LabelInput);
            }

            Childs.Add(Input);

            if (Input.required)
            {
                Childs.AddRange(GetValidationAlerts(Input.Name));
            }

            if (!string.IsNullOrEmpty(InputInfoFooter))
            {
                string input_info_id = Input.Name + "Help";
                using (small info_text = new small(InputInfoFooter)
                {
                    inline = true, Id_DOM = input_info_id
                })
                {
                    info_text.AddCSS("form-text text-muted", true);
                    Childs.Add(info_text);
                }
                Input.SetAttribute("aria-describedby", input_info_id);
            }
            return(base.GetHTML(deep));
        }
예제 #31
0
        static int Main(string[] args)
        {
            //Параметры соответствуют вводу в форму RawtoMGF
            //args[0] - имя Raw-файла
            //args[1] - имя MGF-файла
            //args[2] - minimal MZ
            //args[3] - maximal MZ
            //args[4] - minimal RT
            //args[5] - maximal RT
            //args[6] - minimal Charge
            //args[7] - maximal Charge
            //args[8] - number of top peaks
            //args[9] - CleanETD:yes / CleanETD:no
            //args[10] - Instrument:yes / Instrument:no
            //дополнительно (к версии 2.0.6)
            //args[11] - CheckSpectra:yes / CheckSpectra:no
            try{
                Console.ReadLine();
                //Thread.Sleep(30000);
                string InFileName = args[0];
                string OutFileName = args[1];
                double MinMZ = Convert.ToDouble(args[2]);
                double MaxMZ = Convert.ToDouble(args[3]);
                double MinRT = Convert.ToDouble(args[4]);
                double MaxRT = Convert.ToDouble(args[5]);
                int MinCharge = Convert.ToInt32(args[6]);
                int MaxCharge = Convert.ToInt32(args[7]);
                int MaxPeakNumber = Convert.ToInt32(args[8]);
                bool CleanETD = args[9].Contains("CleanETD:yes");
                bool MarkInstrtument = args[10].Contains("Instrument:yes");
                bool CheckSpectra = args[11].Contains("CheckSpectra:yes");
                bool RTApex = args[12].Contains("RTApex:yes");

                string[] Refs = {"@cid","@hcd","@etd","@ecd","FTMS","ITMS"};

                MSFileReader_XRawfile RawFile;
                int Spectra,LocalCount = 0;
                string Filter;
                MGFFile MGF;
                MGFSpectrum ms;
                Childs ch;
                ChildbyIntensity ci = new ChildbyIntensity();
                ChildbyMass cm  = new ChildbyMass();

                int ArraySize = 0;
                Object MassList, EmptyRef;
                Object Labels,Values;
                double temp=0.0;
                int Progress = 0;
                int MSCount = 0;
                int MSMSCount = 0;

                if (RTApex){
                    MSFileBox = new RawFileBox();
                    MSFileBox.LoadIndex(InFileName);
                    RawFileBox.RepProgress = RepProgress;
                    RawFile = MSFileBox.RawFile;
                }else{
                    RawFile = new MSFileReader_XRawfile();
                    RawFile.Open(InFileName);
                    RawFile.SetCurrentController(0, 1);
                }
                Spectra = 0;
                RawFile.GetNumSpectra(ref Spectra);
                if (Spectra == 0) {
                    throw new Exception("Cannot get spectra from the file "+InFileName+", File is invalid, broken or empty");
                }
                MGF = new MGFFile();
                for (int j=1 ; j<=Spectra ; j++){
                    Filter = null;
                    RawFile.GetFilterForScanNum(j, ref Filter);
                    if (Filter.IndexOf("ms2") == -1) {
                        MSCount++;
                        if (!CheckSpectra){
                            continue;
                        }else{
                            ArraySize = 0;
                            MassList = null;
                            EmptyRef=null;
                            temp=0.0;
                            try {
                                RawFile.GetMassListFromScanNum(ref j, null, 0, 0, 0, 0,
                                    ref temp, ref MassList, ref EmptyRef, ref ArraySize);
                                continue;
                            }catch{
                                Exception e = new Exception(string.Format("Scan #{0} cannot be loaded, probably RAW file is corrupted!",j));
                                throw e;
                            }
                        }
                    }
                    MSMSCount++;
                    ms = new MGFSpectrum();
                    //определяем родительскую массу, заряд и RT
                    Labels = null;
                    Values = null;
                    ArraySize = 0;
                    LocalCount++;
                    RawFile.GetTrailerExtraForScanNum(j, ref Labels, ref Values, ref ArraySize);
                    for (int k = 0 ; k < ArraySize ; k++ ){
                        if ((Labels as Array).GetValue(k).ToString().Contains("Mono")){
                            ms.mz = Convert.ToDouble((Values as Array).GetValue(k).ToString());
                        }
                        if ((Labels as Array).GetValue(k).ToString().Contains("Charge State")){
                            ms.Charge = Convert.ToInt32((Values as Array).GetValue(k).ToString());
                        }
                    }
                    //Если не нашли в labels - берем из фильтра
                    if (ms.mz == 0.0) {
                        string  part= Filter.Substring(0,Filter.IndexOf('@'));
                        ms.mz = Convert.ToDouble(part.Substring(part.LastIndexOf(' ')));
                    }
                    Labels = null;
                    Values = null;
                    ArraySize = 0;
                    double RT = 0;
                    RawFile.GetStatusLogForScanNum(j,ref RT, ref Labels, ref Values, ref ArraySize);

                    RawFile.RTFromScanNum(j,ref ms.RT);
                    ms.ScanNumber = j;
                    //Фильтры
                    if (ms.Charge < MinCharge) continue;
                    if (ms.Charge > MaxCharge) continue;
                    if (ms.RT < MinRT) continue;
                    if (MaxRT != 0.0 && ms.RT > MaxRT) continue;
                    if (ms.mz < MinMZ) continue;
                    if (MaxMZ != 0.0 && ms.mz > MaxMZ) continue;
                    //забираем сам спектр
                    MassList = null;
                    EmptyRef=null;
                    ArraySize = 0;
                    temp=0.0;
                    try{
                        if (Filter.IndexOf("FTMS") != -1){
                            //извлекаем FTMS данные
                            (RawFile as IXRawfile2).GetLabelData(ref MassList, ref EmptyRef, ref  j);
                            ArraySize = (MassList as Array).GetLength(1);
                            for (int k = 0 ; k<ArraySize ; k++ ){
                                ch = new Childs();
                                ch.Mass = (double)(MassList as Array).GetValue(0, k);
                                ch.Intensity = (double)(MassList as Array).GetValue(1, k);
                                ms.Data.Add(ch);
                            }
                        }else{
                            //извлекаем ITMS данные
                            RawFile.GetMassListFromScanNum(ref j, null, 0, 0, 0, 1, ref temp, ref MassList, ref EmptyRef, ref ArraySize);
                            ArraySize = (MassList as Array).GetLength(1);
                            for ( int k = 0 ; k<ArraySize ; k++){
                                ch = new Childs();
                                ch.Mass = (double)(MassList as Array).GetValue(0, k);
                                ch.Intensity = (double)(MassList as Array).GetValue(1, k);
                                ms.Data.Add(ch);
                            }
                        }
                    }catch{
                        Exception e = new Exception(string.Format("Scan #{0} cannot be loaded, probably RAW file is corrupted!",j));
                        throw e;
                    }
                    if (RTApex){
                        ms.RTApex = CheckRTApex(ms.RT, ms.mz);
                    }

                    if (MarkInstrtument){
                        if (Filter.Contains("ecd") || Filter.Contains("etd")){
                                ms.Instrument = "ETD-TRAP";
                            }else{
                                ms.Instrument= "ESI-FTICR";
                            }
                        }
                    //очистить ETD если был такой запрос
                    if ( CleanETD ){
                        if (Filter.Contains("ecd") || Filter.Contains("etd")){
                            FilterETD(ref ms,  Filter.Contains("FTMS"));
                        }
                    }
                    //сбросить лишние сигналы
                    if (MaxPeakNumber > 0 && ms.Data.Count > MaxPeakNumber){
                        ms.Data.Sort(ci);
                        ms.Data.RemoveRange(0,ms.Data.Count-MaxPeakNumber);
                        ms.Data.Sort(cm);
                    }
                    //сформировать TITLE
                    if (RTApex){
                        ms.Title = String.Format("Elution from: {0:f4} to {0:f4} RT Apex: {1:f2} FinneganScanNumber: {2}",
                            ms.RT, ms.RTApex, ms.ScanNumber);
                    }else{
                        ms.Title = String.Format("Elution from: {0:f4} to {0:f4} FinneganScanNumber: {1}",
                            ms.RT,ms.ScanNumber);
                    }
                    MGF.Spectra.Add(ms);
                    // рапортовать прогресс
                    GC.Collect(2);

                    if ((int)(((double)j/(double)Spectra)*100.0) > Progress){
                        Progress = (int)(((double)j/(double)Spectra)*100.0);
                        Console.WriteLine("{0}%... {1} {2}",Progress,MSCount,MSMSCount);
                    }

                    //backgroundWorker1.ReportProgress((int)(((double)LocalCount/(double)SpCount)*100.0));
                }
                MGF.MGFComments.Add(String.Format("Created by RawToMGF 2.1.3; Spectra obtained from {0}",InFileName));
                MGF.MGFComments.Add(String.Format("Filters: Parent m/z from {0} Th to {1} Th;",MinMZ,MaxMZ));
                MGF.MGFComments.Add(String.Format("         RT from {0} min. to {1} min.;",MinRT,MaxRT));
                MGF.MGFComments.Add(String.Format("         Charge state of parent ions minimum {0}, maximum {1};",MinCharge,MaxCharge));
                MGF.MGFComments.Add(String.Format("         Max number of peaks in MS/MS spectra - {0}",MaxPeakNumber));
                if ( CleanETD ) {
                    MGF.MGFComments.Add("         ETD spectra cleaned from precursors and neutral losses");
                }
                MGF.MGFWrite(OutFileName,true);
            }catch(Exception e){
                Console.Write("Error:");
                Console.Write(e.Message);
                Console.WriteLine("STACKINFO:"+e.StackTrace);
                //Console.ReadKey();
                return 1;
            }
            Console.WriteLine("Completed");
            Console.ReadLine();
            return 0;
        }