Exemple #1
0
    //initialize the static iPhone GSM
    static GSM()
    {
        DisplaySize iPhoneDisplaySize = new DisplaySize(1136, 640);
        Display     iPhoneDisplay     = new Display(32000, iPhoneDisplaySize);
        Battery     iPhoneBattery     = new Battery("Samsung", 24, 24, BatteryType.LiIon);

        iPhone4S = new GSM("4S", "Apple", 1000000, iPhoneDisplay, iPhoneBattery);
    }
Exemple #2
0
        private void Player_Load(object sender, EventArgs e)
        {
            CurrentInstance_StateChanged(null, EventArgs.Empty);

            DisplaySize defaultSize = ( DisplaySize )Enum.Parse(typeof(DisplaySize), Properties.Settings.Default.PlayerDisplaySize);

            this.SwitchToDisplaySize(DisplaySize.Original);
        }
        private void CreateNewDisplaySize([Bind(Include = "ProductDetailID")] ProductDetailModel productDetailModel, List <int> lstNewProductDetailID)
        {
            DisplaySize displaySize    = new DisplaySize();
            int         isDisplayImgID = GetDisplayImageKey(productDetailModel.ProductDetailID);

            foreach (var item in lstNewProductDetailID)
            {
                displaySize.ProductImageID = GetProductImageID(item, isDisplayImgID);
                displaySize.isDisplay      = false;
                _dbContext.DisplaySize.Add(displaySize);
                _dbContext.SaveChanges();
            }
        }
Exemple #4
0
        public string getItemSize(DisplaySize SizeType)
        {
            //Fetch amount of times to divide by from the SizeType declared
            int    IterationAmount = (int)SizeType; //Fetch the enum value by casting it into an int (To receive it's assigned number)
            double initialSize     = itemSize;

            for (int i = 1; i < IterationAmount; i++)
            {
                initialSize /= 1024;
            }

            string SizeExtension = (SizeType == DisplaySize.Kilobytes) ? "KB" : (SizeType == DisplaySize.Megabytes) ? "MB" : "GB";

            //Example return: 92.8MB
            return($"{initialSize.ToString("0.0")}{SizeExtension}");
        }
Exemple #5
0
 /// <summary>
 ///     Default constructor. Creates a new instance of the LCD driver.
 /// </summary>
 /// <param name="socket">"The MBN Board Socket that the Serial LCD is plugged into. </param>
 /// <param name="baudRate">The Baud Rate that the Serial LCD is set to mommunicate at.</param>
 /// <param name="parity">Parity, typically N or None.</param>
 /// <param name="dataBits">DataBits, typically 8.</param>
 /// <param name="stopBits">StopBits, typically 1.</param>
 /// <param name="size">Display size, either 2x16 or 4x20.</param>
 public SerialLCD(Hardware.Socket socket, Baud baudRate, Parity parity, int dataBits, StopBits stopBits, DisplaySize size)
 {
     try
     {
         Hardware.CheckPins(socket, socket.Tx);
         _serialLcd   = new SerialPort(socket.ComPort, (int)baudRate, parity, dataBits, stopBits);
         _displaySize = size;
         _serialLcd.Open();
         InitializeDisplay();
     }
     // Catch only the PinInUse exception, so that program will halt on other exceptions
     // Send it directly to caller
     catch (PinInUseException exception)
     {
         throw new PinInUseException(exception.Message);
     }
 }
        public MainPage()
        {
            // Connect to the SQL database and load the vessel settings table so that UI customizations can
            // be applied at program startup time.
            App.BuildDBTables.Directory    = ApplicationData.Current.LocalFolder.Path + @"\" + typeof(App).ToString();
            App.BuildDBTables.DatabaseName = "InfinityGroupVesselMonitoring";

            Task.Run(async() =>
            {
                await App.BuildDBTables.BuildVesselSettings();
                //await App.BuildDBTables.VesselSettingsTable.BeginEmpty();

                //App.VesselSettings.VesselName = "MV Infinity";
                //App.VesselSettings.FromEmailAddress = "";
                //App.VesselSettings.FromEmailPassword = "";
                //App.VesselSettings.ToEmailAddress = "*****@*****.**";
                //App.VesselSettings.SMTPServerName = "smtp-mail.outlook.com";
                //App.VesselSettings.SMTPPort = 587;
                //App.VesselSettings.SMTPEncryptionMethod = 2; // SmtpConnectType.ConnectSTARTTLS
                //App.VesselSettings.ThemeForegroundColor = Colors.White;
                //App.VesselSettings.ThemeBackgroundColor = Colors.Black;
                //await App.VesselSettings.BeginCommit();
            }).Wait();

            this.InitializeComponent();
            Size ds = DisplaySize.GetCurrentDisplaySize();

            const double titlebarHeight    = 70;
            const double pivotHeaderHeight = 68;

            Globals.ScreenSize            = new Size(ds.Width, ds.Height - titlebarHeight - pivotHeaderHeight);
            this.MainPageInnerGrid.Height = Globals.ScreenSize.Height;
            this.MainPageInnerGrid.Width  = Globals.ScreenSize.Width;

            DispatcherHelper.Initialize();

            // Track all unhandled exceptions
            TaskScheduler.UnobservedTaskException  += TaskScheduler_UnobservedTaskException;
            Application.Current.UnhandledException += ApplicationUnhandledException;

            Telemetry.TrackEvent("Application Started");

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
        }
Exemple #7
0
        /// <summary>
        /// Updates the states of the Presence field
        /// </summary>
        private void UpdatePresenceIndicatorSize()
        {
            PhotoDisplayMode mode;
            int height;

            if (this.presenceIndicatorSize <= 0)
            {
                mode   = PhotoDisplayMode.Hidden;
                height = 21;
            }
            else if (this.presenceIndicatorSize == 1)
            {
                mode   = PhotoDisplayMode.Small;
                height = 36;
            }
            else
            {
                mode   = PhotoDisplayMode.Large;
                height = 52;
            }

            this.lyncCommunicationControl.PhotoDisplayMode = mode;
            switch (this.addInControlContext)
            {
            case AddInControlContext.TaskPage:
                this.lyncCommunicationControl.LayoutRoot.HorizontalAlignment = HorizontalAlignment.Stretch;
                this.lyncCommunicationControl.InputHelper.Visibility         = Visibility.Visible;
                this.lyncCommunicationControl.DisplayName.Padding            = new Thickness(8, 0, 8, 0);
                break;

            default:
                this.lyncCommunicationControl.LayoutRoot.HorizontalAlignment = HorizontalAlignment.Right;
                this.lyncCommunicationControl.InputHelper.Visibility         = Visibility.Collapsed;
                this.lyncCommunicationControl.DisplayName.Padding            = new Thickness(0, 0, 0, 0);
                break;
            }

            var sizeY = new DisplaySize(height, height, height);

            this.ApplySize(DisplaySize.Default, sizeY);
        }
        private void CreateDisplaySize(List <ProductDetailModel> productColorList, int?ProductID)
        {
            DisplaySize displaySize;

            foreach (var i in productColorList)
            {
                if (HasSize(ProductID, i.SID) == true)
                {
                    displaySize = new DisplaySize();
                    displaySize.DisplaySizeID = GetDisplaySizeKey(ProductID, i.SID);
                    displaySize.isDisplay     = false;
                    _dbContext.DisplaySize.Attach(displaySize);
                    _dbContext.Entry(displaySize).Property(ds => ds.isDisplay).IsModified = true;
                    _dbContext.SaveChanges();
                }
                displaySize = new DisplaySize();
                displaySize.ProductImageID = i.ProductImageID;
                displaySize.isDisplay      = true;
                _dbContext.DisplaySize.Add(displaySize);
                _dbContext.SaveChanges();
            }
        }
Exemple #9
0
        public void SwitchToDisplaySize(DisplaySize newSize)
        {
            if (newSize == _displaySize)
            {
                return;
            }

            this.originalPSPDimensionsToolStripMenuItem.Checked = (newSize == DisplaySize.Original);
            this.twoXToolStripMenuItem.Checked       = (newSize == DisplaySize.TwoX);
            this.threeXToolStripMenuItem.Checked     = (newSize == DisplaySize.ThreeX);
            this.fullscreenToolStripMenuItem.Checked = (newSize == DisplaySize.Fullscreen);

            this.WindowState = FormWindowState.Normal;
            switch (newSize)
            {
            case DisplaySize.Original:
                this.Size = new Size(480 + _widthPadding, 272 + _heightPadding);
                break;

            case DisplaySize.TwoX:
                this.Size = new Size((480 * 2) + _widthPadding, (272 * 2) + _heightPadding);
                break;

            case DisplaySize.ThreeX:
                this.Size = new Size((480 * 3) + _widthPadding, (272 * 3) + _heightPadding);
                break;

            case DisplaySize.Fullscreen:
                this.WindowState = FormWindowState.Maximized;
                break;
            }

            _displaySize = newSize;

            Properties.Settings.Default.PlayerDisplaySize = _displaySize.ToString();
            Properties.Settings.Default.Save();
        }
Exemple #10
0
        public void SwitchToDisplaySize( DisplaySize newSize )
        {
            if( newSize == _displaySize )
                return;

            this.originalPSPDimensionsToolStripMenuItem.Checked = ( newSize == DisplaySize.Original );
            this.twoXToolStripMenuItem.Checked = ( newSize == DisplaySize.TwoX );
            this.threeXToolStripMenuItem.Checked = ( newSize == DisplaySize.ThreeX );
            this.fullscreenToolStripMenuItem.Checked = ( newSize == DisplaySize.Fullscreen );

            this.WindowState = FormWindowState.Normal;
            switch( newSize )
            {
                case DisplaySize.Original:
                    this.Size = new Size( 480 + _widthPadding, 272 + _heightPadding );
                    break;
                case DisplaySize.TwoX:
                    this.Size = new Size( ( 480 * 2 ) + _widthPadding, ( 272 * 2 ) + _heightPadding );
                    break;
                case DisplaySize.ThreeX:
                    this.Size = new Size( ( 480 * 3 ) + _widthPadding, ( 272 * 3 ) + _heightPadding );
                    break;
                case DisplaySize.Fullscreen:
                    this.WindowState = FormWindowState.Maximized;
                    break;
            }

            _displaySize = newSize;

            Properties.Settings.Default.PlayerDisplaySize = _displaySize.ToString();
            Properties.Settings.Default.Save();
        }