Exemple #1
0
        protected Bus(string name, BusTypes busType, BusInfo.BusFlags flags)
        {
            Name    = name;
            BusType = busType;
            Flags   = flags;

            IsActive = (flags & BusInfo.BusFlags.DefaultActive) != 0;
        }
Exemple #2
0
 //constructor
 public SSD1603Controller(I2cDevice device, GpioPin pinReset = null)
 {
     this._busType  = BusTypes.I2C;
     this._i2cDevic = device;
     this._pinReset = pinReset;
     this.Empty();
     Debug.WriteLine(string.Format("SSD1603 controller on {0} created", this._busType));
 }
Exemple #3
0
 //constructor
 public SSD1603Controller(I2cDevice device, GpioPin pinReset = null)
 {
     _busType = BusTypes.I2C;
     _i2cDevic = device;
     _pinReset = pinReset;
     Empty();
     Debug.WriteLine(string.Format("SSD1603 controller on {0} created", _busType));
 }
Exemple #4
0
 public SSD1603Controller(SpiDevice device, GpioPin pinCmdData, GpioPin pinReset = null)
 {
     this._busType    = BusTypes.SPI;
     this._spiDevice  = device;
     this._pinCmdData = pinCmdData;
     this._pinReset   = pinReset;
     this.Empty();
     Debug.WriteLine(string.Format("SSD1603 controller on {0} created", this._busType));
 }
Exemple #5
0
 public SSD1603Controller(SpiDevice device, GpioPin pinCmdData, GpioPin pinReset = null)
 {
     _busType = BusTypes.SPI;
     _spiDevice = device;
     _pinCmdData = pinCmdData;
     _pinReset = pinReset;
     Empty();
     Debug.WriteLine(string.Format("SSD1603 controller on {0} created", _busType));
 }
Exemple #6
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="config"></param>
        private SSD1603(SSD1603Configuration config, BusTypes bus)
        {
            Configuration = config;
            BusType = bus;

            //for drawing
            _canvasDevice = CanvasDevice.GetSharedDevice();
            Render = new CanvasRenderTarget(_canvasDevice,  Screen.WidthInDIP, Screen.HeightInDIP, Screen.DPI,
                            Windows.Graphics.DirectX.DirectXPixelFormat.A8UIntNormalized, CanvasAlphaMode.Straight);
        }
Exemple #7
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="config"></param>
        private SSD1603(SSD1603Configuration config, BusTypes bus)
        {
            Configuration = config;
            BusType       = bus;

            //for drawing
            _canvasDevice = CanvasDevice.GetSharedDevice();
            Render        = new CanvasRenderTarget(_canvasDevice, Screen.WidthInDIP, Screen.HeightInDIP, Screen.DPI,
                                                   Windows.Graphics.DirectX.DirectXPixelFormat.A8UIntNormalized, CanvasAlphaMode.Straight);
        }
Exemple #8
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="config"></param>
        private SSD1603(SSD1603Configuration config, BusTypes bus)
        {
            this.Configuration = config;
            this.BusType       = bus;

            //for drawing
            this._canvasDevice = CanvasDevice.GetSharedDevice();
            this.Render        = new CanvasRenderTarget(this._canvasDevice, this.Screen.WidthInDIP, this.Screen.HeightInDIP, this.Screen.DPI,
                                                        Windows.Graphics.DirectX.DirectXPixelFormat.A8UIntNormalized, CanvasAlphaMode.Straight);

            this.SCREEN_HEIGHT_PAGES = (UInt32)this.Screen.HeightInPixel / 8;
        }
Exemple #9
0
        public void Test_For_Valid_AddNewBusTypes()
        {
            //Arrange
            BusTypes bus = new BusTypes()
            {
                BusType  = "AC",
                MaxSeats = 30
            };
            //Action
            var IsAdded = _services.AddNewBusTypes(bus);

            //Assert
            Assert.True(IsAdded);
        }
Exemple #10
0
        private void CleanUpBusLinesText(ref string line, ref string route, ref BusTypes type, int i, string str)
        {
            try
            {
                // Add a space between the eventual letter after the number (ex 5B)
                str = Regex.Replace(str.Trim(),
                                    "(?<=[0-9])(?=[A-Za-z])|(?<=[A-Za-z])(?=[0-9])",
                                    " ");

                var line_route = str.Split(' ')
                                 .ToList();

                // In case the number contains a letter connate it back to the number (ex 5B)
                if (line_route[2].Length == 1)
                {
                    line_route[1] += line_route[2];
                    line_route.RemoveAt(2);
                }

                line = $"{line_route[0]} {line_route[1]}";

                // When creating the route skip the first two items as they are the line number
                route = line_route.Skip(2)
                        .Aggregate((k, l) => $"{k} {l}");

                switch (i)
                {
                case 0:
                    type = BusTypes.Bus;
                    break;

                case 1:
                    type = BusTypes.Midibus;
                    break;

                case 2:
                    type = BusTypes.Trolleybus;
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException($"{nameof(CleanUpBusLinesText)} has thrown an error while cleaning up text for: {str}");
            }
        }
Exemple #11
0
 public EventBus(string name, int channelCount, BusTypes busType, BusInfo.BusFlags flags)
     : base(name, busType, flags)
 {
     MediaType    = MediaTypes.Event;
     ChannelCount = channelCount;
 }
Exemple #12
0
 public EventBus(string name, int channelCount, BusTypes busType)
     : this(name, channelCount, busType, BusInfo.BusFlags.DefaultActive)
 {
 }
Exemple #13
0
 public AudioBus(string name, SpeakerArrangement speakerArr, BusTypes busType, BusInfo.BusFlags flags)
     : base(name, busType, flags)
 {
     MediaType          = MediaTypes.Audio;
     SpeakerArrangement = speakerArr;
 }
Exemple #14
0
 public AudioBus(string name, SpeakerArrangement speakerArr, BusTypes busType)
     : this(name, speakerArr, busType, BusInfo.BusFlags.DefaultActive)
 {
 }
 public bool AddNewBusTypes(BusTypes bus)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
 public AudioBus(SpeakerArrangement speakerArr, string name, BusTypes busType, BusInfo.BusFlags flags)
     : base(name, busType, flags)
 {
     SpeakerArrangement = speakerArr;
 }
Exemple #17
0
 public AudioBus(SpeakerArrangement speakerArr, string name, BusTypes busType)
     : base(name, busType, BusInfo.BusFlags.DefaultActive)
 {
     SpeakerArrangement = speakerArr;
 }
Exemple #18
0
        static void Main(string[] args)
        {
            const int cPaymentMethods = 2; //Количество способов оплаты
            const int cBusTypes       = 3; //Количество типов автобусов
            const int cTariff         = 3; //Количество тарифов
            const int cNonCashMethods = 3; //Количество тарифов

            Console.WriteLine("Введите тип автобуса: ");
            for (int i = 1; i <= cBusTypes; i++)
            {
                Console.WriteLine($"{i}.{(BusTypes)i}");
            }
            int.TryParse(Console.ReadLine(), out int Choose);

            BusTypes bysType = (BusTypes)Choose;

            Console.WriteLine("Введите Тариф: ");
            for (int i = 1; i <= cTariff; i++)
            {
                Console.WriteLine($"{i}.{(Tariff)i}");
            }
            int.TryParse(Console.ReadLine(), out Choose);

            Tariff tariff = (Tariff)Choose;


            Console.WriteLine("Введите метод оплаты: ");
            for (int i = 1; i <= 2; i++)
            {
                Console.WriteLine($"{i}.{(PaymentMethods)i}");
            }
            int.TryParse(Console.ReadLine(), out Choose);

            PaymentMethods paymentMethod = (PaymentMethods)Choose;

            Tiket tiket = new Tiket()
            {
                Date        = DateTime.Now,
                TiketNumbet = Servise.GetRandomNumber(),
                Bus         = new BusClass()
                {
                    Id      = Servise.GetRandomNumber(),
                    BusPark = Servise.GetRandomPark(),
                    Type    = bysType
                },
                Tariff        = tariff,
                paymentMethod = PaymentMethods.CashMethod
            };

            switch ((int)paymentMethod)
            {
            case 1:
                tiket.paymentMethod = PaymentMethods.CashMethod;
                PayService.showTiket(tiket);
                break;

            case 2:
                Console.WriteLine("Введите вид безналичной оплаты: ");
                for (int i = 1; i <= cNonCashMethods; i++)
                {
                    Console.WriteLine($"{i}.{(NonCashMethods)i}");
                }
                int.TryParse(Console.ReadLine(), out Choose);

                NonCashMethods NonCashMethod = (NonCashMethods)Choose;

                tiket.paymentMethod = PaymentMethods.NonCashMethods;
                PayService.showTiket(tiket);
                Console.WriteLine("Было оплачено через: " + NonCashMethod);
                break;
            }
        }