public void Drive(int kmsPassed)
        {
            double fuelSpent = (FuelEfficiency / 100) * kmsPassed;

            Liters.BurnFuel(fuelSpent);
            Kms.Increment(kmsPassed);
        }
예제 #2
0
        protected void InitializeKMS()
        {
            log.Debug("Creating system key");
            NetworkInterface nic = null;

            foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
            {
                if (adapter.Name == "LAN-verbinding")
                {
                    nic = adapter;
                    break;
                }
            }

            if (nic != null)
            {
                IKey key = new IKeyImpl("system");
                if (key.KeyValueFromGuid(nic.Id))
                {
                    Kms.AddKey(key);
                }

                log.Debug("System key created");
                return;
            }

            log.Debug("System key not created");
        }
예제 #3
0
        public static void InsertParameters(string plaats, Kms Kms, KoopprijsVan KoopprijsVan, KoopprijsTot KoopprijsTot)
        {
            UITools.SendKeys((By.Id("autocomplete-input")), plaats);
            var kms          = UITools.GetEnumDescription(Kms);
            var koopprijsVan = UITools.GetEnumDescription(KoopprijsVan);
            var koopprijsTot = UITools.GetEnumDescription(KoopprijsTot);

            UITools.SelectFromDropdown(Driver.Instance.FindElement(By.Id("Straal")), kms);
            UITools.SelectFromDropdown(Driver.Instance.FindElement(By.Id("range-filter-selector-select-filter_koopprijsvan")), koopprijsVan);
            UITools.SelectFromDropdown(Driver.Instance.FindElement(By.Id("range-filter-selector-select-filter_koopprijstot")), koopprijsTot);
            UITools.ClickFirstElement((By.ClassName("button-primary-alternative")));
            Driver.Instance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(2));
        }
예제 #4
0
        public void DisplayPropertyAsLicenseStatus(IEnumerable <Control> controls, TextBox textBox)
        {
            Property = "LicenseStatus";
            if (!(Value is uint))
            {
                Hide(controls, textBox);
                textBox.Text = "N/A";
            }
            try
            {
                var licenseStatus       = (uint)Value;
                var licenseStatusString = LicenseMachine.LicenseStatusText(licenseStatus);

                switch (licenseStatus)
                {
                case 0:
                case 5:
                    textBox.Background = Brushes.OrangeRed;
                    break;

                case 1:
                    textBox.Background = Brushes.LightGreen;
                    break;

                default:
                    textBox.Background = Brushes.Yellow;
                    break;
                }

                Property = "LicenseStatusReason";

                if (Value != null)
                {
                    licenseStatusString += ": " + Kms.StatusMessage((uint)Value);
                }

                textBox.Text = licenseStatusString;
                Show(controls, textBox);
            }
            catch
            {
                Hide(controls, textBox);
                textBox.Text       = "N/A";
                textBox.Background = App.DefaultTextBoxBackground;
            }
        }
예제 #5
0
        public static void CheckKey(string key, string pkeyConfigFileName, out DigitalProductId2 id2, out DigitalProductId3 id3, out DigitalProductId4 id4)
        {
            var    osBuild = Environment.OSVersion.Version.Build;
            string ePidStart;

            if (osBuild >= 10000)
            {
                ePidStart = "03612";
            }
            else if (osBuild >= 9600)
            {
                ePidStart = "06401";
            }
            else if (osBuild >= 9200)
            {
                ePidStart = "05426";
            }
            else
            {
                ePidStart = "55041";
            }

            id3      = new DigitalProductId3();
            id4      = new DigitalProductId4();
            id3.size = DigitalProductId3.Size;
            id4.size = DigitalProductId4.Size;

            var hResult = PidGenX(key, pkeyConfigFileName, ePidStart, IntPtr.Zero, out id2, ref id3, ref id4);

            if (hResult != 0)
            {
                var innerException = (hResult & 0xffff0000) == 0x80070000 ? new Win32Exception(unchecked ((int)hResult)) : null;
                switch (hResult)
                {
                case 0x80070002:
                    throw new FileNotFoundException("pkeyconfig database file not found", pkeyConfigFileName, innerException);

                default:
                    throw new KmsException(Kms.StatusMessage(hResult), innerException);
                }
            }
        }
예제 #6
0
        private void llenarCaptions()
        {
            //Seteamos caption de los combustibles
            Combustibles.ChangeCaption(EMovilCombus.LitrosCmp, "V1Litros2N1");
            Combustibles.ChangeCaption(EMovilCombus.ImporteCmp, "V1Importe2S2");
            Combustibles.ChangeCaption(EMovilCombus.FechaCmp, "V1FechaFN1");
            Combustibles.ChangeCaption(EEstacion.DesCmp, "V1EstacionCN2");
            Combustibles.ChangeCaption(EMovilCombus.KilometrosCmp, "V1KMsNN2");

            ////Cambiar caption de equipamiento
            Equipamiento.ChangeCaption(EMovilEquip.CodequipCmp, "V1CCN1");
            Equipamiento.ChangeCaption("meq_des_Equip", "V1EquipamientoCN2");
            Equipamiento.ChangeCaption("deleted", "");

            //Seteamos caption de Km
            Kms.ChangeCaption(EMovilKms.FechaCmp, "V1FechaFN2");
            Kms.ChangeCaption(EMovilKms.KmCmp, "V1KilometrosNN2");

            //Seteamos caption de estados
            Estados.ChangeCaption(EMovilEstado.FechaCmp, "V1FechaFN2");
            Estados.ChangeCaption(EEstado.DesCmp, "V1EstadoCN2");
            Estados.ChangeCaption(EMovilEstado.KmCmp, "V1KmsCN2");
            Estados.ChangeCaption(EMovilEstado.CodestadoCmp, "V1CCN1");
        }
예제 #7
0
 IKey IConfiguration.GetKeyById(string id)
 {
     return(Kms != null
         ? Kms.GetKeyById(id)
         : null);
 }