public BookPhotoOrder(PhotoSelectionPage f)
        {
            InitializeComponent();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridBackground);
            gm.setgradient(ifCheckedGrid);

            father = f;

            this.father.StartModal();

            for (int n = 20; n < 60; n = n + 2)
            {
                comboBoxNumberOfPages.Items.Add(n);
            }

            comboBoxNumberOfPages.SelectedIndex = 0;

            LoginManager m = LoginControler.getLoginManager();
            if (m != null)
            {
                if (m.isBookOrder())
                {
                    checkBox1.IsChecked = true;
                    comboBoxNumberOfPages.SelectedValue = m.getNbPageOkBook().ToString();
                    comboBoxNumberOfPages.Text = m.getNbPageOkBook().ToString();
                }
                else
                {
                    checkBox1.IsChecked = false;
                }
            }
        }
        public LoginPage()
        {
            InitializeComponent();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridlogin);
        }
        public EffectPage(System.Windows.Controls.Image img,PhotoSelectionPage fsp)
        {
            father = fsp;
            father.StartModal();
            InitializeComponent();

            if (img != null)
            {

              this.Cursor = Cursors.Wait;
              imageBlackAndWhite.Source = EffectBitmap.convertBitmapToBitmapSource(EffectBitmap.ConvertBlackAndWhite(EffectBitmap.GetBitmap(img)));
              //this.Cursor = Cursors.Wait;
              imageSepia.Source = EffectBitmap.convertBitmapToBitmapSource(EffectBitmap.ConvertSepiaTone(EffectBitmap.GetBitmap(img)));

              if (img.Source.Width > img.Source.Height)
              {
                  imageBlackAndWhite.Height *= img.Source.Height / img.Source.Width;
                  imageSepia.Height *= img.Source.Height / img.Source.Width;
              }
              else
              {
                  imageBlackAndWhite.Width *= img.Source.Width / img.Source.Height;
                  imageSepia.Width *= img.Source.Width / img.Source.Height;
              }

            this.Cursor = Cursors.Arrow;
            }
            Utility.gradientManager gm = new gradientManager();
               gm.setgradient(gridEffect);
        }
        public orderImageOnCd(PhotoSelectionPage f)
        {
            InitializeComponent();
            father = f;
            this.father.StartModal();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridBackground);

              LoginManager m = LoginControler.getLoginManager();
              if (m != null)
              {
                  if (m.getNbDifferentPicture() < 10)
                  {
                      panelCheckPhotoOnCD.IsEnabled = false;
                      labelWarningMinimun.Visibility = System.Windows.Visibility.Visible;
                  }
                  else
                  {
                      panelCheckPhotoOnCD.IsEnabled = true;
                      labelWarningMinimun.Visibility = System.Windows.Visibility.Hidden;
                  }

                  if (m.getNbDifferentPicture() < 50)
                  {
                      surfaceCheckBoxWithoutPaper.IsEnabled = false;
                  }
                  else
                  {
                      surfaceCheckBoxWithoutPaper.IsEnabled = true;
                  }
              }
        }
        public CreationLoginPage()
        {
            InitializeComponent();
            UpdateLanguageDateSelection();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridBackground);
        }
        public InformationCategory()
        {
            InitializeComponent();

            UpdateList();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(stackPanel1);
        }
        public PhotoSelectionPage()
        {
            InitializeComponent();

            SurfaceWindow1.changeMessagePage("  ");

            SurfaceWindow1.StatiChangeDeconnectionToValidate();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(dockPanel1);

            LoadPuzzleList();
            SurfaceWindow1.IsphotoSelection = true;
            SurfaceWindow1.StaticShowButton();

            UpdateShowPrice();
        }
        public onePhotoPage(string filename)
        {
            InitializeComponent();
            //globalDatasingleton.getInstance().InitCursor(

            SurfaceWindow1.changeMessagePage(" ");

            MyImage img = new MyImage();
            if (filename != "")
            {
                img.Source = BitmapUtil.GetImageSource(filename);
                img.OriginalPath = filename;
            }
            LoadImg(img);
            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridPhoto);

            UpdateGUI();
        }
        public ListPhotosPage(XmlElement elm)
        {
            InitializeComponent();
            // Create a Timer with a Normal Priority

            SurfaceWindow1.changeMessagePage("");
            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(this.gridBackground);

            Init();

            currentCat = elm;
            if (currentCat == null)
            {
                chargementLabel.Content = "Error Loading Category";
            }
            else
            {
                InsertPhoto();
            }
        }
        public FormatDialogImage(string image,PhotoSelectionPage f,XmlNode nodeUser,bool goody=false,bool onbook=false)
        {
            InitializeComponent();

            lstGuiProduct = new List<ProductWidget>();
            filenameImage = image;

            LoginManager m = LoginControler.getLoginManager();
            if (m != null)
            {
                nodePhoto = m.getNodeImageUser(filenameImage);

              /*  if (m.getNbDifferentPicture() < 15)
                {
                    labelMinimunForBook.Visibility = System.Windows.Visibility.Visible;
                    surfaceCheckBoxOnBook.IsEnabled = false;
                }
                else
                {
                    labelMinimunForBook.Visibility = System.Windows.Visibility.Hidden;
                    surfaceCheckBoxOnBook.IsEnabled = true;
                }
               * */

                if (m.getNbDifferentPicture() < 10)
                {
                    labelWarningMinimun.Visibility = System.Windows.Visibility.Visible;
                    surfaceCheckBoxOrderCD2.IsEnabled = false;
                }
                else
                {
                    labelWarningMinimun.Visibility = System.Windows.Visibility.Hidden;
                    surfaceCheckBoxOrderCD2.IsEnabled = true;
                }
            }

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridBackground);
            gm.setgradient(stackPanelFormatPhoto);
            gm.setgradient(grdiOderImageOnCD);
            gm.setgradient(gridOnBook);
            gm.setgradient(stackPanelProductObject);
            //gm.setgradient(tabControlProduct);

            this.Cursor = Cursors.Wait;

            addProduct(0, 0, 0, ref stackPanelFormatPhoto);
            addProduct(1, 0, 1, ref stackPanelFormatPhoto);
            addProduct(2, 0, 2, ref stackPanelFormatPhoto);
            addProduct(3, 1, 0, ref stackPanelFormatPhoto);
            addProduct(4, 1, 1, ref stackPanelFormatPhoto);
            addProduct(5, 1, 2, ref stackPanelFormatPhoto);

            addProduct(6, 0, 0, ref stackPanelProductObject);
            addProduct(7, 0, 1, ref stackPanelProductObject);
            addProduct(8, 0, 2, ref stackPanelProductObject);
            addProduct(9, 1, 0, ref stackPanelProductObject);
            addProduct(10, 1, 1, ref stackPanelProductObject);
            addProduct(11, 1, 2, ref stackPanelProductObject);

            this.Cursor = Cursors.Arrow;

            if (nodePhoto != null)
            {
                XmlNode cdorder = nodePhoto.Attributes.GetNamedItem("imageoncd");
                if (cdorder != null)
                {
                    if (cdorder.Value.ToLower() == "true")
                    {
                        surfaceCheckBoxOrderCD2.IsChecked = true;
                    }
                    else
                    {
                        surfaceCheckBoxOrderCD2.IsChecked = false;
                    }
                }
                else
                {
                    surfaceCheckBoxOrderCD2.IsChecked = false;
                }

                XmlNode bookorder = nodePhoto.Attributes.GetNamedItem("imageonbook");
                if (bookorder != null)
                {
                    if (bookorder.Value.ToLower() == "true")
                    {
                        surfaceCheckBoxOnBook.IsChecked = true;
                    }
                    else
                    {
                        surfaceCheckBoxOnBook.IsChecked = false;
                    }
                }
                else
                {
                    surfaceCheckBoxOnBook.IsChecked = false;
                }

            }

            father = f;
            /*
             * LoginManager m = LoginControler.getLoginManager();
            if (m != null)
            {
                if (m.OrderCd) surfaceCheckBoxOrderCD2.IsChecked = true;
                else surfaceCheckBoxOrderCD2.IsChecked = false;

                string format =m.getFormatImage(image);

                if (format == "15x23") { surfaceRadioButton1.IsChecked = true; }
                if (format == "20x30") { surfaceRadioButton2.IsChecked = true; }
                if (format == "30x45") { surfaceRadioButton3.IsChecked = true; }
            }
             * */

            if (goody)
            {
                tabItem2.IsSelected = true;
            }
            if (onbook)
            {
                tabItem4.IsSelected = true;
            }
            updatePrice();
            this.father.StartModal();
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            Splasher.Splash = new SplashScreen(versionMajor.ToString() + "." + versionMineur.ToString());
            Splasher.ShowSplash();

            Thread.Sleep(5);
            LocalizationManager.UICulture = new CultureInfo("fr-FR");

            string netresult="";
            try
            {
                Thread.Sleep(1);

                VersionChecker vc = new VersionChecker();
                netresult = vc.GetNetworkVersion();

                MessageListener.Instance.ReceiveMessage("Update Check");
                Thread.Sleep(1);

                char[] separator = new char[1];
                separator[0] = '.';
                string[] splitString = netresult.Split(separator);

                if (splitString.Length == 2)
                {
                    if (Int32.Parse(splitString[0].ToString()) >= versionMajor && Int32.Parse(splitString[1].ToString()) > versionMineur)
                    {
                        if (MessageBox.Show("New version is available , do you want to download it ? ", "Update", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            vc.DownloadFile();
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
            Splasher.Splash.Close();

            InitializeComponent();

            info.Label = LocalizationManager.ResourceManager.GetString("Information");
            info.ImageSource = "pack://*****:*****@"C:\Users\c\Pictures\meteo.jpg";
            //MapButton.Label = "Map";
            //MapButton.ImageSource = @"C:\Users\c\Pictures\map_maurice.jpg";
            PhotoButton.Label = LocalizationManager.ResourceManager.GetString("Photo");
            PhotoButton.ImageSource = "pack://application:,,,/Resources/photo.jpg";
            languageButton.Label = LocalizationManager.ResourceManager.GetString("Language");
            languageButton.ImageSource = "pack://application:,,,/Resources/drapeau.jpg";

            try
            {
                if (CommunConfig.getInstance().InfoGuiImage != "")
                {
                    FileInfo fi = new FileInfo(CommunConfig.getInstance().InfoGuiImage);
                    if (fi.Exists)
                    {
                        //  imageBackground.Source = new BitmapImage(new Uri(fi.FullName));
                        info.ImageSource = fi.FullName;
                    }
                }

                if (CommunConfig.getInstance().PhotoGuiImage != "")
                {
                    FileInfo fi = new FileInfo(CommunConfig.getInstance().PhotoGuiImage);
                    if (fi.Exists)
                    {
                        if (fi.Extension.ToLower() == ".gif")
                        {
                            PhotoButton.ImageGifSource = fi.FullName;
                        }
                        else
                        {
                            PhotoButton.ImageSource = fi.FullName;
                        }
                    }
                }

                /*
                fi = new FileInfo(CommunConfig.getInstance().LanguageImage);
                if (fi.Exists) { languageButton.ImageSource = fi.FullName; }
                 * */
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            _instance = this;
            _backStack = new Stack<UserControl>();

            Utility.gradientManager gm = new gradientManager();
            gm.setgradient(gridBackground);
            gm.setgradient(grid1);
            gm.setgradient(gridLogin);
            gm.setgradient(gridCreationLogin);

            _timerScreenSaver = new DispatcherTimer();
            // Set the Interval to 2 seconds
            _timerScreenSaver.Interval = TimeSpan.FromSeconds(15);

            _timerScreenSaver.Tick += new EventHandler(delegate(object s, EventArgs a)
            {
               // System.Console.WriteLine("TEST SCREENSAVER");
                if (Utility.ScreenSaverController.GetScreenSaverRunning())
                {
                    LoginControler.Disconnect();
                    GotoMenu();
                    //System.Console.WriteLine("SCREENSAVER ACTIF");
                }
            });

            _timerScreenSaver.Start();

            //gridLogin.Margin = new Thickness(this.Width / 2 - 250, this.Height,0,0);
            //gridCreationLogin.Margin = new Thickness(this.Width / 2 - 250, this.Height,0,0);
        }