Ejemplo n.º 1
0
        public (string widthInMm, string lengthInMm) GetStandardSizePrintingVersion(StandardSize standardSize)
        {
            var widthInMm  = $"{standardSize.WidthInMm} мм.";
            var lengthInMm = $"{standardSize.HeightInMm} мм.";

            return(widthInMm, lengthInMm);
        }
Ejemplo n.º 2
0
        public PSSCLabel():base()
        {
            this.standardSize = StandardSize.Small;
            this.isUppercase = false;

            this.AutoSize = true;
            this.ForeColor = Color.DeepSkyBlue;
            //oldText = this.Text;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads an aircraft image and sizes it according to the size passed across.
        /// </summary>
        /// <param name="airplaneId"></param>
        /// <param name="standardSize"></param>
        /// <param name="isInternetClient"></param>
        /// <returns></returns>
        private Image CreateAirplanePicture(string airplaneId, StandardSize standardSize, bool isInternetClient)
        {
            Bitmap result = null;

            if (_InternetClientCanViewPictures || !isInternetClient && !String.IsNullOrEmpty(airplaneId))
            {
                var lastSpacePosn = airplaneId.LastIndexOf(' ');
                var registration  = lastSpacePosn == -1 ? null : airplaneId.Substring(0, lastSpacePosn);
                var icao          = airplaneId.Substring(lastSpacePosn + 1);

                if (registration != null && registration.Length == 0)
                {
                    registration = null;
                }
                if (icao != null && icao.Length == 0)
                {
                    icao = null;
                }

                string fullPath = _PictureManager.FindPicture(_PictureFolderCache, icao, registration);
                if (fullPath != null)
                {
                    result = (Bitmap)ImageFileManager.LoadFromFile(fullPath);

                    int        newWidth = -1, newHeight = -1, minWidth = -1;
                    ResizeMode resizeMode  = ResizeMode.Stretch;
                    bool       preferSpeed = false;
                    switch (standardSize)
                    {
                    case StandardSize.IPadDetail:           newWidth = 680; break;

                    case StandardSize.IPhoneDetail:         newWidth = 260; break;

                    case StandardSize.PictureDetail:        newWidth = 350; minWidth = 350; break;

                    case StandardSize.PictureListThumbnail: newWidth = 60; newHeight = 40; resizeMode = ResizeMode.Centre; /*preferSpeed = true;*/ break;

                    case StandardSize.BaseStation:          newWidth = 200; newHeight = 133; break;
                    }

                    if ((newWidth != -1 || newHeight != -1) && (minWidth == -1 || result.Width > newWidth))
                    {
                        if (newWidth == -1)
                        {
                            newWidth = (int)(((double)newHeight * ((double)result.Width / (double)result.Height)) + 0.5);
                        }
                        else if (newHeight == -1)
                        {
                            newHeight = (int)(((double)newWidth / ((double)result.Width / (double)result.Height)) + 0.5);
                        }
                        result = (Bitmap)UseImage(result, ResizeImage(result, newWidth, newHeight, resizeMode, Brushes.Transparent, preferSpeed));
                    }
                }
            }

            return(result);
        }
 /// <summary>
 /// Adds a button to the inspector with a given display text and size.
 /// </summary>
 /// <param name="text">text to display on the button</param>
 /// <param name="buttonSize">Size of the button</param>
 public KitButtonAttribute(string text, StandardSize buttonSize = StandardSize.Small)
 {
     Text       = text;
     ButtonSize = buttonSize;
 }
 /// <summary>
 /// Adds a button to the inspector with a given size using the method name as the text.
 /// </summary>
 /// <param name="buttonSize">Size of the button</param>
 public KitButtonAttribute(StandardSize buttonSize = StandardSize.Small)
 {
     Text       = string.Empty;
     ButtonSize = buttonSize;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Loads an aircraft image and sizes it according to the size passed across.
        /// </summary>
        /// <param name="airplaneId"></param>
        /// <param name="standardSize"></param>
        /// <param name="isInternetClient"></param>
        /// <returns></returns>
        private Image CreateAirplanePicture(string airplaneId, StandardSize standardSize, bool isInternetClient)
        {
            Bitmap result = null;

            if(_InternetClientCanViewPictures || !isInternetClient && !String.IsNullOrEmpty(airplaneId)) {
                var lastSpacePosn = airplaneId.LastIndexOf(' ');
                var registration = lastSpacePosn == -1 ? null : airplaneId.Substring(0, lastSpacePosn);
                var icao = airplaneId.Substring(lastSpacePosn + 1);

                if(registration != null && registration.Length == 0) registration = null;
                if(icao != null && icao.Length == 0) icao = null;

                string fullPath = _PictureManager.FindPicture(_PictureFolderCache, icao, registration);
                if(fullPath != null) {
                    result = (Bitmap)ImageFileManager.LoadFromFile(fullPath);

                    int newWidth = -1, newHeight = -1, minWidth = -1;
                    ResizeMode resizeMode = ResizeMode.Stretch;
                    bool preferSpeed = false;
                    switch(standardSize) {
                        case StandardSize.IPadDetail:           newWidth = 680; break;
                        case StandardSize.IPhoneDetail:         newWidth = 260; break;
                        case StandardSize.PictureDetail:        newWidth = 350; minWidth = 350; break;
                        case StandardSize.PictureListThumbnail: newWidth = 60; newHeight = 40; resizeMode = ResizeMode.Centre; /*preferSpeed = true;*/ break;
                        case StandardSize.BaseStation:          newWidth = 200; newHeight = 133; break;
                    }

                    if((newWidth != -1 || newHeight != -1) && (minWidth == -1 || result.Width > newWidth)) {
                        if(newWidth == -1)          newWidth = (int)(((double)newHeight * ((double)result.Width / (double)result.Height)) + 0.5);
                        else if(newHeight == -1)    newHeight = (int)(((double)newWidth / ((double)result.Width / (double)result.Height)) + 0.5);
                        result = (Bitmap)UseImage(result, ResizeImage(result, newWidth, newHeight, resizeMode, Brushes.Transparent, preferSpeed));
                    }
                }
            }

            return result;
        }