private void PersonList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Application       curApp             = Application.Current;
            Window            mainWindow         = curApp.MainWindow;
            CharacterSelector GoodCharacter      = (CharacterSelector)mainWindow.FindName("GoodCharacter");
            Badged            GoodSelectionBadge = (Badged)mainWindow.FindName("GoodSelectionBadge");
            CharacterSelector BadCharacter       = (CharacterSelector)mainWindow.FindName("BadCharacter");
            Badged            BadSelectionBadge  = (Badged)mainWindow.FindName("BadSelectionBadge");

            if (GoodCharacter.PersonList.SelectedItems.Count < 5)
            {
                GoodSelectionBadge.Badge = GoodCharacter.PersonList.SelectedItems.Count;
            }
            else
            {
                GoodCharacter.PersonList.SelectedItems.RemoveAt(4);
            }

            if (BadCharacter.PersonList.SelectedItems.Count < 5)
            {
                BadSelectionBadge.Badge = BadCharacter.PersonList.SelectedItems.Count;
            }
            else
            {
                BadCharacter.PersonList.SelectedItems.RemoveAt(4);
            }
        }
示例#2
0
        public void WhenSetABadgeIsBadgeSetIsTrue()
        {
            Badged badged = new Badged();

            badged.Badge = new Button();
            Assert.NotNull(badged.Badge);
            Assert.True(badged.IsBadgeSet);
        }
示例#3
0
 public ButtonView()
 {
     this.InitializeComponent();
     _badged = this.FindControl <Badged>("CountingBadge");
     this.FindControl <Button>("btnClickMe").Click += (o, e) =>
     {
         _badged.Badge = _clickCounter++;
     };
 }
示例#4
0
        public void WhenInitialiseThePropertiesAreInitializedCorrectly()
        {
            Badged badged = new Badged();

            Assert.Null(badged.Badge);
            Assert.Null(badged.BadgeBackground);
            Assert.Null(badged.BadgeForeground);
            Assert.True(badged.BadgePlacementMode == BadgePlacementMode.TopLeft);
            Assert.True(badged.BadgeMargin == new Thickness(0));
            Assert.False(badged.IsBadgeSet);
        }
        private void LoadData(string titleBar, Tuple <string, int>[] arr, RoutedEventHandler method, Visibility btnNextVisibility, Visibility btnPrevVisibility)
        {
            try
            {
                CreditDeterminer creditDeterminer = null;
                if (File.Exists(DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CreditDeterminerSavedName))
                {
                    FileServiceProvider.DeserializeFromXmlFile(DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CreditDeterminerSavedName, out creditDeterminer);
                }
                else
                {
                    creditDeterminer = new CreditDeterminer
                    {
                        Level1 = CurriculumWpfClientMiddleware.DefaultLevel1Value,
                        Level2 = CurriculumWpfClientMiddleware.DefaultLevel2Value,
                    };
                    FileServiceProvider.SerializeToXmlFile(DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CreditDeterminerSavedName, creditDeterminer);
                }

                wrapPanelList.Children.Clear();
                txtblockTitleBar.Text = titleBar;

                for (int i = 0; i < arr.Length; i++)
                {
                    Badged badged = new Badged();
                    badged.Badge  = (i + 1).ToString();
                    badged.Margin = new Thickness(15);
                    badged.Name   = "bdg" + arr[i].Item2;

                    Button button = new Button();
                    button.Content = arr[i].Item1;
                    button.Name    = "btn" + arr[i].Item2;

                    if (creditDeterminer.Level1 == arr[i].Item2 || creditDeterminer.Level2 == arr[i].Item2)
                    {
                        button.SetResourceReference(Button.BackgroundProperty, "PrimaryHueMidBrush");
                    }
                    else
                    {
                        button.Background = Brushes.Transparent;
                    }


                    button.Click  += method;
                    badged.Content = button;

                    wrapPanelList.Children.Add(badged);
                }

                btnNext.Visibility = btnNextVisibility;
                btnPrev.Visibility = btnPrevVisibility;
            }
            catch { }
        }
        private void Thumbnails_Show(string FilePath) //Добавление миниатюры изображения
        {
            //Создание миниатюры изображения
            System.Windows.Controls.Image ImageToAdd = new System.Windows.Controls.Image()
            {
                Width = 80, Height = 80
            };
            ImageToAdd.Source = new BitmapImage(new Uri(FilePath));
            //Создание подсказки при наведении мыши
            System.Windows.Controls.Image ToolTipImage = new System.Windows.Controls.Image {
                Height = 450
            };
            ToolTipImage.Source = ImageToAdd.Source;
            System.Windows.Controls.ToolTip ToolTip = new System.Windows.Controls.ToolTip
            {
                Content   = ToolTipImage,
                Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse
            };
            ImageToAdd.ToolTip = ToolTip;
            //Создание кнопки удаления изображения
            Badged Badge = new Badged()
            {
                Margin = new Thickness(15, 15, 0, 0)
            };

            Badge.BadgeBackground = null;
            System.Windows.Controls.Button DeleteButton = new System.Windows.Controls.Button()
            {
                Width = 24, Height = 24, Padding = new Thickness(0)
            };
            DeleteButton.Style       = FindResource("MaterialDesignFloatingActionButton") as Style;
            DeleteButton.Background  = new SolidColorBrush(Colors.Red);
            DeleteButton.BorderBrush = new SolidColorBrush(Colors.Red);
            DeleteButton.Foreground  = new SolidColorBrush(Colors.White);
            //Создание иконки на кнопке удаления изображения
            PackIcon DeleteIcon = new PackIcon()
            {
                Width = 18, Height = 18
            };

            DeleteIcon.Kind      = PackIconKind.Delete;
            DeleteButton.Content = DeleteIcon;
            //Добавление обработчика события
            DeleteButton.Click += new RoutedEventHandler(Delete_Click);
            Badge.Badge         = DeleteButton;
            Badge.Content       = ImageToAdd;
            Badge.Tag           = FilePath;
            //Добавление миниатюры на форму
            ImagesContainer.Children.Add(Badge);
            //Количество файлов изображений
            FilesCount.Text = ImagesContainer.Children.Count.ToString();
        }
示例#7
0
        public void WhenSetABadgeBadgeChangedIsExecuted()
        {
            Badged badged     = new Badged();
            bool   isExecuted = false;

            badged.BadgeChanged += (o, e) =>
            {
                isExecuted = true;
            };
            badged.Badge = new Button();

            Assert.True(isExecuted);
        }
示例#8
0
 public void UpdateUnit(string unit, int count)
 {
     if (UnitLabels.TryGetValue(unit, out Badged badged))
     {
         badged.Badge = count;
     }
     else
     {
         badged = new Badged()
         {
             Badge   = count,
             Content = unit
         };
         UnitLabels.Add(unit, badged);
         LBSelectUnit.Items.Add(badged);
     }
 }
示例#9
0
        private void RemoveAttachedFileBadged_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Badged badged = sender as Badged;

                if (badged != null)
                {
                    AttachedFile file = _attachedFiles.FirstOrDefault(f => f.Id == Convert.ToInt32(badged.Tag.ToString()));

                    if (file != null)
                    {
                        _attachedFiles.Remove(file);
                    }
                }
            }
            catch
            {
                // ignored
            }
        }
示例#10
0
        private void RemoveRecipientBadged_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Badged badged = sender as Badged;

                if (badged != null)
                {
                    Recipient recipient = _recipients.FirstOrDefault(t => t.Id == Convert.ToInt32(badged.Tag.ToString()));

                    if (recipient != null)
                    {
                        _recipients.Remove(recipient);
                    }
                }
            }
            catch
            {
                // ignored
            }
        }
示例#11
0
        private Badged getTorrentButton(Torrent torrent)
        {
            Badged badge = new Badged();
            string txt   = torrent.quality + " " + torrent.type;

            badge.Badge = torrent.size;
            badge.BadgeColorZoneMode = ColorZoneMode.Dark;
            Button btn = new Button();

            Gcounter++;
            btn.Tag = Gcounter;
            links.Add(Gcounter, torrent.url);
            ButtonAssist.SetCornerRadius(btn, new CornerRadius(15));

            btn.Content  = txt;
            btn.FontSize = 10;

            btn.Click    += new RoutedEventHandler(buttonOnClick);
            badge.Content = btn;
            badge.Margin  = new Thickness(1, 10, 30, 1);
            return(badge);
        }
示例#12
0
        public void RechercherVideo(Object sender, RoutedEventArgs e, String nomPrise, int i, ColorZone Error, DirectoryInfo dir)
        {
            System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog();
            browse.RootFolder          = Environment.SpecialFolder.Desktop;
            browse.Description         = " +++ select folder +++";
            browse.ShowNewFolderButton = false;

            var test = false;

            if (browse.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[]      files = Directory.GetFiles(browse.SelectedPath);;
                DirectoryInfo diSrc = new DirectoryInfo(Environment.ExpandEnvironmentVariables(browse.SelectedPath));
                FileInfo[]    fi    = diSrc.GetFiles();
                foreach (FileInfo s in fi)
                {
                    if (s.Name == nomPrise)
                    {
                        s.CopyTo(dir.FullName + "\\" + s.Name, true);
                        StackPanel stackMedia = new StackPanel();
                        stackMedia.HorizontalAlignment = HorizontalAlignment.Center;
                        stackMedia.VerticalAlignment   = VerticalAlignment.Center;
                        stackMedia.Orientation         = Orientation.Vertical;

                        MediaElement myMedia = new MediaElement();
                        myMedia.Source         = new Uri(s.FullName, UriKind.RelativeOrAbsolute);
                        myMedia.LoadedBehavior = MediaState.Manual;
                        myMedia.Width          = 440;

                        StackPanel stackMediaButtons = new StackPanel();
                        stackMediaButtons.Orientation         = Orientation.Horizontal;
                        stackMediaButtons.HorizontalAlignment = HorizontalAlignment.Center;
                        stackMediaButtons.VerticalAlignment   = VerticalAlignment.Center;

                        StackPanel stackEnteteMedia = new StackPanel();
                        stackEnteteMedia.Orientation         = Orientation.Horizontal;
                        stackEnteteMedia.HorizontalAlignment = HorizontalAlignment.Center;
                        stackEnteteMedia.VerticalAlignment   = VerticalAlignment.Center;

                        Chip EnteteInfoMedia = new Chip();
                        EnteteInfoMedia.Content = "Nom Prise : " + nomPrise + "          Details : " + ComboBoxSequences.SelectedItem.ToString() + " / " + ComboBoxPlans.SelectedItem.ToString();
                        stackEnteteMedia.Children.Add(EnteteInfoMedia);

                        PackIcon playIcon = new PackIcon();
                        playIcon.Kind = PackIconKind.Play;
                        Button play = new Button();
                        play.Content = playIcon;
                        play.Click  += (Object, RoutedEventArgs) => { mediaPlay(sender, e, myMedia); };

                        PackIcon pauseIcon = new PackIcon();
                        pauseIcon.Kind = PackIconKind.Pause;
                        Button pause = new Button();
                        pause.Content = pauseIcon;
                        pause.Click  += (Object, RoutedEventArgs) => { mediaPause(sender, e, myMedia); };

                        PackIcon stopIcon = new PackIcon();
                        stopIcon.Kind = PackIconKind.Stop;
                        Button stop = new Button();
                        stop.Content = stopIcon;
                        stop.Click  += (Object, RoutedEventArgs) => { mediaStop(sender, e, myMedia); };

                        PackIcon muteIcon = new PackIcon();
                        muteIcon.Kind = PackIconKind.MusicNoteOff;
                        Button mute = new Button();
                        mute.Content = muteIcon;
                        mute.Click  += (Object, RoutedEventArgs) => { mediaMute(sender, e, myMedia, mute); };

                        ColorZone PriseZone = new ColorZone();
                        PriseZone.Background = Brushes.Green;

                        Separator espace1 = new Separator();
                        Separator espace2 = new Separator();
                        Label     lb1     = new Label();
                        Label     lb2     = new Label();
                        Label     lb3     = new Label();
                        Label     lb4     = new Label();
                        Label     lb5     = new Label();

                        stackMediaButtons.Children.Add(play);
                        stackMediaButtons.Children.Add(lb1);
                        stackMediaButtons.Children.Add(pause);
                        stackMediaButtons.Children.Add(lb2);
                        stackMediaButtons.Children.Add(stop);
                        stackMediaButtons.Children.Add(lb3);
                        stackMediaButtons.Children.Add(mute);


                        stackMedia.Children.Add(espace1);
                        stackMedia.Children.Add(stackEnteteMedia);
                        stackMedia.Children.Add(myMedia);
                        stackMedia.Children.Add(espace2);
                        stackMedia.Children.Add(lb4);
                        stackMedia.Children.Add(stackMediaButtons);
                        stackMedia.Children.Add(lb5);

                        PriseZone.Content = stackMedia;
                        Grid.SetRow(PriseZone, i);
                        gr.Children.Add(PriseZone);
                        test = true;
                        break;
                    }
                    else
                    {
                        test = false;
                    }
                }
                if (test == false)
                {
                    StackPanel stackErreur = new StackPanel();
                    stackErreur.HorizontalAlignment = HorizontalAlignment.Center;
                    stackErreur.VerticalAlignment   = VerticalAlignment.Center;
                    stackErreur.Orientation         = Orientation.Vertical;

                    ColorZone ErreurZone = new ColorZone();
                    ErreurZone.Background = Brushes.Red;

                    StackPanel stackEnteteErreur = new StackPanel();
                    stackEnteteErreur.HorizontalAlignment = HorizontalAlignment.Center;
                    stackEnteteErreur.VerticalAlignment   = VerticalAlignment.Center;
                    stackEnteteErreur.Orientation         = Orientation.Vertical;

                    Chip EnteteInfoErreur = new Chip();
                    EnteteInfoErreur.Content = "Nom Prise : " + nomPrise + "          Details : " + ComboBoxSequences.SelectedItem.ToString() + " / " + ComboBoxPlans.SelectedItem.ToString() + "   N'est pas trouvée";
                    stackEnteteErreur.Children.Add(EnteteInfoErreur);

                    StackPanel stackP = new StackPanel {
                    };
                    stackP.HorizontalAlignment = HorizontalAlignment.Center;
                    stackP.Margin      = new Thickness(8);
                    stackP.Orientation = Orientation.Horizontal;

                    Button rechercher = new Button();
                    rechercher.Content = "rechercher";
                    rechercher.Click  += (Object, RoutedEventArgs) => { RechercherVideo(sender, e, nomPrise, i, Error, dir); };

                    PackIcon ic = new PackIcon();
                    ic.Kind = PackIconKind.Refresh;

                    Badged rechercherBg = new Badged();
                    rechercherBg.HorizontalAlignment = HorizontalAlignment.Center;
                    rechercherBg.VerticalAlignment   = VerticalAlignment.Center;
                    rechercherBg.Badge   = ic;
                    rechercherBg.Content = rechercher;

                    stackP.Children.Add(rechercherBg);

                    stackEnteteErreur.Children.Add(stackP);

                    stackErreur.Children.Add(stackEnteteErreur);
                    ErreurZone.Content = stackErreur;
                    Grid.SetRow(ErreurZone, i);
                    gr.Children.Add(ErreurZone);
                    i++;
                    test = true;
                }
            }
        }
示例#13
0
        private async void valider_Click(object sender, RoutedEventArgs e)
        {
            pathChoisi.IsEnabled = false;

            DirectoryInfo di      = new DirectoryInfo(Environment.ExpandEnvironmentVariables(ResPathChoisi));
            DirectoryInfo diMovie = di.CreateSubdirectory(mv);

            listPr.Clear();
            gr.Children.Clear();
            gr.RowDefinitions.Clear();
            var res = "";

            if (cha.Value == 3)
            {
                res = "exellente";
            }
            else if (cha.Value == 2)
            {
                res = "moyenne";
            }
            else
            {
                res = "médiocre";
            }

            var nbRes = 0;

            if (ComboBoxSequences.SelectedItem.ToString() != "tout" && ComboBoxPlans.SelectedItem.ToString() != "tout")
            {
                DirectoryInfo diSeq  = diMovie.CreateSubdirectory(ComboBoxSequences.SelectedItem.ToString());
                DirectoryInfo diPlan = diSeq.CreateSubdirectory(ComboBoxPlans.SelectedItem.ToString());

                listPr.Clear();
                gr.Children.Clear();
                gr.RowDefinitions.Clear();
                var firebase = new FirebaseClient("https://applicationcliente.firebaseio.com/");
                var prises   = await firebase.Child(id).Child("movies").Child(mv).Child("Sequence").Child(ComboBoxSequences.SelectedItem.ToString()).Child("plans").Child(ComboBoxPlans.SelectedItem.ToString()).Child("listPrise").OrderByKey().OnceAsync <Prise>();

                var nbPl = prises.Count();
                foreach (var prise in prises)
                {
                    var namePrise = prise.Object.nomPrise + ".MP4";
                    if (prise.Object.note == res)
                    {
                        listPr.Add(namePrise);
                        MessageBox.Show(namePrise);
                        nbRes++;
                    }
                }
                if (nbRes != 0)
                {
                    var cpt = 0;
                    while (cpt < listPr.Count())
                    {
                        gr.RowDefinitions.Add(new RowDefinition());
                        cpt++;
                    }
                    System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog();
                    browse.RootFolder          = Environment.SpecialFolder.Desktop;
                    browse.Description         = " +++ selectionner un dossier +++";
                    browse.ShowNewFolderButton = false;
                    var i    = 0;
                    var test = false;

                    if (browse.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string[]      files = Directory.GetFiles(browse.SelectedPath);;
                        DirectoryInfo diSrc = new DirectoryInfo(Environment.ExpandEnvironmentVariables(browse.SelectedPath));
                        FileInfo[]    fi    = diSrc.GetFiles();

                        foreach (String pr in listPr)
                        {
                            foreach (FileInfo s in fi)
                            {
                                if (s.Name == pr)
                                {
                                    s.CopyTo(diPlan.FullName + "\\" + s.Name, true);
                                    StackPanel stackMedia = new StackPanel();
                                    stackMedia.HorizontalAlignment = HorizontalAlignment.Center;
                                    stackMedia.VerticalAlignment   = VerticalAlignment.Center;
                                    stackMedia.Orientation         = Orientation.Vertical;

                                    MediaElement myMedia = new MediaElement();
                                    myMedia.Source         = new Uri(s.FullName, UriKind.RelativeOrAbsolute);
                                    myMedia.LoadedBehavior = MediaState.Manual;
                                    myMedia.Width          = 440;

                                    StackPanel stackMediaButtons = new StackPanel();
                                    stackMediaButtons.Orientation         = Orientation.Horizontal;
                                    stackMediaButtons.HorizontalAlignment = HorizontalAlignment.Center;
                                    stackMediaButtons.VerticalAlignment   = VerticalAlignment.Center;

                                    StackPanel stackEnteteMedia = new StackPanel();
                                    stackEnteteMedia.Orientation         = Orientation.Horizontal;
                                    stackEnteteMedia.HorizontalAlignment = HorizontalAlignment.Center;
                                    stackEnteteMedia.VerticalAlignment   = VerticalAlignment.Center;

                                    Chip EnteteInfoMedia = new Chip();
                                    EnteteInfoMedia.Content = "Nom Prise : " + pr + "          Details : " + ComboBoxSequences.SelectedItem.ToString() + " / " + ComboBoxPlans.SelectedItem.ToString();
                                    stackEnteteMedia.Children.Add(EnteteInfoMedia);


                                    PackIcon playIcon = new PackIcon();
                                    playIcon.Kind = PackIconKind.Play;
                                    Button play = new Button();
                                    play.Content = playIcon;
                                    play.Click  += (Object, RoutedEventArgs) => { mediaPlay(sender, e, myMedia); };

                                    PackIcon pauseIcon = new PackIcon();
                                    pauseIcon.Kind = PackIconKind.Pause;
                                    Button pause = new Button();
                                    pause.Content = pauseIcon;
                                    pause.Click  += (Object, RoutedEventArgs) => { mediaPause(sender, e, myMedia); };

                                    PackIcon stopIcon = new PackIcon();
                                    stopIcon.Kind = PackIconKind.Stop;
                                    Button stop = new Button();
                                    stop.Content = stopIcon;
                                    stop.Click  += (Object, RoutedEventArgs) => { mediaStop(sender, e, myMedia); };

                                    PackIcon muteIcon = new PackIcon();
                                    muteIcon.Kind = PackIconKind.MusicNoteOff;
                                    Button mute = new Button();
                                    mute.Content = muteIcon;
                                    mute.Click  += (Object, RoutedEventArgs) => { mediaMute(sender, e, myMedia, mute); };

                                    ColorZone PriseZone = new ColorZone();
                                    PriseZone.Background = Brushes.Green;

                                    Separator espace1 = new Separator();
                                    Separator espace2 = new Separator();
                                    Separator espace3 = new Separator();
                                    Label     lb1     = new Label();
                                    Label     lb2     = new Label();
                                    Label     lb3     = new Label();
                                    Label     lb4     = new Label();
                                    Label     lb5     = new Label();

                                    stackMediaButtons.Children.Add(play);
                                    stackMediaButtons.Children.Add(lb1);
                                    stackMediaButtons.Children.Add(pause);
                                    stackMediaButtons.Children.Add(lb2);
                                    stackMediaButtons.Children.Add(stop);
                                    stackMediaButtons.Children.Add(lb3);
                                    stackMediaButtons.Children.Add(mute);


                                    stackMedia.Children.Add(espace1);
                                    stackMedia.Children.Add(stackEnteteMedia);
                                    stackMedia.Children.Add(espace2);
                                    stackMedia.Children.Add(myMedia);
                                    stackMedia.Children.Add(espace3);
                                    stackMedia.Children.Add(lb4);
                                    stackMedia.Children.Add(stackMediaButtons);
                                    stackMedia.Children.Add(lb5);

                                    PriseZone.Content = stackMedia;
                                    Grid.SetRow(PriseZone, i);
                                    gr.Children.Add(PriseZone);
                                    i++;
                                    test = true;
                                    break;
                                }
                                else
                                {
                                    test = false;
                                }
                            }
                            if (test == false)
                            {
                                StackPanel stackErreur = new StackPanel();
                                stackErreur.HorizontalAlignment = HorizontalAlignment.Center;
                                stackErreur.VerticalAlignment   = VerticalAlignment.Center;
                                stackErreur.Orientation         = Orientation.Vertical;

                                //MessageBox.Show("no" + pr);
                                ColorZone ErreurZone = new ColorZone();
                                ErreurZone.Background = Brushes.Red;

                                StackPanel stackEnteteErreur = new StackPanel();
                                stackEnteteErreur.HorizontalAlignment = HorizontalAlignment.Center;
                                stackEnteteErreur.VerticalAlignment   = VerticalAlignment.Center;
                                stackEnteteErreur.Orientation         = Orientation.Vertical;

                                Chip EnteteInfoErreur = new Chip();
                                EnteteInfoErreur.Content = "Nom Prise : " + pr + "          Details : " + ComboBoxSequences.SelectedItem.ToString() + " / " + ComboBoxPlans.SelectedItem.ToString() + "   N'est pas trouvée";
                                stackEnteteErreur.Children.Add(EnteteInfoErreur);

                                StackPanel stackP = new StackPanel {
                                };
                                stackP.HorizontalAlignment = HorizontalAlignment.Center;
                                stackP.Margin      = new Thickness(8);
                                stackP.Orientation = Orientation.Horizontal;

                                Button rechercher = new Button();
                                rechercher.Content = "rechercher";
                                rechercher.Click  += (Object, RoutedEventArgs) => { RechercherVideo(sender, e, pr, i, ErreurZone, diPlan); };

                                PackIcon ic = new PackIcon();
                                ic.Kind = PackIconKind.Refresh;

                                Badged rechercherBg = new Badged();
                                rechercherBg.HorizontalAlignment = HorizontalAlignment.Center;
                                rechercherBg.VerticalAlignment   = VerticalAlignment.Center;
                                rechercherBg.Badge   = ic;
                                rechercherBg.Content = rechercher;

                                stackP.Children.Add(rechercherBg);

                                stackEnteteErreur.Children.Add(stackP);

                                stackErreur.Children.Add(stackEnteteErreur);
                                ErreurZone.Content = stackErreur;
                                Grid.SetRow(ErreurZone, i);
                                gr.Children.Add(ErreurZone);
                                i++;
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("cette qualité existe pas");
                }
            }
            else if (ComboBoxSequences.SelectedItem.ToString() == "tout")
            {
                DirectoryInfo diTout = diMovie.CreateSubdirectory("Toute les prises");
                listPr.Clear();
                gr.Children.Clear();
                gr.RowDefinitions.Clear();

                var firebase  = new FirebaseClient("https://applicationcliente.firebaseio.com/");
                var sequences = await firebase.Child(id).Child("movies").Child(mv).Child("Sequence").OrderByKey().OnceAsync <Movies>();

                foreach (var seq in sequences)
                {
                    var plans = await firebase.Child(id).Child("movies").Child(mv).Child("Sequence").Child(seq.Key).Child("plans").OrderByKey().OnceAsync <Plan>();

                    foreach (var plan in plans)
                    {
                        var prises = await firebase.Child(id).Child("movies").Child(mv).Child("Sequence").Child(seq.Key).Child("plans").Child(plan.Key).Child("listPrise").OrderByKey().OnceAsync <Prise>();

                        foreach (var prise in prises)
                        {
                            var namePrise = prise.Object.nomPrise + ".MP4";
                            if (prise.Object.note == res)
                            {
                                listPr.Add(namePrise);
                                nbRes++;
                            }
                        }
                    }
                }
                if (nbRes != 0)
                {
                    var cpt = 0;
                    while (cpt < listPr.Count())
                    {
                        gr.RowDefinitions.Add(new RowDefinition());
                        cpt++;
                    }
                    System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog();
                    browse.RootFolder          = Environment.SpecialFolder.Desktop;
                    browse.Description         = " +++ selectionner un dossier +++";
                    browse.ShowNewFolderButton = false;
                    var i    = 0;
                    var test = false;

                    if (browse.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string[]      files = Directory.GetFiles(browse.SelectedPath);
                        DirectoryInfo diSrc = new DirectoryInfo(Environment.ExpandEnvironmentVariables(browse.SelectedPath));
                        FileInfo[]    fi    = diSrc.GetFiles();
                        foreach (String pr in listPr)
                        {
                            foreach (FileInfo s in fi)
                            {
                                if (s.Name == pr)
                                {
                                    s.CopyTo(diTout.FullName + "\\" + s.Name, true);

                                    StackPanel stackMedia = new StackPanel();
                                    stackMedia.HorizontalAlignment = HorizontalAlignment.Center;
                                    stackMedia.VerticalAlignment   = VerticalAlignment.Center;
                                    stackMedia.Orientation         = Orientation.Vertical;

                                    MediaElement myMedia = new MediaElement();
                                    myMedia.Source         = new Uri(s.FullName, UriKind.RelativeOrAbsolute);
                                    myMedia.LoadedBehavior = MediaState.Manual;
                                    myMedia.Width          = 440;

                                    StackPanel stackMediaButtons = new StackPanel();
                                    stackMediaButtons.Orientation         = Orientation.Horizontal;
                                    stackMediaButtons.HorizontalAlignment = HorizontalAlignment.Center;
                                    stackMediaButtons.VerticalAlignment   = VerticalAlignment.Center;

                                    StackPanel stackEnteteMedia = new StackPanel();
                                    stackEnteteMedia.Orientation         = Orientation.Horizontal;
                                    stackEnteteMedia.HorizontalAlignment = HorizontalAlignment.Center;
                                    stackEnteteMedia.VerticalAlignment   = VerticalAlignment.Center;

                                    Chip EnteteInfoMedia = new Chip();
                                    EnteteInfoMedia.Content = "Nom Prise : " + pr + "          Details : " + ComboBoxSequences.SelectedItem.ToString() + " / " + ComboBoxPlans.SelectedItem.ToString();
                                    stackEnteteMedia.Children.Add(EnteteInfoMedia);


                                    PackIcon playIcon = new PackIcon();
                                    playIcon.Kind = PackIconKind.Play;
                                    Button play = new Button();
                                    play.Content = playIcon;
                                    play.Click  += (Object, RoutedEventArgs) => { mediaPlay(sender, e, myMedia); };

                                    PackIcon pauseIcon = new PackIcon();
                                    pauseIcon.Kind = PackIconKind.Pause;
                                    Button pause = new Button();
                                    pause.Content = pauseIcon;
                                    pause.Click  += (Object, RoutedEventArgs) => { mediaPause(sender, e, myMedia); };

                                    PackIcon stopIcon = new PackIcon();
                                    stopIcon.Kind = PackIconKind.Stop;
                                    Button stop = new Button();
                                    stop.Content = stopIcon;
                                    stop.Click  += (Object, RoutedEventArgs) => { mediaStop(sender, e, myMedia); };

                                    PackIcon muteIcon = new PackIcon();
                                    muteIcon.Kind = PackIconKind.MusicNoteOff;
                                    Button mute = new Button();
                                    mute.Content = muteIcon;
                                    mute.Click  += (Object, RoutedEventArgs) => { mediaMute(sender, e, myMedia, mute); };

                                    ColorZone PriseZone = new ColorZone();
                                    PriseZone.Background = Brushes.Green;

                                    Separator espace1 = new Separator();
                                    Separator espace2 = new Separator();
                                    Separator espace3 = new Separator();
                                    Label     lb1     = new Label();
                                    Label     lb2     = new Label();
                                    Label     lb3     = new Label();
                                    Label     lb4     = new Label();
                                    Label     lb5     = new Label();

                                    stackMediaButtons.Children.Add(play);
                                    stackMediaButtons.Children.Add(lb1);
                                    stackMediaButtons.Children.Add(pause);
                                    stackMediaButtons.Children.Add(lb2);
                                    stackMediaButtons.Children.Add(stop);
                                    stackMediaButtons.Children.Add(lb3);
                                    stackMediaButtons.Children.Add(mute);

                                    //
                                    stackMedia.Children.Add(espace1);
                                    stackMedia.Children.Add(stackEnteteMedia);
                                    stackMedia.Children.Add(espace2);
                                    stackMedia.Children.Add(myMedia);
                                    stackMedia.Children.Add(espace3);
                                    stackMedia.Children.Add(lb4);
                                    stackMedia.Children.Add(stackMediaButtons);
                                    stackMedia.Children.Add(lb5);

                                    PriseZone.Content = stackMedia;
                                    Grid.SetRow(PriseZone, i);
                                    gr.Children.Add(PriseZone);
                                    i++;
                                    test = true;
                                    break;
                                }
                                else
                                {
                                    test = false;
                                }
                            }
                            if (test == false)
                            {
                                StackPanel stackErreur = new StackPanel();
                                stackErreur.HorizontalAlignment = HorizontalAlignment.Center;
                                stackErreur.VerticalAlignment   = VerticalAlignment.Center;
                                stackErreur.Orientation         = Orientation.Vertical;

                                //MessageBox.Show("no" + pr);
                                ColorZone ErreurZone = new ColorZone();
                                ErreurZone.Background = Brushes.Red;

                                StackPanel stackEnteteErreur = new StackPanel();
                                stackEnteteErreur.HorizontalAlignment = HorizontalAlignment.Center;
                                stackEnteteErreur.VerticalAlignment   = VerticalAlignment.Center;
                                stackEnteteErreur.Orientation         = Orientation.Vertical;

                                Chip EnteteInfoErreur = new Chip();
                                EnteteInfoErreur.Content = "Nom Prise : " + pr + "          Details : " + ComboBoxSequences.SelectedItem.ToString() + " / " + ComboBoxPlans.SelectedItem.ToString() + "   N'est pas trouvée";
                                stackEnteteErreur.Children.Add(EnteteInfoErreur);

                                StackPanel stackP = new StackPanel {
                                };
                                stackP.HorizontalAlignment = HorizontalAlignment.Center;
                                stackP.Margin      = new Thickness(8);
                                stackP.Orientation = Orientation.Horizontal;

                                Button rechercher = new Button();
                                rechercher.Content = "rechercher";
                                rechercher.Click  += (Object, RoutedEventArgs) => { RechercherVideo(sender, e, pr, i, ErreurZone, diTout); };

                                PackIcon ic = new PackIcon();
                                ic.Kind = PackIconKind.Refresh;

                                Badged rechercherBg = new Badged();
                                rechercherBg.HorizontalAlignment = HorizontalAlignment.Center;
                                rechercherBg.VerticalAlignment   = VerticalAlignment.Center;
                                rechercherBg.Badge   = ic;
                                rechercherBg.Content = rechercher;

                                stackP.Children.Add(rechercherBg);

                                stackEnteteErreur.Children.Add(stackP);

                                stackErreur.Children.Add(stackEnteteErreur);
                                ErreurZone.Content = stackErreur;
                                Grid.SetRow(ErreurZone, i);
                                gr.Children.Add(ErreurZone);
                                i++;
                            }
                        }
                    }
                }
            }
        }
示例#14
0
        public async Task RunAfterCreateAsync()
        {
            try
            {
                await Task.Run(async() =>
                {
                    await Dispatcher.InvokeAsync(() =>
                    {
                        mainPanel.Children.Clear();
                    });


                    CourseInformation[] cfs;
                    FileServiceProvider.DeserializeFromXmlFile(DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CourseInformationSavedName, out cfs);

                    for (int i = 0; i < cfs.Length; i++)
                    {
                        var item = cfs[i];
                        if (item.CodeInDesUni == "-")
                        {
                            continue;
                        }
                        StudentHistoryGridRow shdr = new StudentHistoryGridRow
                        {
                            Id            = item.Id,
                            CodeInDesUni  = item.CodeInDesUni,
                            TitleInDesUni = item.CorrespondingTitleInDesUni,
                            StatusColor   = item.IsPassed ? WpfApplication.WpfApplicationUtilityClasses.Enums.StudentHistoryGridRowColors.GREEN
                            : item.NumberOfFailed > 1 ? WpfApplication.WpfApplicationUtilityClasses.Enums.StudentHistoryGridRowColors.YELLOW
                            : WpfApplication.WpfApplicationUtilityClasses.Enums.StudentHistoryGridRowColors.WHITE,
                        };

                        Dispatcher.Invoke(() =>
                        {
                            collection.Add(shdr);
                        });
                    }

                    await Dispatcher.InvokeAsync(() =>
                    {
                        for (int i = 0; i < collection.Count; i++)
                        {
                            Badged badged = new Badged();
                            badged.Badge  = collection[i].CodeInDesUni;
                            badged.Margin = new Thickness(15);
                            badged.Name   = "bdg" + collection[i].Id;

                            Button button  = new Button();
                            button.Content = new TextBlock()
                            {
                                Text          = collection[i].TitleInDesUni,
                                TextAlignment = TextAlignment.Center,
                                TextWrapping  = TextWrapping.Wrap
                            };
                            button.Name    = "btn" + i.ToString();
                            button.Width   = 250;
                            button.Height  = Double.NaN;
                            button.Padding = new Thickness(8);

                            SetButtonBackgroundColor(button, collection[i].StatusColor);

                            button.Click  += Button_Click;
                            badged.Content = button;

                            mainPanel.Children.Add(badged);
                        }
                    });
                });
            }
            catch { }
        }
示例#15
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            recherche.Text = "";
            headerStack.Children.Clear();
            lookForV.Visibility = Visibility.Hidden;
            gr.Children.Clear();
            gr.RowDefinitions.Clear();
            var firebase = new FirebaseClient("https://applicationcliente.firebaseio.com/");
            var movies   = await firebase.Child(id).Child("movies").OrderByKey().OnceAsync <Movies>();

            var nb  = movies.Count();
            var res = 0;

            if (nb % 4 != 0)
            {
                res = 1;
            }
            var r = (int)(nb / 4);
            var x = 0;

            while (x < r + res)
            {
                gr.RowDefinitions.Add(new RowDefinition());
                x++;
            }

            var i = 0;
            var j = 0;

            foreach (var movie in movies)
            {
                if (i == 4)
                {
                    i = 0;
                    j++;
                }

                Grid g = new Grid();

                // Create Rows
                RowDefinition r1 = new RowDefinition();
                r1.Height = new GridLength(145);
                RowDefinition       r2 = new RowDefinition();
                GridLengthConverter gridLengthConverter1 = new GridLengthConverter();
                r2.Height = (GridLength)gridLengthConverter1.ConvertFrom("*");
                RowDefinition       r3 = new RowDefinition();
                GridLengthConverter gridLengthConverter2 = new GridLengthConverter();
                r3.Height = (GridLength)gridLengthConverter2.ConvertFrom("Auto");

                g.RowDefinitions.Add(r1);
                g.RowDefinitions.Add(r2);
                g.RowDefinitions.Add(r3);

                Image img = new Image();
                img.Height = 140;
                img.HorizontalAlignment = HorizontalAlignment.Stretch;
                img.Stretch             = Stretch.Fill;
                img.Source = new BitmapImage(new Uri("C:\\Users\\lUnA ShImO\\Documents\\Visual Studio 2015\\Projects\\PFE_WPF\\PFE_WPF\\Resources\\Chartridge046_small.jpg"));
                g.Children.Add(img);


                PackIcon ic = new PackIcon();
                ic.Width  = 20;
                ic.Height = 20;
                ic.Kind   = PackIconKind.Camera;
                ic.HorizontalAlignment = HorizontalAlignment.Right;
                ic.VerticalAlignment   = VerticalAlignment.Bottom;

                Grid.SetRow(ic, 0);
                g.Children.Add(ic);

                StackPanel stackT = new StackPanel {
                };
                stackT.Orientation = Orientation.Vertical;
                Chip titre = new Chip();
                titre.HorizontalAlignment = HorizontalAlignment.Center;
                titre.FontWeight          = FontWeights.Bold;
                titre.Content             = movie.Key;
                titre.IconBackground      = Brushes.Yellow;
                TextBlock prod = new TextBlock();
                prod.FontWeight    = FontWeights.Bold;
                prod.Text          = $"Production : { movie.Object.Production}";
                prod.TextAlignment = TextAlignment.Center;
                TextBlock real = new TextBlock();
                real.FontWeight    = FontWeights.Bold;
                real.Text          = $"Realisateur : { movie.Object.Realisateur}";
                real.TextAlignment = TextAlignment.Center;

                stackT.Children.Add(titre);
                stackT.Children.Add(prod);
                stackT.Children.Add(real);

                Grid.SetRow(stackT, 1);
                g.Children.Add(stackT);

                var sequences = await firebase.Child(id).Child("movies").Child(movie.Key).Child("Sequence").OrderByKey().OnceAsync <Movies>();

                var nbSeq = sequences.Count().ToString();

                StackPanel stackP = new StackPanel {
                };
                stackP.HorizontalAlignment = HorizontalAlignment.Right;
                stackP.Margin      = new Thickness(8);
                stackP.Orientation = Orientation.Horizontal;
                PackIcon pop     = new PackIcon();
                Style    myStyle = (Style)Resources["{StaticResource MaterialDesignToolPopupBox}"];
                pop.Style   = myStyle;
                pop.Kind    = PackIconKind.Movie;
                pop.Padding = new Thickness(2, 0, 2, 0);
                Button more = new Button();
                more.Width   = 50;
                more.Content = pop;
                var mv = movie.Key;
                more.Click += (Object, RoutedEventArgs) => { Movie_Click(sender, e, mv); };

                Badged moreBg = new Badged();
                moreBg.Badge   = nbSeq;
                moreBg.Content = more;

                stackP.Children.Add(moreBg);
                Grid.SetRow(stackP, 2);
                g.Children.Add(stackP);

                Grid grdEspace = new Grid();

                // Create Rows
                RowDefinition       row1 = new RowDefinition();
                GridLengthConverter gridLengthConverterrow1 = new GridLengthConverter();
                row1.Height = (GridLength)gridLengthConverterrow1.ConvertFrom("*");
                RowDefinition       row2 = new RowDefinition();
                GridLengthConverter gridLengthConverterrow2 = new GridLengthConverter();
                row2.Height = (GridLength)gridLengthConverterrow2.ConvertFrom("Auto");

                grdEspace.RowDefinitions.Add(row1);
                grdEspace.RowDefinitions.Add(row2);

                TextBlock vide = new TextBlock();

                Card cd = new Card();
                //cd.HorizontalAlignment = HorizontalAlignment.Left;
                ShadowAssist.SetShadowDepth(cd, ShadowDepth.Depth5);
                cd.Height  = 270;
                cd.Width   = 200;
                cd.Content = g;

                grdEspace.Children.Add(cd);
                Grid.SetRow(vide, 1);
                grdEspace.Children.Add(vide);

                Grid.SetRow(grdEspace, j);
                Grid.SetColumn(grdEspace, i);

                gr.Children.Add(grdEspace);
                i++;
            }
        }
示例#16
0
        private async void Movie_Click(Object sender, RoutedEventArgs e, String mv)
        {
            movieTile = mv;
            headerStack.Children.Clear();
            Previous_Button(sender, e, "Window_Loaded");
            lookForV.Visibility = Visibility.Visible;
            gr.Children.Clear();
            gr.RowDefinitions.Clear();
            //gr.ColumnDefinitions.Clear();

            var firebase  = new FirebaseClient("https://applicationcliente.firebaseio.com/");
            var sequences = await firebase.Child(id).Child("movies").Child(mv).Child("Sequence").OrderByKey().OnceAsync <Movies>();

            var nbS = sequences.Count();
            var res = 0;

            if (nbS % 4 != 0)
            {
                res = 1;
            }
            var r = (int)(nbS / 4);
            var x = 0;

            while (x < r + res)
            {
                gr.RowDefinitions.Add(new RowDefinition());
                x++;
            }

            var i = 0;
            var j = 0;

            foreach (var seq in sequences)
            {
                if (i == 4)
                {
                    i = 0;
                    j++;
                }

                Grid g = new Grid();

                // Create Rows
                RowDefinition r1 = new RowDefinition();
                r1.Height = new GridLength(145);
                RowDefinition       r2 = new RowDefinition();
                GridLengthConverter gridLengthConverter1 = new GridLengthConverter();
                r2.Height = (GridLength)gridLengthConverter1.ConvertFrom("*");
                RowDefinition       r3 = new RowDefinition();
                GridLengthConverter gridLengthConverter2 = new GridLengthConverter();
                r3.Height = (GridLength)gridLengthConverter2.ConvertFrom("Auto");

                g.RowDefinitions.Add(r1);
                g.RowDefinitions.Add(r2);
                g.RowDefinitions.Add(r3);

                Image img = new Image();
                img.Height = 140;
                img.HorizontalAlignment = HorizontalAlignment.Stretch;
                img.Source = new BitmapImage(new Uri("C:\\Users\\lUnA ShImO\\Source\\Repos\\WPF_PFE\\PFE_WPF\\Resources\\movie.png"));
                g.Children.Add(img);

                StackPanel stackT = new StackPanel {
                };
                stackT.Orientation = Orientation.Vertical;
                Chip titre = new Chip();
                titre.FontWeight          = FontWeights.Bold;
                titre.Content             = seq.Key;
                titre.HorizontalAlignment = HorizontalAlignment.Center;
                titre.VerticalAlignment   = VerticalAlignment.Center;

                Label vide1 = new Label();
                Label vide2 = new Label();
                Label vide3 = new Label();

                stackT.Children.Add(vide1);
                stackT.Children.Add(vide2);
                stackT.Children.Add(vide3);
                stackT.Children.Add(titre);

                Grid.SetRow(stackT, 1);
                g.Children.Add(stackT);

                var plans = await firebase.Child(id).Child("movies").Child(mv).Child("Sequence").Child(seq.Key).Child("plans").OrderByKey().OnceAsync <Plan>();

                var nbPlans = plans.Count().ToString();

                StackPanel stackP = new StackPanel {
                };
                stackP.HorizontalAlignment = HorizontalAlignment.Right;
                stackP.Margin      = new Thickness(8);
                stackP.Orientation = Orientation.Horizontal;
                PackIcon pop     = new PackIcon();
                Style    myStyle = (Style)Resources["{StaticResource MaterialDesignToolPopupBox}"];
                pop.Style   = myStyle;
                pop.Kind    = PackIconKind.Camera;
                pop.Padding = new Thickness(2, 0, 2, 0);
                Button more = new Button();
                var    bc   = new BrushConverter();
                more.Background = (Brush)bc.ConvertFrom("#FF5D9EA6");
                more.Content    = pop;
                var sequi = seq.Key;
                more.Click += (Object, RoutedEventArgs) => { Sequence_Click(sender, e, mv, sequi); };

                Badged moreBg = new Badged();
                moreBg.Badge   = nbPlans;
                moreBg.Content = more;

                stackP.Children.Add(moreBg);
                Grid.SetRow(stackP, 2);
                g.Children.Add(stackP);

                Grid grdEspace = new Grid();

                // Create Rows
                RowDefinition       row1 = new RowDefinition();
                GridLengthConverter gridLengthConverterrow1 = new GridLengthConverter();
                row1.Height = (GridLength)gridLengthConverterrow1.ConvertFrom("*");
                RowDefinition       row2 = new RowDefinition();
                GridLengthConverter gridLengthConverterrow2 = new GridLengthConverter();
                row2.Height = (GridLength)gridLengthConverterrow2.ConvertFrom("Auto");

                grdEspace.RowDefinitions.Add(row1);
                grdEspace.RowDefinitions.Add(row2);

                TextBlock vide = new TextBlock();

                Card cd = new Card();
                //cd.HorizontalAlignment = HorizontalAlignment.Left;
                ShadowAssist.SetShadowDepth(cd, ShadowDepth.Depth5);
                cd.Height  = 270;
                cd.Width   = 200;
                cd.Content = g;

                grdEspace.Children.Add(cd);
                Grid.SetRow(vide, 1);
                grdEspace.Children.Add(vide);

                Grid.SetRow(grdEspace, j);
                Grid.SetColumn(grdEspace, i);

                gr.Children.Add(grdEspace);
                i++;
            }
        }
示例#17
0
        private async void Sequence_Click(object sender, RoutedEventArgs e, String mt, String sequi)
        {
            sequenceMovie = sequi;
            headerStack.Children.Clear();
            Previous_Button(sender, e, "Movie_Click");
            gr.Children.Clear();
            gr.RowDefinitions.Clear();
            //gr.ColumnDefinitions.Clear();

            var firebase = new FirebaseClient("https://applicationcliente.firebaseio.com/");
            var plans    = await firebase.Child(id).Child("movies").Child(mt).Child("Sequence").Child(sequi).Child("plans").OrderByKey().OnceAsync <Plan>();

            var nbP = plans.Count();
            var res = 0;

            if (nbP % 4 != 0)
            {
                res = 1;
            }
            var r = (int)(nbP / 4);
            var x = 0;

            while (x <= r + res)
            {
                gr.RowDefinitions.Add(new RowDefinition());
                x++;
            }

            var i = 0;
            var j = 0;

            foreach (var plan in plans)
            {
                if (i == 4)
                {
                    i = 0;
                    j++;
                }

                Grid gridFront = new Grid();

                // Create Rows
                RowDefinition r1 = new RowDefinition();
                r1.Height = new GridLength(145);
                RowDefinition       r2 = new RowDefinition();
                GridLengthConverter gridLengthConverter1 = new GridLengthConverter();
                r2.Height = (GridLength)gridLengthConverter1.ConvertFrom("*");
                RowDefinition       r3 = new RowDefinition();
                GridLengthConverter gridLengthConverter2 = new GridLengthConverter();
                r3.Height = (GridLength)gridLengthConverter2.ConvertFrom("Auto");

                gridFront.RowDefinitions.Add(r1);
                gridFront.RowDefinitions.Add(r2);
                gridFront.RowDefinitions.Add(r3);

                Image img = new Image();
                img.Height = 140;
                img.HorizontalAlignment = HorizontalAlignment.Stretch;
                img.Stretch             = Stretch.Fill;
                img.Source = new BitmapImage(new Uri(plan.Object.urlImageLink));
                gridFront.Children.Add(img);

                StackPanel stackT = new StackPanel {
                };
                stackT.Orientation = Orientation.Vertical;
                Label l1    = new Label();
                Label l2    = new Label();
                Chip  titre = new Chip();
                titre.Content             = sequi + " / " + plan.Key;
                titre.HorizontalAlignment = HorizontalAlignment.Center;
                titre.FontWeight          = FontWeights.Bold;

                stackT.Children.Add(l1);
                stackT.Children.Add(l2);
                stackT.Children.Add(titre);

                Grid.SetRow(stackT, 1);
                gridFront.Children.Add(stackT);

                StackPanel stackP = new StackPanel {
                };
                stackP.HorizontalAlignment = HorizontalAlignment.Right;
                stackP.Margin      = new Thickness(8);
                stackP.Orientation = Orientation.Horizontal;

                Button more = new Button();
                more.Content = "prises";

                var prises = await firebase.Child(id).Child("movies").Child(mt).Child("Sequence").Child(sequi).Child("plans").Child(plan.Key).Child("listPrise").OrderByKey().OnceAsync <Prise>();

                var nbPrises = prises.Count();

                Badged moreBg = new Badged();
                moreBg.Badge   = nbPrises;
                moreBg.Content = more;

                ShadowAssist.SetShadowDepth(more, ShadowDepth.Depth5);

                var pln = plan.Key;
                more.Click += (Object, RoutedEventArgs) => { Plan_Prises_Click(more, e, mt, sequi, pln); };

                Button   info     = new Button();
                PackIcon infoIcon = new PackIcon();
                infoIcon.Kind = PackIconKind.Information;
                info.Content  = infoIcon;
                ShadowAssist.SetShadowDepth(info, ShadowDepth.Depth5);

                var plann     = plan.Object.plan;
                var camera    = plan.Object.camera;
                var cardSD    = plan.Object.cardSd;
                var decor     = plan.Object.decor;
                var effetIN   = plan.Object.effetIN;
                var effetJN   = plan.Object.effetJN;
                var hauteur   = plan.Object.hauteur;
                var objectif  = plan.Object.objectif;
                var sonOption = plan.Object.sonOption;
                var distance  = plan.Object.distance;
                info.Click += (Object, RoutedEventArgs) => { Plan_Info_Click(more, e, mt, sequi, plan.Key, camera, cardSD, decor, effetIN, effetJN, hauteur, objectif, sonOption, distance, plan.Object.urlImageLink); };

                Label lb1 = new Label();
                Label lb2 = new Label();
                Label lb3 = new Label();
                Label lb4 = new Label();
                Label lb5 = new Label();
                Label lb6 = new Label();

                stackP.Children.Add(info);
                stackP.Children.Add(lb1);
                stackP.Children.Add(lb2);
                stackP.Children.Add(lb3);
                stackP.Children.Add(lb4);
                stackP.Children.Add(lb5);
                stackP.Children.Add(lb6);
                stackP.Children.Add(moreBg);
                Grid.SetRow(stackP, 2);
                gridFront.Children.Add(stackP);


                Grid grdEspace = new Grid();

                // Create Rows
                RowDefinition       row1 = new RowDefinition();
                GridLengthConverter gridLengthConverterrow1 = new GridLengthConverter();
                row1.Height = (GridLength)gridLengthConverterrow1.ConvertFrom("*");
                RowDefinition       row2 = new RowDefinition();
                GridLengthConverter gridLengthConverterrow2 = new GridLengthConverter();
                row2.Height = (GridLength)gridLengthConverterrow2.ConvertFrom("Auto");

                grdEspace.RowDefinitions.Add(row1);
                grdEspace.RowDefinitions.Add(row2);

                TextBlock vide = new TextBlock();

                Card cd = new Card();
                //cd.HorizontalAlignment = HorizontalAlignment.Left;
                ShadowAssist.SetShadowDepth(cd, ShadowDepth.Depth5);
                cd.Height  = 270;
                cd.Width   = 200;
                cd.Content = gridFront;

                grdEspace.Children.Add(cd);
                Grid.SetRow(vide, 1);
                grdEspace.Children.Add(vide);

                Grid.SetRow(grdEspace, j);
                Grid.SetColumn(grdEspace, i);

                gr.Children.Add(grdEspace);
                i++;
            }
        }
示例#18
0
        private async void recherche_TextChanged(object sender, TextChangedEventArgs e)
        {
            var firebase = new FirebaseClient("https://applicationcliente.firebaseio.com/");
            var movies   = await firebase.Child(id).Child("movies").OrderByKey().OnceAsync <Movies>();

            foreach (var movie in movies)
            {
                if (recherche.Text == movie.Object.Titre)
                {
                    Grid g = new Grid();
                    Saisie_Grid(sender, e, g);

                    Image img = new Image();
                    img.HorizontalAlignment = HorizontalAlignment.Stretch;
                    Saisie_Image(sender, e, img, 140, "C:\\Users\\lUnA ShImO\\Documents\\Visual Studio 2015\\Projects\\PFE_WPF\\PFE_WPF\\Resources\\Chartridge046_small.jpg");
                    g.Children.Add(img);

                    PackIcon ic = new PackIcon();
                    ic.Width  = 20;
                    ic.Height = 20;
                    ic.Kind   = PackIconKind.Camera;
                    ic.HorizontalAlignment = HorizontalAlignment.Right;
                    ic.VerticalAlignment   = VerticalAlignment.Bottom;

                    Grid.SetRow(ic, 0);
                    g.Children.Add(ic);

                    StackPanel stackT = new StackPanel {
                    };
                    stackT.Orientation = Orientation.Vertical;
                    Chip titre = new Chip();
                    titre.HorizontalAlignment = HorizontalAlignment.Center;
                    titre.FontWeight          = FontWeights.Bold;
                    titre.Content             = movie.Key;
                    titre.IconBackground      = Brushes.Yellow;
                    TextBlock prod = new TextBlock();
                    prod.FontWeight    = FontWeights.Bold;
                    prod.Text          = $"Production : { movie.Object.Production}";
                    prod.TextAlignment = TextAlignment.Center;
                    TextBlock real = new TextBlock();
                    real.FontWeight    = FontWeights.Bold;
                    real.Text          = $"Realisateur : { movie.Object.Realisateur}";
                    real.TextAlignment = TextAlignment.Center;

                    stackT.Children.Add(titre);
                    stackT.Children.Add(prod);
                    stackT.Children.Add(real);

                    Grid.SetRow(stackT, 1);
                    g.Children.Add(stackT);

                    var sequences = await firebase.Child(id).Child("movies").Child(movie.Key).Child("Sequence").OrderByKey().OnceAsync <Movies>();

                    var nbSeq = sequences.Count().ToString();

                    StackPanel stackP = new StackPanel {
                    };
                    stackP.HorizontalAlignment = HorizontalAlignment.Right;
                    stackP.Margin      = new Thickness(8);
                    stackP.Orientation = Orientation.Horizontal;
                    PackIcon pop     = new PackIcon();
                    Style    myStyle = (Style)Resources["{StaticResource MaterialDesignToolPopupBox}"];
                    pop.Style   = myStyle;
                    pop.Kind    = PackIconKind.Movie;
                    pop.Padding = new Thickness(2, 0, 2, 0);
                    Button more = new Button();
                    more.Width   = 50;
                    more.Content = pop;
                    var mv = movie.Key;
                    more.Click += (Object, RoutedEventArgs) => { Movie_Click(sender, e, mv); };

                    Badged moreBg = new Badged();
                    moreBg.Badge   = nbSeq;
                    moreBg.Content = more;

                    stackP.Children.Add(moreBg);
                    Grid.SetRow(stackP, 2);
                    g.Children.Add(stackP);

                    Grid grdEspace = new Grid();

                    // Create Rows
                    RowDefinition       row1 = new RowDefinition();
                    GridLengthConverter gridLengthConverterrow1 = new GridLengthConverter();
                    row1.Height = (GridLength)gridLengthConverterrow1.ConvertFrom("*");
                    RowDefinition       row2 = new RowDefinition();
                    GridLengthConverter gridLengthConverterrow2 = new GridLengthConverter();
                    row2.Height = (GridLength)gridLengthConverterrow2.ConvertFrom("Auto");

                    grdEspace.RowDefinitions.Add(row1);
                    grdEspace.RowDefinitions.Add(row2);

                    TextBlock vide = new TextBlock();

                    Card cd = new Card();
                    //cd.HorizontalAlignment = HorizontalAlignment.Left;
                    ShadowAssist.SetShadowDepth(cd, ShadowDepth.Depth5);
                    cd.Height  = 270;
                    cd.Width   = 200;
                    cd.Content = g;
                    gr.Children.Add(cd);
                }
            }
        }
示例#19
0
        public async Task RunAfterCreatedAsync()
        {
            try
            {

                await Task.Run(async () =>
                {
                    await Dispatcher.InvokeAsync(() =>
                    {
                        InitializeComponent();
                    });

                    //settings
                    if (Properties.Settings.Default.CurrentTermNumber > 0)
                        termNumber = Properties.Settings.Default.CurrentTermNumber;

                    gender = Properties.Settings.Default.Gender == 'm' ? Tataiee.Harif.Infrastructures.GeneralEnums.Gender.MALE : Tataiee.Harif.Infrastructures.GeneralEnums.Gender.FEMALE;

                    if (Properties.Settings.Default.MinUnits > 0)
                        minUnits = Properties.Settings.Default.MinUnits;

                    if (Properties.Settings.Default.MinUnits <= Properties.Settings.Default.MaxUnits && Properties.Settings.Default.MaxUnits > 0)
                        maxUnits = Properties.Settings.Default.MaxUnits;

                    if (Properties.Settings.Default.TimeoutForReductionStep2ms >= 120)
                        timeoutMs = Properties.Settings.Default.TimeoutForReductionStep2ms;

                    if (Properties.Settings.Default.MaxNumberOfSuggestedWeeklyProgram >= 1 && Properties.Settings.Default.MaxNumberOfSuggestedWeeklyProgram <= 50)
                        maxCntSuggestion = Properties.Settings.Default.MaxNumberOfSuggestedWeeklyProgram;

                    capacityFiltering = Properties.Settings.Default.CapacityFiltering;

                    exampCollideChecking = Properties.Settings.Default.ExamCollideChecking;

                    //end settings

                    mainCurriculum = StudentHistoryServiceProvider.CreateNewCurriculmWithSpecificCreditAndFilledBySpecificCourseInforamtion(DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CreditDeterminerSavedName, DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CourseInformationSavedName);


                    int CODE_LEN = 7;


                    //load offered course row in memory
                    FileServiceProvider.DeserializeFromXmlFile(DirectoryManager.GoalVersionOfferedCoursesRowDirectory + DirectoryManager.GoalVersionOfferedCoursesRowSavedName, out List<GoalVersionOfferedCoursesRow> goalVersionOfferedCourseRows);

                    //perform reduction step 1 and get courses list after reduced
                    var coursesListAfterReductionStep1 = ReductionStep1.Reduce(DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CreditDeterminerSavedName, DirectoryManager.EssentialInforamtion1Directory + DirectoryManager.CourseInformationSavedName
                        , termNumber);


                    //assign offeredCourseRows to the output of ReductionStep2 courses List                     
                    if (capacityFiltering)
                    {
                        goalVersionOfferedCourseRows = ReductionStep2.Reduce(coursesListAfterReductionStep1, goalVersionOfferedCourseRows, gender)
                        .Where(r => r.Capacity - r.Registered > 0).ToList();
                    }
                    else
                    {
                        goalVersionOfferedCourseRows = ReductionStep2.Reduce(coursesListAfterReductionStep1, goalVersionOfferedCourseRows, gender);
                    }

                    CODE_LEN = coursesListAfterReductionStep1[0].CodeInDesUni.Length;

                    //again group reduced offered course rows 
                    var coursesGroups = (from c in goalVersionOfferedCourseRows
                                         group c by c.Id.Substring(0, CODE_LEN)).ToList();

                    //--------

                    //we can add another reduction step to reduce more if possible but not now.
                    //---------



                    //fill main offeredCourses and offeredCourseRows lists
                    int i = 0;
                    int j = 0;
                    foreach (var course in coursesGroups)
                    {
                        var c = coursesListAfterReductionStep1.FirstOrDefault(c1 => c1.CodeInDesUni == course.Key);
                        if (c != null)
                        {
                            OfferedCourse oc = new OfferedCourse(c, i++, ReductionStep2ColorStatus.WHITE);
                            foreach (var row in course)
                            {
                                OfferedCourseRow ocr = new OfferedCourseRow(row, ReductionStep2ColorStatus.WHITE, j++, oc);
                                oc.OfferedCourseRows.Add(ocr);

                                cards.Add(null);
                                offeredCourseRows.Add(ocr);
                            }

                            offeredCourses.Add(oc);

                        }
                    }

                    if (Properties.Settings.Default.ReductionStep2MustBeLoad)
                    {

                        FileServiceProvider.DeserializeFromXmlFile(DirectoryManager.ReductionStep2SavedStatus + DirectoryManager.SaveColorOfferedCourses, out List<SaveColorObjectModel> saveColorOfferedCourses);
                        FileServiceProvider.DeserializeFromXmlFile(DirectoryManager.ReductionStep2SavedStatus + DirectoryManager.SaveColorOfferedCourseRows, out List<SaveColorObjectModel> saveColorOfferedCourseRows);


                        saveColorOfferedCourses.ForEach(scoc =>
                        {
                            offeredCourses[scoc.CorrespondingIdInSourceList].Color = scoc.Color;
                        });

                        saveColorOfferedCourseRows.ForEach(scocr =>
                        {
                            offeredCourseRows[scocr.CorrespondingIdInSourceList].Color = scocr.Color;
                        });

                    }


                    //create and fill courses navigation buttons in the right side
                    await Dispatcher.InvokeAsync(() =>
                    {

                        stackPanelRightSide.Children.Clear();
                        Button button1 = null;
                        for (int m = 0; m < offeredCourses.Count; m++)
                        {

                            Badged badged = new Badged
                            {
                                Badge = offeredCourses[m].OfferedCourseCode,
                                Margin = new Thickness(5),
                                Name = "bdg" + offeredCourses[m].CourseId
                            };

                            Button button = new Button
                            {
                                Content = new TextBlock()
                                {
                                    Text = offeredCourses[m].OfferedCourseName,
                                    TextAlignment = TextAlignment.Center,
                                    TextWrapping = TextWrapping.Wrap
                                },
                                Name = "btn" + m.ToString(),
                                Width = 250,
                                Height = Double.NaN,
                                Padding = new Thickness(5),

                                Background = Brushes.Transparent
                            };

                            button.Click += btnCourseNavigation_Click;
                            badged.Content = button;

                            if (m == 0)
                            {
                                button1 = button;
                            }
                            stackPanelRightSide.Children.Add(badged);
                        }
                        selectedButton = button1;

                        allowUserInteraction = true;
                        btnCourseNavigation_Click(button1, null);
                    });


                });

            }
            catch
            {

            }
        }