示例#1
0
        private void Plate_Unowned(object sender, EventArgs e)
        {
            Plate plate = (Plate)sender;

            if (plate == RedPlate)
            {
                OnRedUnowned(EventArgs.Empty);
            }
            else
            {
                OnBlueUnowned(EventArgs.Empty);
            }
        }
示例#2
0
 public Scale(ScaleSettings scaleSettings)
 {
     FieldLeftAlliance           = scaleSettings.FieldLeftAlliance;
     LHSPlateAsAllianceFieldLeft = new Plate(scaleSettings.LHSAlliance(FieldLeftAlliance), false); //TODO: Get it in real time
     RHSPlateAsAllianceFieldLeft = new Plate(scaleSettings.RHSAlliance(FieldLeftAlliance), false); //TODO: Get it in real time
     httpClient             = new HttpClient();
     httpClient.BaseAddress = new Uri($"http://{scaleSettings.IP.ToString()}:80/");
     httpClient.DefaultRequestHeaders.Accept.Clear();
     httpClient.DefaultRequestHeaders.Accept.Add(
         new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
     LHSPlateAsAllianceFieldLeft.Owned   += Plate_Owned;
     RHSPlateAsAllianceFieldLeft.Owned   += Plate_Owned;
     LHSPlateAsAllianceFieldLeft.Unowned += Plate_Unowned;
     RHSPlateAsAllianceFieldLeft.Unowned += Plate_Unowned;
 }
示例#3
0
 public Switch(SwitchSettings switchSettings)
 {
     Alliance               = switchSettings.Alliance;
     LHSPlate               = new Plate(switchSettings.LHSAlliance, false); // TODO: Read current state
     RHSPlate               = new Plate(switchSettings.RHSAlliance, false); // TODO: Read current state
     httpClient             = new HttpClient();
     httpClient.BaseAddress = new Uri($"http://{switchSettings.IP.ToString()}:80/");
     httpClient.DefaultRequestHeaders.Accept.Clear();
     httpClient.DefaultRequestHeaders.Accept.Add(
         new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
     LHSPlate.Owned   += Plate_Owned;
     RHSPlate.Owned   += Plate_Owned;
     LHSPlate.Unowned += Plate_Unowned;
     RHSPlate.Unowned += Plate_Unowned;
 }
示例#4
0
        private void Plate_Unowned(object sender, EventArgs e)
        {
            Plate plate = (Plate)sender;

            if (LHSPlate == plate && LHSPlate.Alliance == Alliance)
            {
                if (IsOwned)
                {
                    OnUnowned(EventArgs.Empty);
                }
            }
            if (RHSPlate == plate && RHSPlate.Alliance == Alliance)
            {
                if (IsOwned)
                {
                    OnUnowned(EventArgs.Empty);
                }
            }
        }