Пример #1
0
        public static DisplaySettings Deserialize(string filepath)
        {
            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(DisplaySettings));

            System.IO.StreamReader reader   = new System.IO.StreamReader(filepath);
            DisplaySettings        settings = (DisplaySettings)x.Deserialize(reader);

            return(settings);
        }
Пример #2
0
        public frmDisplay(DisplaySettings setting, string basePath, int X, int Y, double Opacity)
        {
            this.Visible = false;
            CheckForIllegalCrossThreadCalls = false;
            InitializeComponent();
            settings      = setting;
            this.Opacity  = settings.Opacity + Opacity;
            this.Location = new Point(settings.X + X, settings.Y + Y);

            this.Width  = settings.Width;
            this.Height = settings.Height;
            BasePath    = basePath;
            _X          = X;
            _Y          = Y;
            _Opacity    = Opacity;
        }
Пример #3
0
        public frmDisplay(DisplaySettings setting, string basePath, int X, int Y, double Opacity)
        {
            this.Visible = false;
            CheckForIllegalCrossThreadCalls = false;
            InitializeComponent();
            settings = setting;
            this.Opacity = settings.Opacity +Opacity;
            this.Location = new Point(settings.X+X, settings.Y+Y);

            this.Width = settings.Width;
            this.Height = settings.Height;
            BasePath = basePath;
            _X = X;
            _Y = Y;
            _Opacity = Opacity;
        }
Пример #4
0
        // Resolve the image that the device info corresponds to
        private string ResolveImage(DeviceInfo info, DisplaySettings settings, string basePath)
        {
            if (info.Muted)
            {
                return(basePath + settings.Images[0].ImageName);
            }

            int images = settings.Images.Count;

            images--; // take into account the mute item

            double interval      = (double)1 / (double)images;
            double estimatedItem = info.Volume / interval;
            int    imageNumber   = System.Convert.ToInt32(System.Math.Round(estimatedItem));

            return(basePath + settings.Images[System.Math.Min(images, imageNumber + 1)].ImageName);
        }
Пример #5
0
        // Resolve the image that the device info corresponds to
        private string ResolveImage(DeviceInfo info, DisplaySettings settings, string basePath)
        {
            if (info.Muted)
                return basePath + settings.Images[0].ImageName;

            int images = settings.Images.Count;
            images--; // take into account the mute item

            double interval = (double)1 / (double)images;
            double estimatedItem = info.Volume / interval;
            int imageNumber = System.Convert.ToInt32(System.Math.Round(estimatedItem));
            return basePath + settings.Images[System.Math.Min(images, imageNumber + 1)].ImageName;
        }