public ZhenXinHua()
 {
     InitializeComponent();
     this.LayoutRoot.Background = new ImageBrush() { ImageSource = new BitmapImage(new Uri("Bg/12.jpg", UriKind.Relative)) };
     db = new DataBase(DataBase.contectString);
     list = db.table1.Where(c => c.IsUse == true).ToList<Table1>();
     count = list.Count;
     int r1 = r.Next(0, count );
     int r2 = r.Next(0, count );
     int r3 = r.Next(0, count );
     content1.Text = list.ElementAt(r1).Content;
     content2.Text = list.ElementAt(r2).Content;
     content3.Text = list.ElementAt(r3).Content;
 }
Example #2
0
        private void PrepareWeekGrid()
        {

            for (int i = 0; i < 4; i++)//Creating listviews where we will display Timesatmps for rows
            {
                ListView list = new ListView();
                //Little bit of tinkering with properties to get desired result;
                list.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
                Label timelabel = new Label();//We will display timestamp on this label
                timelabel.Content = TimePeriodToString((timeperiod)i);//setting
                list.Items.Add(timelabel);//adding label to listview
                TimeStamps.Children.Add(list);//Adding listview to grid;
            }

            Label[] weekDayLabels = new Label[7];//Labels for dispaly weekday name
            List<DayOfWeek> customday = new List<DayOfWeek>();// reshuffling weekady enum to set monday as first day of week
            foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek))
                              .OfType<DayOfWeek>()
                              .ToList()//monday is second day by default
                              .Skip(1))//so we skip sunday 
            {
                customday.Add(day);//adding 
            }
            customday.Add(DayOfWeek.Sunday);//and add sunday as last

            for (int i = 0; i < weekDayLabels.Length; i++)//Placing all the labels at grid;
            {
                weekDayLabels[i] = new Label();
                weekDayLabels[i].Background = Brushes.LightBlue;
                weekDayLabels[i].Content = customday.ElementAt(i).ToString();//With appropriate day name;(This will correspond to actual date-weekday)
                DayLabels.Children.Add(weekDayLabels[i]);

            }
        }
Example #3
0
        public static void DrawLine(DrawingContext dc, Point _Start, Point _End, double LineWidth, Brush LineColor, int LineStyle)
        {
            Pen lp = new Pen(LineColor, LineWidth);

            switch (LineStyle)
            {
                case LineStyle_StraightLine :
                    dc.DrawLine(lp, _Start, _End);
                    break;
                case LineStyle_MultipleSegment :
                    double dx = Math.Abs(_Start.X - _End.X);
                    double dy = Math.Abs(_Start.Y - _End.Y);
                    double d1 = Math.Pow(dx * dx + dy * dy, 0.5);
                    double d2 = Math.Pow(5 * 5 + 5 * 5, 0.5);
                    Vector v1 = new Vector(_End.X - _Start.X, _End.Y - _Start.Y);
                    Vector v2 = v1 / (d1 / d2);
                    int count = (int)(d1 / d2);
                    List<Point> S = new List<Point>();
                    List<Point> E = new List<Point>();
                    for (int i = 0; i < count; i += 2)
                    {
                        S.Add(_Start + v2 * i);
                        E.Add(_Start + v2 * i + v2);
                    }
                    for (int i = 0; i < S.Count; i++)
                    {
                        dc.DrawLine(lp, S.ElementAt(i), E.ElementAt(i));
                    }
                    break;
            }
        }
Example #4
0
        public Menus()
        {
            InitializeComponent();

            DateBox.FontSize = 40; //the name should be noticiably larger than the other 3 data feilds
            //DateBox.Margin = new Thickness(12, 12, 12, 12);
            List<String> Days = new List<string> { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
            DateBox.ItemsSource = Days;

            if (date3.DayOfWeek == DayOfWeek.Sunday)
                WhatToShow = 6;
            if (date3.DayOfWeek == DayOfWeek.Monday)
                WhatToShow = 0;
            if (date3.DayOfWeek == DayOfWeek.Tuesday)
                WhatToShow = 1;
            if (date3.DayOfWeek == DayOfWeek.Wednesday)
                WhatToShow = 2;
            if (date3.DayOfWeek == DayOfWeek.Thursday)
                WhatToShow = 3;
            if (date3.DayOfWeek == DayOfWeek.Friday)
                WhatToShow = 4;
            if (date3.DayOfWeek == DayOfWeek.Saturday)
                WhatToShow = 5;
            DateBox.SelectedItem = Days.ElementAt(WhatToShow);
        }
 public SlideShow(List<string> SrcList, int CurrSrc, MainWindow MainImageWindow)
     : this()
 {
     this.SrcList = SrcList;
     this.CurrSrc = CurrSrc;
     this.MainImageWindow = MainImageWindow;
     ImageBox.Source = new BitmapImage(new Uri(SrcList.ElementAt(CurrSrc)));
     Timer.Start();
 }
        public MainWindow()
        {
            InitializeComponent();
            List<Tower> towers = new List<Tower>();
            List<Phone> phones = new List<Phone>();
            List<ARenderObject> renderTowers = new List<ARenderObject>();
            List<ARenderObject> renderPhones = new List<ARenderObject>();

            towers.Add(new Tower(12));
            towers.Add(new Tower(15));
            towers.Add(new Tower(55));
            towers.Add(new Tower(55));
            towers.Add(new Tower(55));

            phones.Add(new Phone());
            phones.Add(new Phone());
            phones.Add(new Phone());

            phones.ElementAt(0).AddSubject(towers.ElementAt(0));
            foreach (Tower t in towers)
            {
                renderTowers.Add(new RenderTower(t, Carrier));
            }
            foreach (Phone p in phones)
            {
                renderPhones.Add(new RenderPhone(p, Carrier));
            }
            foreach (ARenderObject renderPhone in renderPhones)
            {
                RenderPhone rp = (RenderPhone)renderPhone;
                rp = new RenderLabelPhone(rp);
            }
            renderTowers.ElementAt(0).SetLocation(200, 20);
            renderTowers.ElementAt(1).SetLocation(20, 120);
            renderTowers.ElementAt(2).SetLocation(145, 205);
            renderTowers.ElementAt(3).SetLocation(30, 407);
            renderTowers.ElementAt(4).SetLocation(160, 500);
            renderPhones.ElementAt(0).SetLocation(19, 44);
            renderPhones.ElementAt(1).SetLocation(69, 224);
            renderPhones.ElementAt(2).SetLocation(269, 324);

            controlTower = new ControlTower(renderTowers, renderPhones);
        }
Example #7
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            string s = "";
            //string fn = @"C:\Windows\Temp\user.txt";
            string path = Directory.GetCurrentDirectory();
            string file = path + @"account.txt";

            List<string> user = new List<string>();
            List<string> pass = new List<string>();
            try
            {
                using (StreamReader sr = new StreamReader(file, true))
                {
                    while (sr.EndOfStream == false)
                    {
                        s = sr.ReadLine();
                        string[] ss = s.Split(',');
                        user.Add(ss[0]);
                        pass.Add(ss[1]);
                    }
                }
            }
            catch (System.IO.DirectoryNotFoundException ex)
            {
                File.Create(file);
            }
            if(user.Contains(Username.Text))
            {
                for (int i = 0; i < user.Count; i++)
                {
                    if (Username.Text == user.ElementAt(i))
                    {
                        if (Password.Text == pass.ElementAt(i))
                        {
                            this.Hide();
                            Properties.Settings.Default.Save();
                            System.Windows.MessageBox.Show("Login Successful");
                            this.Show();
                        }
                        else
                        {
                            MessageBlock.Text = "Sorry wrong Password";
                        }
                    }
                }
            }
            else
            {
                MessageBlock.Text = "Sorry wrong Username";
            }
        }
 private String composeThingImageDetailPageUrlsArgument(List<String> thingAllImageDetailPageUrls)
 {
     StringBuilder argumentBuilder = new StringBuilder();
     int urlCount = thingAllImageDetailPageUrls.Count;
     for (int x = 0; x < urlCount; x++)
     {
         argumentBuilder.Append(thingAllImageDetailPageUrls.ElementAt(x));
         if (x < (urlCount - 1))
         {
             argumentBuilder.Append('|');
         }
     }
     return argumentBuilder.ToString();
 }
        public void setNetworks(List<ZeroTierNetwork> networks)
        {
            this.wrapPanel.Children.Clear();
            if (networks == null)
            {
                return;
            }

            for (int i = 0; i < networks.Count; ++i)
            {
                this.wrapPanel.Children.Add(
                    new NetworkInfoView(
                        handler,
                        networks.ElementAt<ZeroTierNetwork>(i)));
            }
        }
Example #10
0
 public PanoramaDieta()
 {
     InitializeComponent();
     ListaRefeicao = (Application.Current as App).ListaRefeicao;
     this.ItemCafe.DataContext = ListaRefeicao.ElementAt(0);
     this.itemLanche.DataContext = ListaRefeicao.ElementAt(1);
     this.itemAlmoco.DataContext = ListaRefeicao.ElementAt(2);
     this.itemLancheTarde.DataContext = ListaRefeicao.ElementAt(3);
     this.itemJanta.DataContext = ListaRefeicao.ElementAt(4);
     this.itemCeia.DataContext = ListaRefeicao.ElementAt(5);
     lerRefeicoes();
 }
Example #11
0
        private void WordGenerator(int length)
        {
            List<string> neededwords = new List<string>();
            string pathtofile = @"../../words.txt";
            string[] allwords = File.ReadAllLines(pathtofile);

            for (int i = 0; i < allwords.Length; i++)
            {
                if (allwords[i].Length == length)
                {
                    neededwords.Add(allwords[i]);
                }
            }

            Random rand2 = new Random();
            int temp2 = rand2.Next(0, neededwords.Count + 1);
            hiddenword = neededwords.ElementAt(temp2);
        }
        public LearningWindow(String style, int type, ListBox list, ComboBox choosenType)
        {
            InitializeComponent();
            selectedStyle.Content = style;
            ts = DateTime.Now;
            this.type = type;
            this.selectedType = choosenType.SelectedIndex;
            foreach(object ob in list.SelectedItems)
                selectedGroups.Add((Group)ob);
            if(selectedGroups.Count==1)
                basicLanguage.KeyDown += new KeyEventHandler(basicLanguage_KeyDown);
            else if (selectedGroups.Count > 1)
            {
                foreach (Group p in selectedGroups)
                    groupsWithResult.Add(p, new Result());
                basicLanguage.KeyDown += new KeyEventHandler(basicLanguageMultiple_KeyDown);
            }
            SqlAccess sql = new SqlAccess();

            if (this.type == 1) {

                Random random = new Random();
                words = sql.getWordsFromGroups(selectedGroups);
                howMuchAll.Content = words.Count;
                progressBar1.Maximum = words.Count;
                badAnsv.Content = 0;
                goodAnsv.Content = 0;
                indexOfCurrentWord = random.Next(0, words.Count);
                if(selectedType==0)
                    foreginWord.Text = words.ElementAt<Word>(indexOfCurrentWord).Basic;
                else
                    foreginWord.Text = words.ElementAt<Word>(indexOfCurrentWord).Foregin;

            }
            else if (this.type == 2)
            {

                Random random = new Random();
                //int randomNumber = random.Next(0, 100);
                words = sql.getWordsFromGroups(selectedGroups);
                howMuchAll.Content = words.Count;
                progressBar1.Maximum = words.Count;
                badAnsv.Content = 0;
                goodAnsv.Content = 0;
                indexOfCurrentWord = random.Next(0, words.Count);
                if (selectedType == 0)
                    foreginWord.Text = words.ElementAt<Word>(indexOfCurrentWord).Basic;
                else
                    foreginWord.Text = words.ElementAt<Word>(indexOfCurrentWord).Foregin;

            }
            else if (this.type == 3) {
                label5.Visibility = Visibility.Visible;

                Random random = new Random();
                //int randomNumber = random.Next(0, 100);
                words = sql.getWordsFromGroups(selectedGroups);
                howMuchAll.Content = words.Count;
                progressBar1.Maximum = words.Count;
                badAnsv.Content = 0;
                goodAnsv.Content = 0;
                indexOfCurrentWord = random.Next(0, words.Count);
                label5.MouseDown += new MouseButtonEventHandler(label5_MouseDown );
                if (selectedType == 0)
                    foreginWord.Text = words.ElementAt<Word>(indexOfCurrentWord).Basic;
                else
                    foreginWord.Text = words.ElementAt<Word>(indexOfCurrentWord).Foregin;
            }
        }
        private void setSelectedProgramme()
        {
            List<CourseProgrammePart> programmeParts = DatabaseConnection.readCourseProgrammePart(departmentWindow.selectedProgramme);

            // Clear tree before repopulating
            //
            treeView.Items.Clear();

            // Count the number of parts of the programme
            //
            List<String> listOfParts = new List<String>();
            foreach(CourseProgrammePart courseProgrammePart in programmeParts)
            {
                bool isPartFound = false;
                foreach(String part in listOfParts)
                {
                    if (courseProgrammePart.part == part)
                    {
                        isPartFound = true;
                        break;
                    }
                }

                if (!isPartFound)
                {
                    listOfParts.Add(courseProgrammePart.part);
                }
            }

            TreeViewItem[] partItems = new TreeViewItem[listOfParts.Count];
            for (int i = 0; i < partItems.Length; i++)
            {
                if (partItems[i] == null)
                {
                    partItems[i] = new TreeViewItem();
                }

                partItems[i].IsExpanded = false;

                // Create stack panel
                //
                StackPanel stack = new StackPanel();
                stack.Orientation = Orientation.Horizontal;
                var background = new SolidColorBrush(Colors.White);
                stack.Background = background;
                background.Opacity = 100;

                // Create Image
                //
                //Image image = new Image();
                //image.Source = new BitmapImage(new Uri(BasicManipulation.Properties.Resources.programmeIcon));

                // Part Label
                //
                Label partLabel = new Label();
                partLabel.Content = "PART " + listOfParts.ElementAt(i);

                List<Course> programmeCourses = DatabaseConnection.readCoursesUsingProgrammePart(departmentWindow.selectedProgramme, listOfParts.ElementAt(i));
                foreach(Course programmeCourse in programmeCourses)
                {
                    TreeViewItem programmeCourseItem = new TreeViewItem();

                    programmeCourseItem.IsExpanded = false;

                    createCourseListButton(programmeCourseItem, BasicManipulation.Properties.Resources.programmeIcon, programmeCourse.id);

                    partItems[i].Items.Add(programmeCourseItem);
                }

                // Add into stack
                //stack.Children.Add(image);
                stack.Children.Add(partLabel);

                // assign stack to header
                partItems[i].Header = stack;

                treeView.Items.Add(partItems[i]);
            }
        }
 /** Metoda care se foloseste de bibliotecile AviManager pentru a
  * crea un stream video dintr-o lista de imagini format bitmap.
  **/
 private void createMovie(String fileName, List<Bitmap> images)
 {
     AviManager aviManager = new AviManager(fileName, false);
     VideoStream videoStream = aviManager.AddVideoStream(false, 30, images.ElementAt(0));
     foreach (var image in images)
     {
         if (finalFrames.IndexOf(image) != 0)
         {
             videoStream.AddFrame(image);
         }
     }
     aviManager.Close();
 }
 private void updateMemberList(List<string> ms)
 {
     this.dispatcher.Invoke((Action)(() =>
     {
         members_textBlock.Text = "";
         for (int i = 1; i <= ms.Count; i++) 
         {
             members_textBlock.Text += "  "+i +" : "+ ms.ElementAt(i-1) + "\n";
         }
     }));
 }
Example #16
0
        void interpretCommand(System.Windows.Media.PointCollection jointPositions, List<int> depthList)
        {
            //only take care of right hand first
            System.Windows.Point rightHandPoint = jointPositions.ElementAt(1);
            int rightHandDepth = depthList.ElementAt(1);

            System.Windows.Point leftHandPoint = jointPositions.ElementAt(0);
            int leftHandDepth = depthList.ElementAt(0);

            string textInString = "";
            MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_DUPLEX, 0.8, 0.8);

            double x_ratio = rightHandPoint.X / (double)currentColorFrame.Width;
            double y_ratio = rightHandPoint.Y / (double)currentColorFrame.Height;

            //distance range
            int zoom_min = 1000;
            int zoom_max = 1700;
            int zoom_buffer_count = 25;
            float radius = 25.0f;

            int click_buffer_count = 25;

            if (rightHandDepth > zoom_min && rightHandDepth < zoom_max) //airmouse
            {
                zoom_in_counter = 0;
                zoom_out_counter = 0;

                //textInString = "AirMouse";
                //commandMode = "AirMouse";

                //check if click action is activated (i.e., left-hand position is close to right-hand)
                if (Math.Abs(rightHandPoint.X - leftHandPoint.X) < 20 && Math.Abs(rightHandPoint.Y - leftHandPoint.Y) < 20) {
                    click_counter++;

                    if (click_counter > click_buffer_count)
                    {
                        textInString = "Click";
                        commandMode = "MOUSE_CLICK";
                        socket.kinectClick();
                        click_counter = 0;
                    }
                }
                else{
                    click_counter = 0;
                    textInString = "AirMouse";
                    commandMode = "AirMouse";
                    socket.kinectMove(x_ratio, y_ratio);
                }
                /*
                double x = rightHandPoint.X - center_width;
                double y = rightHandPoint.Y - center_height;
                double distance = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
                double radians = Math.Atan(y / x);
                double degree = (radians / Math.PI) * 180;
                degree = -degree;

                if (x < 0)
                {
                    degree = degree + 180;
                }
                else if (x > 0 && y > 0)
                {
                    degree = degree + 360;
                }

                textInString = "dist:" + Math.Round(distance).ToString() + " deg:" + Math.Round(degree).ToString() + " depth:" + rightHandDepth.ToString();

                socket.airMouse(degree, distance);
                */
                //socket.kinectMove(x_ratio, y_ratio);

            }
            else if (rightHandDepth < zoom_min) //zoom_in
            {
                radius = 40.0f;
                socket.stopAirmouse();
                zoom_out_counter = 0;
                zoom_in_counter++;
                commandMode = "ZoomIn";
                textInString = "ZoomIn";

                if (zoom_in_counter > zoom_buffer_count)
                {
                    socket.zoomIn();
                    zoom_in_counter = 0;
                }

            }
            else if (rightHandDepth > zoom_max){ //zoom_out
                radius = 15.0f;
                socket.stopAirmouse();
                zoom_in_counter = 0;
                zoom_out_counter++;
                commandMode = "ZoomOut";
                textInString = "ZoomOut";

                if (zoom_out_counter > zoom_buffer_count)
                {
                    socket.zoomOut();
                    zoom_out_counter = 0;

                }
            }

            /*
            //check if it is in green zone for ZOOM_IN/ZOOM_OUT
            if (rightHandPoint.X < center_width + margin_right &&
                rightHandPoint.X > center_width - margin_left &&
                rightHandPoint.Y < center_height + margin_down &&
                rightHandPoint.Y > center_height - margin_up)
            {
                socket.stopAirmouse();

                //zoom-in/zoom-out mode
                if (rightHandDepth < zoom_in_max && rightHandDepth > zoom_in_min) {
                    textInString = "ZOOM_IN:" + rightHandDepth.ToString();
                    zoom_out_counter = 0;
                    zoom_in_counter++;
                    if (zoom_in_counter > zoom_buffer_count)
                    {
                        socket.zoomIn();
                        zoom_in_counter = 0;
                    }

                }
                else if (rightHandDepth < zoom_out_min && rightHandDepth > zoom_in_max) {
                    textInString = "NONE:" + rightHandDepth.ToString();
                }
                else if (rightHandDepth < zoom_out_max && rightHandDepth > zoom_out_min)
                {
                    textInString = "ZOOM_OUT:" + rightHandDepth.ToString();
                    zoom_in_counter = 0;
                    zoom_out_counter++;
                    if (zoom_out_counter > zoom_buffer_count)
                    {
                        socket.zoomOut();
                        zoom_out_counter = 0;
                    }
                }
                else {
                    textInString = "NONE:" + rightHandDepth.ToString();
                }

            }
            else {
                //calcuate the distance between center and angle degree

                double x = rightHandPoint.X - center_width;
                double y = rightHandPoint.Y - center_height;
                double distance = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
                double radians = Math.Atan(y/x);
                double degree = (radians / Math.PI) * 180;
                degree = -degree;

                if (x < 0) {
                    degree = degree + 180;
                }
                else if (x > 0 && y > 0) {
                    degree = degree + 360;
                }

                textInString = "dist:" + Math.Round(distance).ToString() + " deg:" + Math.Round(degree).ToString() + " depth:" + rightHandDepth.ToString();

                socket.airMouse(degree, distance);
            }
            */
            //overaly right hand
            Bgr bgr;
            /*
            if(commandMode == "AirMouse")
                bgr = new Bgr(200, 200, 200); //Red for hands
            else if(commandMode == "ZoomIn")
                bgr = new Bgr(100, 0, 100); //Red for hands
            else if(commandMode == "ZoomOut")
                bgr = new Bgr(0, 200, 0); //Red for hands
            else
                bgr = new Bgr(0, 0, 255); //Red for hands
            */
            bgr = new Bgr(100, 0, 100);

            //convert point type
            System.Drawing.PointF point = new System.Drawing.PointF((float)rightHandPoint.X, (float)rightHandPoint.Y);
            CircleF circle = new CircleF();
            circle.Center = point;

            //set radius/stroke according to the depth
            float ratio = (float)(max_depth_range - rightHandDepth) / (float)(max_depth_range - min_depth_range);
            if (ratio < 0)
                ratio = 0;

            //float radius = 40.0f * ratio;

            int stroke = (int)(40.0f * ratio);
            circle.Radius = radius;
            currentColorFrame.Draw(circle, bgr, -1);

            //System.Drawing.Point textLoc = new System.Drawing.Point((int)rightHandPoint.X, (int)rightHandPoint.Y);
            System.Drawing.Point textLoc = new System.Drawing.Point(300, 30);
            currentColorFrame.Draw(textInString, ref font, textLoc, new Bgr(0, 0, 0));
        }
Example #17
0
        void drawJointPositions(System.Windows.Media.PointCollection jointPositions, List<int> depthList)
        {
            int jointIdx = 0;
            foreach (System.Windows.Point onePoint in jointPositions)
            {
                Bgr bgr;
                //if (jointIdx % 3 == 0)
                //  bgr = new Bgr(255, 0, 0); //Blue for head
                //else
                bgr = new Bgr(100, 100, 100); //Red for hands

                //convert point type
                System.Drawing.PointF point = new System.Drawing.PointF((float)onePoint.X, (float)onePoint.Y);
                CircleF circle = new CircleF();
                circle.Center = point;

                //set radius/stroke according to the depth
                float ratio = (float)(max_depth_range - depthList.ElementAt(jointIdx)) / (float)(max_depth_range - min_depth_range);
                if (ratio < 0)
                    ratio = 0;

                float radius = 40.0f * ratio;
                int stroke = (int)(40.0f * ratio);
                circle.Radius = radius;
                currentColorFrame.Draw(circle, bgr, -1);

                MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_DUPLEX, 0.5, 0.5);
                string depthInString = depthList.ElementAt(jointIdx).ToString() + "mm";
                System.Drawing.Point textLoc = new System.Drawing.Point((int)onePoint.X, (int)onePoint.Y);
                currentColorFrame.Draw(depthInString, ref font, textLoc, new Bgr(0, 0, 0));

                jointIdx++;
            }
        }
Example #18
0
 //Hjælpe event til products: lytter på om selection ændres i datagrided
 private void Event_SelectionChanged(object sender, RoutedEventArgs e)
 {
     List<Product> l = new List<Product>();
     l = db.Products.ToList();
     Product pe = new Product();
     if (grid.SelectedItem != null)
     {
         pe = (Product)grid.SelectedItem;
         img.Source = service.getImage(pe.name);
     }
     else
     {
         grid.SelectedItem = l.ElementAt(0);
     }
 }
Example #19
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Définissez le mode de partage de l'appareil graphique pour activer le rendu XNA
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);

            // Créer un nouveau SpriteBatch, qui peut être utilisé pour dessiner des textures.
            spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);

            // TODO: utilisez ce contenu pour charger ici le contenu de votre jeu
            //background = contentManager.Load<Texture2D>("");


            _fond1 = new Image_Texture(0, "fond1_MiniJeu", "fond1", new Vector2(3, 279), 794, 155);
            _fond2 = new Image_Texture(0, "fond2_MiniJeu", "fond2", new Vector2(61, 110), 678, 170);
            _fond3 = new Image_Texture(0, "fond3_MiniJeu", "fond3", new Vector2(143, 20), 514, 90);
            _fond1.LoadContent(contentManager); 
            _fond2.LoadContent(contentManager);
            _fond3.LoadContent(contentManager);

            _jauge = new Image_Texture(0, "jauge_MiniJeu", "jauge", new Vector2(650, 440), 40, 500);
            _jauge.LoadContent(contentManager);
            _jaugeInterieur = new Rectangle(159, 443, -2 , 30);

            _fourFroid = new List<Image_Texture>();
            for (int i = 0; i < 6; i++)
            {
                _fourFroid.Add(new Image_Texture(0, "fourFroid_MiniJeu", "tete_victor", new Vector2(900, 500), 151, 200));
                _fourFroid.ElementAt(i).LoadContent(contentManager);
            }

            _fourChaud = new List<Image_Texture>();
            for (int i = 0; i < 6; i++)
            {
                _fourChaud.Add(new Image_Texture(0, "fourFroid_MiniJeu", "fourChaud", new Vector2(900, 500), 200, 200));
                _fourChaud.ElementAt(i).LoadContent(contentManager);

            }
            _trouOccupe = new List<short>();
            for (int i = 0; i < 6; i++)
            {
                _trouOccupe.Add(-1);

            }
            _fourFroidMonte = new List<int>();
            for (int i = 0; i < 6; i++)
            {
                _fourFroidMonte.Add(0);

            }
            _fourChaudMonte = new List<int>();
            for (int i = 0; i < 6; i++)
            {
                _fourChaudMonte.Add(0);

            }

            _fourTape = 0;

            TouchPanel.EnabledGestures = GestureType.Tap;

            
            _affichageTempsRestant = contentManager.Load<SpriteFont>(@"SpriteFont1");
            _tempsRestant = TimeSpan.Zero;
            _fini = false;
            _soundEffect = contentManager.Load<SoundEffect>(@"fourSon");

            //on parse
            var data = this.NavigationContext.QueryString;
            recreation = bool.Parse(data["recreation"]);
            if (!recreation)
            {
                scene = data["scene"];
                niveau = data["niveau"];
            }


            //On s'occupe du fond
            _textureBackground = contentManager.Load<Texture2D>(@"background");
            _rectangle1Background = new Rectangle(0, 0, 800, 230);
            _rectangle2Background = new Rectangle(0, 230, 800, 200);
            _rectangle3Background = new Rectangle(0, 430, 800, 50);


            debut = true;

            // Démarrez la minuterie
            timer.Start();

            base.OnNavigatedTo(e);
        }
Example #20
0
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
            //url = "{\"url\":\"DROPDOWN/DROPDOWN_1\"}";

            //url = "{\"url\":\"BL/BL_1\"}";
            url = "{\"url\":\"LYW/LYW_1\"}";
            System.Diagnostics.Debug.WriteLine(url);
            //加密
            url = Encryption_Base64.Base64Code(url);
            // 实例化客户端代理类
            ServiceReference1.Service1SoapClient MyClient = new ServiceReference1.Service1SoapClient();
            // 绑定回调事件
            MyClient.IOS_VSFileReadByIDCompleted += (s, arg) =>
                {
                    textstate.Text = "请求完成";
                    if (arg.Error != null)
                    {
                        System.Diagnostics.Debug.WriteLine(arg.Error);
                        return;
                    }
                    if (arg.Result != null)
                    {
                        System.Diagnostics.Debug.WriteLine("**********Result**********");
                        //解密返回json
                        stringJson = Decryption_Base64.Base64Decode(arg.Result);
                        // json 格式化
                       stringJson=FormatJson(stringJson);
                       System.Diagnostics.Debug.WriteLine(stringJson);
                        //解析
                        NodeInfo nodeInfo = JsonParser.Deserialize<NodeInfo>(stringJson);
                        System.Diagnostics.Debug.WriteLine(nodeInfo.message);
                        //获取所有控件类型
                        List<string> ctltype=new List<string>();
                        if (nodeInfo.data.ControlCount == 1) {
                            int indexstart = stringJson.IndexOf("ControlType" );
                            int indexend = stringJson.IndexOf("ControlCount" );
                            string ss = stringJson.Substring(indexstart - 2, indexend - indexstart - 1);
                            ctltype.Add(ss);
                        }else
                        {
                            int tempstart = 0;
                            for (int i = 0; i < nodeInfo.data.ControlCount; i++)
                            {
                                if (i == nodeInfo.data.ControlCount-1)
                                {
                                    int start = stringJson.IndexOf("ControlType", 1 + tempstart);
                                    int end = stringJson.IndexOf("ControlCount");
                                    string sl = stringJson.Substring(start - 2, end - start - 1);
                                    ctltype.Add(sl);
                                    break;
                                }
                                else
                                {
                                    int indexstart = stringJson.IndexOf("ControlType", 1 + tempstart);
                                    int indexend = stringJson.IndexOf("ControlType", 1 + indexstart);
                                    tempstart = indexstart;
                                    string ss = stringJson.Substring(indexstart - 2, indexend - indexstart - 1);
                                    ctltype.Add(ss);
                                }
                            }
                        }

                        //本地生成控件
                        for (int i = 0; i < nodeInfo.data.ControlCount; i++)
                        {
                            switch (nodeInfo.data.ControlList[i].ControlType)
                            {
                                case "DropDownList":
                                    Node_Dropdownlist nodedropdown = JsonParser.Deserialize<Node_Dropdownlist>(ctltype.ElementAt(i));
                                    ListPicker dropdownlist = new ListPicker();
                                    DropDownListView dropdownlistview = new DropDownListView( dropdownlist, nodedropdown);
                                    dropdownlist=dropdownlistview.Dropdownlistconfig();
                                    //添加到界面
                                    this.panel.Children.Add(dropdownlist);
                                    //生成下拉菜单控件
                                    System.Diagnostics.Debug.WriteLine(nodedropdown.ControlType);
                                    break;
                                case "BasicChart":
                                    Node_BasicChart nodebasicchart = JsonParser.Deserialize<Node_BasicChart>(ctltype.ElementAt(i));
                                    Position basicchart_p = new Position(nodeInfo, i);
                                    BasicChartGeneric bcview = new BasicChartGeneric(basicchart_p);
                                    switch (nodebasicchart.SeriesData[0].type)
                                    {
                                        case "column":
                                            this.NavigationService.Navigate(new Uri("/View/Columnview.xaml", UriKind.Relative));
                                            break;
                                        case "area":
                                            break;
                                        case "line":
                                            this.NavigationService.Navigate(new Uri("/View/ColumnChart.xaml", UriKind.Relative));
                                            break;
                                        case "bar":
                                            break;
                                        case "pie":
                                            break;
                                    }
                                    System.Diagnostics.Debug.WriteLine(nodebasicchart.ControlID);

                                    break;
                                case "DataGrid":
                                    Node_DataGrid nodedatagrid = JsonParser.Deserialize<Node_DataGrid>(ctltype.ElementAt(i));
                                    System.Diagnostics.Debug.WriteLine(nodedatagrid.ControlID);
                                    break;
                                case "Label":
                                    Node_Label nodelabel = JsonParser.Deserialize<Node_Label>(ctltype.ElementAt(i));
                                    TextBlock label = new TextBlock();
                                    LabelView labelview = new LabelView(label, nodelabel);
                                    label = labelview.Labelconfig();
                                    this.panel.Children.Add(label);
                                    System.Diagnostics.Debug.WriteLine(nodeInfo.data.ControlList[i].ControlType);
                                    break;
                            }
                        }

                    }
                };
            //调用异步方法
            textstate.Text = "正在请求,请等候……";
            MyClient.IOS_VSFileReadByIDAsync(url);
        }
Example #21
0
        private void convertToLSTMData_Click(object sender, RoutedEventArgs e)
        {
            //TODO: Dateien gleich --> evtl in einem durchgang?????

            StreamReader srHand = new StreamReader(@"C:\CNTK\SLRS\hands\Output.out");
            StreamReader srDist = new StreamReader(@"C:\CNTK\SLRS\distance\Output.out");

            List<string> listHandTemp = new List<string>();
            List<string> listDistTemp = new List<string>();
            List<string> listHand = new List<string>();
            List<string> listDist = new List<string>();

            int takeLastFew = 2;

            while (!srDist.EndOfStream)
            {
                var line = srDist.ReadLine();
                if (!line.Contains("==="))
                {
                    if (line.Contains('%'))
                        line = line.Remove(line.IndexOf('%'));
                    listDistTemp.Add(line.Trim());
                }
                else
                {
                    for (var i = takeLastFew; i > 0; i--)
                        listDist.Add(listDistTemp.ElementAt(listDistTemp.Count - i));
                    listDistTemp.Clear();
                }
            }
            srDist.Close();

            //TODO: Datei manuell abändern, da nach 0 die 10 folgt
            while (!srHand.EndOfStream)
            {
                var line = srHand.ReadLine();
                if (!line.Contains("==="))
                {
                    if (line.Contains('%'))
                        line = line.Remove(line.IndexOf('%'));
                    listHandTemp.Add(line.Trim());
                }
                else
                {
                    for (var i = takeLastFew; i > 0; i--)
                        listHand.Add(listHandTemp.ElementAt(listHandTemp.Count - i));
                    listHandTemp.Clear();
                }
            }
            srHand.Close();


            StreamWriter sw = new StreamWriter(@"C:\CNTK\SLRS\final\finalEvalData.txt", false);
            int seqPerGesture = 3;
            int gestureNo = 0;
            int sequenceNo = 0;

            for (var i = 0; i < listDist.Count; i++)
            {
                sw.WriteLine(String.Format("{0:000}{1:000} |L {2} |F {3} {4}", gestureNo,sequenceNo, Helper.gestureCode[gestureNo], listDist[i], listHand[i]));

                if (i % takeLastFew == (takeLastFew-1)) sequenceNo++;
                if (sequenceNo == seqPerGesture)
                {
                    sequenceNo = 0;
                    gestureNo++;
                }
            }
            sw.Flush();
            sw.Close();

            MessageBox.Show("Done");
        }
 private void ProcessAction()
 {
     currentAction.DetermineBestFrames(actionFrames);
     actionFrames = KinectFrameUtils.GetStartCorrectedFrames(actionFrames, currentAction.bestFrames);
     currentAction.ShiftBestFrames(actionFrames.ElementAt(0).Joints[JointType.HipCenter].Position);
     cpm = CompareMode.SIMUL_ACTION;
     dm = DemoMode.NONE;
     correctBonePen = new Pen(Brushes.Blue, 6);
 }
        private static List<Skeleton> RemoveFrames(List<Skeleton> skels, int nFrames)
        {
            int diff = skels.Count - nFrames;
            List<Skeleton> result = new List<Skeleton>();

            List<double> dists = new List<double>();
            for (int i = 0; i < skels.Count - 1; i++)
            {
                dists.Add(GetDistBetweenFrames(skels.ElementAt(i), skels.ElementAt(i + 1)));
            }

            List<int> ignore = new List<int>();
            int j = 0;
            while (j < diff)
            {
                double min = dists.Min();
                int index = dists.IndexOf(min);
                if (index < skels.Count - 3)
                {
                    ignore.Add(index);
                    j++;
                }
                dists.RemoveAt(index);
            }

            for (int i = 0; i < skels.Count; i++)
            {
                if (ignore.Contains(i))
                {
                    continue;
                }

                result.Add(skels.ElementAt(i));
            }

            return AlignFrames(result, nFrames);
        }
 public static double GetTotalDistTraveled(List<Skeleton> frames)
 {
     double result = 0;
     for (int i = 0; i < frames.Count - 1; i++)
     {
         result += GetDistBetweenFrames(frames.ElementAt(i), frames.ElementAt(i + 1));
     }
     return result;
 }
        /* User selects a item in the list box
         *
         */
        private void boxHistory_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            List<string> details = new List<string>();
            string o = "";

            try
            {
                //cur treatment is set to index of item selected
                curTreatment = boxHistory.SelectedIndex;

                //Get details of the treatment
                details = control.getTreatmentDetails(curTreatment);

                //Populate the details based on information received
                boxTreatmentType.SelectedValue = details.ElementAt(0);
                boxDoctors.SelectedValue = details.ElementAt(7);

                o = details.ElementAt(1) + "/" + details.ElementAt(2) + "/" + details.ElementAt(3);

                boxDate.Text = o;

                boxTime.SelectedValue = Convert.ToDateTime(details.ElementAt(4));
                txtNotes.Text = details.ElementAt(5);
            }
            catch (FormatException)
            {
                MessageBox.Show("Error retreiving values from database");
            }
            catch (Exception)
            {
                MessageBox.Show("Error retreiving values from database or displaying information");
            }
        }
Example #26
0
        public ModifyWindow(List<Bejegyzés> l, DataGrid d, int t, List<PénzMozgás> ILista, List<PénzMozgás> IILista, List<PénzMozgás> IIILista, List<PénzMozgás> IVLista, List<PénzMozgás> VLista, List<PénzMozgás> XIAaLista, List<PénzMozgás> XIAbLista, List<PénzMozgás> XIBaLista, List<PénzMozgás> XIBbLista, List<PénzMozgás> XIILista, List<PénzMozgás> XIIILista, List<PénzMozgás> XIVLista, List<PénzMozgás> XVLista, List<PénzMozgás> XVILista, List<PénzMozgás> XVIILista, List<PénzMozgás> XVIIILista)
        {
            InitializeComponent();
            this.list = l;
            this.d = d;
            this.t = t;
            fizetesBox.Text = l.ElementAt(t).fizetésIdeje;
            meghegyzesBox.Text = l.ElementAt(t).megjegyzés;
            fokonyvComboBox.SelectedItem = l.ElementAt(t).főkönyv;

            comboboxFeltolt(ILista);
            comboboxFeltolt(IILista);
            comboboxFeltolt(IIILista);
            comboboxFeltolt(IVLista);
            comboboxFeltolt(VLista);
            comboboxFeltolt(XIAaLista);
            comboboxFeltolt(XIAbLista);
            comboboxFeltolt(XIBaLista);
            comboboxFeltolt(XIBbLista);
            comboboxFeltolt(XIILista);
            comboboxFeltolt(XIIILista);
            comboboxFeltolt(XIVLista);
            comboboxFeltolt(XVLista);
            comboboxFeltolt(XVILista);
            comboboxFeltolt(XVIILista);
            comboboxFeltolt(XVIIILista);

            if (l.ElementAt(t).bankiBevétel != 0)
            {
                changeLabel.Content = "Banki bevétel";
                changeBox.Text = l.ElementAt(t).bankiBevétel.ToString();
            }
            if (l.ElementAt(t).bankiKiadás != 0)
            {
                changeLabel.Content = "Banki kiadás";
                changeBox.Text = l.ElementAt(t).bankiKiadás.ToString();
            }
            if (l.ElementAt(t).pénztáriBevétel != 0)
            {
                changeLabel.Content = "Pénztári bevétel";
                changeBox.Text = l.ElementAt(t).pénztáriBevétel.ToString();
            }
            if(l.ElementAt(t).pénztáriKiadás != 0)
            {
                changeLabel.Content = "Pénztári kiadás";
                changeBox.Text = l.ElementAt(t).pénztáriKiadás.ToString();
            }
            this.Left = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right - (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right / 2) - (this.Width / 2);
            this.Top = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom - (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom / 2) - (this.Height / 2);
        }
        private static List<Skeleton> InterpolateFrames(List<Skeleton> skels, int nFrames)
        {
            int diff = nFrames - skels.Count;
            List<Skeleton> result = skels;

            List<double> dists = new List<double>();
            for (int i = 0; i < skels.Count - 1; i++)
            {
                dists.Add(GetDistBetweenFrames(skels.ElementAt(i), skels.ElementAt(i + 1)));
            }

            for (int i = 0; i < diff; i++)
            {
                if (dists.Count == 0)
                {
                    break;
                }
                double max = dists.Min();
                int index = dists.IndexOf(max);

                Skeleton insert = GetMidFrame(skels.ElementAt(index), skels.ElementAt(index + 1));
                result.Insert(index, insert);
                dists.RemoveAt(index);
            }

            return AlignFrames(result, nFrames);
        }
        public void CompareWithTextFile(DataSet sheet)
        {
            if(string.IsNullOrEmpty(textFilePath))
            {
                OpenFileDialog TextFile = new OpenFileDialog();
                TextFile.Multiselect = false;
                TextFile.DefaultExt = ".txt";
                TextFile.Filter = "Text File (*.txt) |*.txt";
                if (TextFile.ShowDialog() == true)
                    textFilePath = TextFile.FileName;
            }

            AllNames = new List<string>();
            using (TextReader txt = new StreamReader(textFilePath))
            {
                string s = string.Empty;
                while ((s = txt.ReadLine()) != null)
                    AllNames.Add(s);
            }
            for (int i = 0; i < AllNames.Count; i++)
            {
                string s = sheet.Tables[0].Rows[i]["Name"].ToString();
                if (!AllNames.ElementAt(i).Equals(s, StringComparison.OrdinalIgnoreCase))
                    sheet.Tables[0].Rows.InsertAt(sheet.Tables[0].NewRow(), i);
            }
        }
        private void GetRoute(List<Stop> stops)
        {
            // Create the service variable and set the callback method using the CalculateRouteCompleted property.
            RouteService.RouteServiceClient routeService = new RouteService.RouteServiceClient("BasicHttpBinding_IRouteService");
            routeService.CalculateRouteCompleted += new EventHandler<RouteService.CalculateRouteCompletedEventArgs>(routeService_CalculateRouteCompleted);

            // Set the token.
            RouteService.RouteRequest routeRequest = new RouteService.RouteRequest();
            routeRequest.Credentials = new Credentials();
            routeRequest.Credentials.ApplicationId = ((ApplicationIdCredentialsProvider)map1.CredentialsProvider).ApplicationId;

            // Return the route points so the route can be drawn.
            routeRequest.Options = new RouteService.RouteOptions();
            routeRequest.Options.RoutePathType = RouteService.RoutePathType.Points;

            routeRequest.Waypoints = new System.Collections.ObjectModel.ObservableCollection<RouteService.Waypoint>();
            int max = stops.Count() > 25 ? 25 : stops.Count();
            for (int i = 0; i < max; i++)
            {
                Stop stop = stops.ElementAt(i);
                RouteService.Waypoint srcWaypoint = new RouteService.Waypoint();
                srcWaypoint.Location = new GeoCoordinate((double)stop.Latitude, (double)stop.Longitude);
                routeRequest.Waypoints.Add(srcWaypoint);
            }

            // Make the CalculateRoute asnychronous request.
            routeService.CalculateRouteAsync(routeRequest);
        }
        public void Ignore_Names_2Sheets()
        {
            int num;
            List<string> BeginList = new List<string>(), EndList = new List<string>(), CombList = new List<string>();
            for (int i = 0; i < NumNamesRowBegin; i++)
                BeginList.Add(beginDSBubble.Tables[0].Rows[i]["Name"].ToString().ToLower().Trim());

            for (int j = 0; j < NumNamesRowEnd; j++)
                EndList.Add(endDSBubble.Tables[0].Rows[j]["Name"].ToString().ToLower().Trim());

            if (BeginList.Count <= EndList.Count)
            {
                for (int k = 0; k < BeginList.Count; k++)
                {
                    if (EndList.Contains(BeginList.ElementAt(k)))
                        CombList.Add(BeginList.ElementAt(k));
                }
            }

            else
            {
                for (int l = 0; l < EndList.Count; l++)
                {
                    if (BeginList.Contains(EndList.ElementAt(l)))
                        CombList.Add(EndList.ElementAt(l));
                }
            }

            for (int i = 0; i < NumNamesRowBegin; i++)
            {
                string name = beginDSBubble.Tables[0].Rows[i]["Name"].ToString().ToLower().Trim();
                if (!CombList.Contains(name))
                {
                    beginDSBubble.Tables[0].Rows.RemoveAt(i);
                    NumNamesRowBegin--;
                    i--;
                }
            }

            for (int i = 0; i < NumNamesRowEnd; i++)
            {
                string name = endDSBubble.Tables[0].Rows[i]["Name"].ToString().ToLower().Trim();
                if (!CombList.Contains(name))
                {
                    endDSBubble.Tables[0].Rows.RemoveAt(i);
                    NumNamesRowEnd--;
                    i--;
                }
            }

            for (int i = ColNumBegin; i > 0; i--)
            {
                var table = beginDSBubble.Tables[0];
                var columns = table.Columns;
                var nameColumn = columns["Name"];

                string test = columns[i].ColumnName.ToLower();
                foreach (char c in test)
                {
                    if (int.TryParse(c.ToString(), out num))
                        test = test.Remove(test.IndexOf(c));
                }
                test = test.Trim();
                if (!CombList.Contains(test))
                {
                    if (!BoolDisableNameBox)
                    {
                        if (MessageBox.Show(test + " is not in the 'Name' column. Continue?", "Name does not exist.",
                            MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                            return;
                    }
                    columns.RemoveAt(i);
                    SubtractedNamesBegin++;
                }
            }

            for (int i = ColNumEnd; i > 0; i--)
            {
                var table = endDSBubble.Tables[0];
                var columns = table.Columns;
                var nameColumn = columns["Name"];

                string test = columns[i].ColumnName.ToLower();
                foreach (char c in test)
                {
                    if (int.TryParse(c.ToString(), out num))
                        test = test.Remove(test.IndexOf(c));
                }
                test = test.Trim();
                if (!CombList.Contains(test))
                {
                    if (!BoolDisableNameBox)
                    {
                        if (MessageBox.Show(test + " is not in the 'Name' column. Continue?", "Name does not exist.",
                            MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                            return;
                    }
                    columns.RemoveAt(i);
                    SubtractedNamesEnd++;
                }
            }

            SubtractedNamesEnd = Math.Abs(ColNumEnd - SubtractedNamesEnd);
            for (int k = SubtractedNamesEnd; k > 0; k--)
                endDSBubble.Tables[0].Rows[k - 1][k] = 0;

            SubtractedNamesBegin = Math.Abs(ColNumBegin - SubtractedNamesBegin);
            for (int k = SubtractedNamesBegin; k > 0; k--)
                beginDSBubble.Tables[0].Rows[k - 1][k] = 0;
        }