示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SwitchExcludeArchiveFilenameCollection"/> class.
 /// </summary>
 /// <param name="initial">The initial.</param>
 /// <param name="additional">The additional.</param>
 public SwitchExcludeArchiveFilenameCollection(
     SwitchExcludeArchiveFilename initial,
     params SwitchExcludeArchiveFilename[] additional)
 {
     Switches.Add(initial);
     Switches.AddRange(additional);
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SwitchVolumeCollection"/> class.
 /// </summary>
 /// <param name="initial">The initial.</param>
 /// <param name="additional">The additional.</param>
 public SwitchVolumeCollection(SwitchVolume initial, params SwitchVolume[] additional)
 {
     Switches.Add(initial);
     Switches.AddRange(additional);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SwitchSetHashFunctionCollection"/> class.
 /// </summary>
 /// <param name="initial">The initial.</param>
 /// <param name="additional">The additional.</param>
 public SwitchSetHashFunctionCollection(SwitchSetHashFunction initial, params SwitchSetHashFunction[] additional)
 {
     Switches.Add(initial);
     Switches.AddRange(additional);
 }
        /// <summary>
        /// Updates the machine configuration collections. Switches, lamps, coils etc.
        /// </summary>
        private void UpdateMachineConfigCollections()
        {
            Log("Updating UI Collections");

            //Add only the switches not containing dedicated and flipper
            if (MachineConfig.PRSwitches != null)
            {
                Log("Adding dedicated switches");

                //Quick hack for PDB switches. Need to put the 64-127 range of switch into the dedicated collection...
                if (MachineConfig.GetMachineType() == MachineType.PDB)
                {
                    var lowRange = MachineConfig.PRSwitches.Where(x => x.Number.Contains("SD") &&
                                                                  Convert.ToByte(x.Number.Replace("SD", "")) < 64);
                    var hiRange = MachineConfig.PRSwitches.Where(x => x.Number.Contains("SD") &&
                                                                 (Convert.ToByte(x.Number.Replace("SD", "")) < 128 && Convert.ToByte(x.Number.Replace("SD", "")) > 63));

                    Switches.AddRange(lowRange.Select(x => new SwitchViewModel(x)));
                    DedicatedSwitches.AddRange(hiRange.Select(x => new SwitchViewModel(x)));
                }
                else
                {
                    DedicatedSwitches.AddRange(MachineConfig.PRSwitches
                                               .Where(x => x.Number.Contains("SD"))
                                               .Select(x => new SwitchViewModel(x)).OrderBy(x => x.Number));

                    Log("Adding switches");
                    Switches.AddRange(MachineConfig.PRSwitches
                                      .Where(x => !x.Number.Contains("F") & !x.Number.Contains("SD"))
                                      .Select(x => new SwitchViewModel(x)).OrderBy(x => x.Number));
                }

                Log("Adding flipper switches");
                FlippersSwitches.AddRange(MachineConfig.PRSwitches
                                          .Where(x => x.Number.Contains("SF"))
                                          .Select(x => new SwitchViewModel(x)).OrderBy(x => x.Number));
            }
            else
            {
                Log("PRSwitches doesn't exist");
            }

            if (MachineConfig.PRCoils != null)
            {
                Coils.AddRange(MachineConfig.PRCoils.Select(x => new SolenoidFlasherViewModel(x)).OrderBy(x => x.Number));
            }
            else
            {
                Log("PRCoils doesn't exist");
            }

            if (MachineConfig.PRLamps != null)
            {
                Lamps.AddRange(MachineConfig.PRLamps.Select(x => new LampViewModel(x)).OrderBy(x => x.Number));
            }
            else
            {
                Log("PRLamps doesn't exist");
            }

            if (MachineConfig.PRLeds != null)
            {
                PRLeds.AddRange(MachineConfig.PRLeds.Select(x => new LampViewModel(x)));//.OrderBy(x => x.Number.Replace("A8-", "")));
            }
            else
            {
                Log("PRLeds doesn't exist");
            }
        }