Beispiel #1
0
        public GoHInterface(bool isBackground)
        {
            this.LaListeDesCommandes = new ConcurrentBag <string>();

            this.IsBackground = isBackground;

            this.m_noir_Transparent = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));

            try
            {
                this.m_img = Get_Img_From_Bitmap(Resource1.kinect);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);

                //try
                //{
                //    this.m_img = new BitmapImage(new Uri(IMG_BACKGROUND));
                //}
                //catch (Exception ex2)
                //{
                //    Outil.Ecrire_Erreur(ex2);
                //    throw;
                //}

                throw;
            }



            string[] ts_Lines;

            string filePath;

            try
            {
                if (File.Exists(CONFIG_NAME))
                {
                    filePath = CONFIG_NAME;
                }
                else if (File.Exists(CONFIG_FOLDER + CONFIG_NAME))
                {
                    filePath = CONFIG_FOLDER + CONFIG_NAME;
                }
                else
                {
                    throw new ApplicationException(" Erreur : pas de fichier " + CONFIG_NAME);
                }

                Console.WriteLine(@" fichier de config : " + filePath);
                ts_Lines = File.ReadAllLines(filePath);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);
                throw;
            }


            if (string.IsNullOrWhiteSpace(ts_Lines[0]))
            {
                Console.WriteLine(@" Pas de parametre dans le fichier : ");
                Console.WriteLine(filePath);

                return;
            }
            else if (ts_Lines[0].StartsWith(@"http://"))
            {
                this.m_connection = new ClientGoHWeb(this.LaListeDesCommandes, ts_Lines[0]);
            }
            else
            {
                this.m_connection = new ClientGoHSsh(this.LaListeDesCommandes, filePath);
            }


            RefreshMenu();


            //Return the typeface collection for the fonts in the selected URI location.
            using (IEnumerator <Typeface> t = Fonts.GetTypefaces("file:///C:\\Windows\\Fonts\\#Georgia").GetEnumerator())
            {
                t.MoveNext();
                this.m_typeface = t.Current;
            }

            this.m_center  = new Point(X_DECALAGE_BACK, Y_DECALAGE_BACK);
            this.m_pen     = new Pen(Brushes.White, 1);
            this.m_radiusX = X_TAILLE;
            this.m_radiusY = Y_TAILLE;
        }
        public GoHInterface(bool isBackground)
        {
            this.LaListeDesCommandes = new ConcurrentBag <string>();

            this.IsBackground = isBackground;

            this.m_noir_Transparent = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));

            try
            {
                this.m_img = Get_Img_From_Bitmap(Resource1.kinect);
                this.m_hand_Transparent_Img = Get_Img_From_Bitmap(Resource1.hand_transparent);
                this.m_fist_Transparent_Img = Get_Img_From_Bitmap(Resource1.fist_transparent);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);

                throw;
            }



            string[] ts_Lines;

            string filePath;

            try
            {
                Assembly assembly = Assembly.GetEntryAssembly();

                if (assembly == null)
                {
                    throw new Exception(" assembly == null ");
                }

                string codeBase = assembly.CodeBase;

                DirectoryInfo exeFolder_Di = new FileInfo(new Uri(codeBase).LocalPath).Directory;

                FileInfo fi_02 = new FileInfo(exeFolder_Di.Parent.Parent.Parent.FullName + @"\" + CONFIG_NAME);

                if (File.Exists(CONFIG_NAME))
                {
                    filePath = CONFIG_NAME;
                }
                else if (fi_02.Exists)
                {
                    filePath = fi_02.FullName;
                }
                else
                {
                    throw new ApplicationException(" Erreur : pas de fichier " + CONFIG_NAME);
                }

                Console.WriteLine(@" fichier de config : " + filePath);
                ts_Lines = File.ReadAllLines(filePath);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);
                throw;
            }


            if (string.IsNullOrWhiteSpace(ts_Lines[0]))
            {
                Console.WriteLine(@" Pas de parametre dans le fichier : ");
                Console.WriteLine(filePath);

                return;
            }
            else if (ts_Lines[0].StartsWith(@"http://"))
            {
                this.m_connection = new ClientGoHWeb(this.LaListeDesCommandes, ts_Lines[0]);
            }
            else
            {
                this.m_connection = new ClientGoHSsh(this.LaListeDesCommandes, filePath);
            }


            RefreshMenu();


            //Return the typeface collection for the fonts in the selected URI location.
            using (IEnumerator <Typeface> t = Fonts.GetTypefaces("file:///C:\\Windows\\Fonts\\#Georgia").GetEnumerator())
            {
                t.MoveNext();
                this.m_typeface = t.Current;
            }

            this.m_center  = new Point(X_DECALAGE_BACK, Y_DECALAGE_BACK);
            this.m_pen     = new Pen(Brushes.White, 1);
            this.m_radiusX = X_TAILLE;
            this.m_radiusY = Y_TAILLE;
        }