예제 #1
0
        public MainWindow(PhotoShare _ps)
        {
            ps = _ps;

            InitializeComponent();

            /*
             * The following code is for loading the color of the banner so you can
             * run the same version of photoshare on all test cell phones and still
             * have different colors.
             */
            bool hasLoadedColor = false;

            FileStream fs = null;

            try
            {
                fs = System.IO.File.OpenRead(Assembly.GetExecutingAssembly().GetName().CodeBase.
                                             Replace("PhotoShare.exe", "") + "pssettings.txt");
            }
            catch
            {
                Debug.WriteLine("pssettings.txt not found");
            }

            if (fs != null)
            {
                byte[] data = new byte[fs.Length];
                fs.Read(data, 0, (int)fs.Length);
                fs.Close();

                String   str         = Utility.ByteArrayToString(data);
                char[]   lineendings = { '\n' };
                String[] line        = str.Split(lineendings);
                int      i;
                for (i = 0; i < line.Length; i++)
                {
                    if (line[i].Length > 12 && !hasLoadedColor)
                    {
                        if (String.Compare(line[i], 0, "BannerColor=", 0, 12) == 0)
                        {
                            char[]   commas = { ',' };
                            string[] value  = line[i].Substring(12).Split(commas);
                            if (value.Length == 3)
                            {
                                myPicturesLabel.BackColor =
                                    Color.FromArgb(
                                        int.Parse(value[0]),
                                        int.Parse(value[1]),
                                        int.Parse(value[2]));
                                hasLoadedColor = true;
                            }
                        }
                    }
                }
            }

            // Calculate size of thumbnails of pictures on main screen
            // assuming we should layout two thumbnails per row

            // Account for some space at edges and inbetween thumbnails (15% of width each)

            double width = (this.Width - (this.Width * 0.15) * 3) / 2;

            Debug.WriteLine("thumbnail width is " + (int)width);
            photoImageList.ImageSize = new System.Drawing.Size((int)width, (int)width);
        }
예제 #2
0
        public MainWindow(PhotoShare _ps)
        {
            ps = _ps;

                        InitializeComponent();

                        /*
                         * The following code is for loading the color of the banner so you can
                         * run the same version of photoshare on all test cell phones and still
                         * have different colors.
                        */
                        bool hasLoadedColor = false;

                        FileStream fs = null;
                        try
                        {
                            fs = System.IO.File.OpenRead(Assembly.GetExecutingAssembly().GetName().CodeBase.
                                Replace("PhotoShare.exe", "") + "pssettings.txt");
                        }
                        catch
                        {
                                Debug.WriteLine("pssettings.txt not found");
                        }

                        if (fs != null)
                        {
                            byte[] data = new byte[fs.Length];
                            fs.Read(data, 0, (int)fs.Length);
                            fs.Close();

                            String str = Utility.ByteArrayToString(data);
                            char[] lineendings = { '\n' };
                            String[] line = str.Split(lineendings);
                            int i;
                            for (i = 0; i < line.Length; i++)
                                if (line[i].Length > 12 && !hasLoadedColor)
                                    if (String.Compare(line[i], 0, "BannerColor=", 0, 12) == 0)
                                    {
                                        char[] commas = { ',' };
                                        string[] value = line[i].Substring(12).Split(commas);
                                        if (value.Length == 3)
                                        {
                                            myPicturesLabel.BackColor =
                                                Color.FromArgb(
                                                    int.Parse(value[0]),
                                                    int.Parse(value[1]),
                                                    int.Parse(value[2]));
                                            hasLoadedColor = true;
                                        }
                                    }
                        }

                        // Calculate size of thumbnails of pictures on main screen
                        // assuming we should layout two thumbnails per row

                        // Account for some space at edges and inbetween thumbnails (15% of width each)

                        double width = (this.Width - (this.Width * 0.15) * 3) / 2;

                        Debug.WriteLine("thumbnail width is " + (int)width);
                        photoImageList.ImageSize = new System.Drawing.Size((int)width, (int)width);
        }