Beispiel #1
0
 private void Start()
 {
     if (colorZones.Length > 0)
     {
         current = colorZones[0];
     }
 }
Beispiel #2
0
        IEnumerator ChangeColorZone(ColorZone newZone)
        {
            ColorZone start = current;
            float     time  = 0f;

            while (time <= 1f)
            {
                yield return(null);

                time   += Time.deltaTime;
                current = ColorZone.Lerp(start, newZone, Mathf.Clamp01(time));
            }
        }
Beispiel #3
0
        //Control
        public pElement(ColorZone WPFBorder, pControl ParrotControlObject, string ElementType, double Margin)
        {
            ParrotControl = ParrotControlObject;
            Wrapper       = WPFBorder;

            SetGraphics("B" + WPFBorder.Name);

            Container.Content = WPFBorder;
            Container.Margin  = new Thickness(Margin);

            Type     = ElementType;
            Category = "Control";
        }
Beispiel #4
0
        private void cz_list_add_Click(object sender, RoutedEventArgs e)
        {
            ColorZone newcz = new ColorZone();

            allowListRefresh = false;
            cz_list.Items.Add(newcz);
            allowListRefresh = true;

            cz_list.SelectedItem = newcz;
            cz_list.ScrollIntoView(newcz);

            update_cz_list();
        }
Beispiel #5
0
            public static ColorZone Lerp(ColorZone a, ColorZone b, float t)
            {
                ColorZone zone = new ColorZone();

                zone.backgroundColorMain      = Color.Lerp(a.backgroundColorMain, b.backgroundColorMain, t);
                zone.backgroundColorSecondary = Color.Lerp(a.backgroundColorSecondary, b.backgroundColorSecondary, t);

                zone.wallColor         = Color.Lerp(a.wallColor, b.wallColor, t);
                zone.playerColor       = Color.Lerp(a.playerColor, b.playerColor, t);
                zone.interactableColor = Color.Lerp(a.interactableColor, b.interactableColor, t);
                zone.textColor         = Color.Lerp(a.textColor, b.textColor, t);

                return(zone);
            }
Beispiel #6
0
        private void cz_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cz_list.SelectedItem != null)
            {
                ColorZone cz = (ColorZone)cz_list.SelectedItem;

                this.cz_name_textbox.Text         = cz.name;
                this.cz_colorpicker.SelectedColor = Utils.ColorUtils.DrawingColorToMediaColor(cz.color);
                this.cz_effect.SelectedItem       = cz.effect;
                ks.Sequence = cz.keysequence;

                update_cz_list();
            }
        }
Beispiel #7
0
        private void SurfaceUniformColorZone_OnColorSet(ColorZone zone, Color color, Vector3 point)
        {
            switch (panelSchema.PanelType)
            {
            case Schema.PanelType.Square:
                break;

            case Schema.PanelType.Fillet:
                filletPanel.SetFaceColor(color);
                break;

            default:
                break;
            }
        }
Beispiel #8
0
        /// <summary>
        /// 创建Flipper的后展示区
        /// </summary>
        /// <param name="preset"></param>
        /// <returns></returns>
        private UIElement CreateBackContent(PresetData preset, string UUID)
        {
            ColorZone TitlecolorZone = new ColorZone()
            {
                Mode = ColorZoneMode.PrimaryLight, Height = 30
            };

            TreeView FileTree = new TreeView()
            {
                Height = 200, Margin = new Thickness(10)
            };

            FileTree.Items.Clear();
            FileTree.Items.Add(TreeHelper.GetTreeViewItem(SettingsData.StoragePath + ID.Dir_Preset + "\\" + preset.PresetName, preset.PresetName));

            Button DeleteBtn = new Button()
            {
                Style = (Style)this.FindResource("MaterialDesignFloatingActionMiniAccentButton"), Content = new PackIcon()
                {
                    Kind = PackIconKind.Delete
                }, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(0, 0, 16, -25), Tag = UUID
            };

            DeleteBtn.Click += new RoutedEventHandler(DeleteBtn_Click);

            Button ReturnBtn = new Button()
            {
                Style = (Style)this.FindResource("MaterialDesignFlatButton"), Content = LocalizedHelper.GetLocalizedString("Btn_Return", ID.StrRes_Preset), Margin = new Thickness(10), Command = Flipper.FlipCommand, Tag = UUID
            };

            if (preset.isRunning)
            {
                TitlecolorZone.Mode = ColorZoneMode.PrimaryDark;
            }

            Grid TitleGrid = new Grid();

            TitleGrid.Children.Add(TitlecolorZone);
            TitleGrid.Children.Add(DeleteBtn);

            StackPanel stackPanel = new StackPanel()
            {
                Children = { TitleGrid, FileTree, ReturnBtn }
            };

            return(stackPanel);
        }
Beispiel #9
0
        public async Task Mode_SetsThemeColors(ColorZoneMode mode, string backgroundBrush, string foregroundBrush)
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement <ColorZone> colorZone = await LoadXaml <ColorZone>(@$ "
<materialDesign:ColorZone Mode=" "{mode}" "/>
");

            Color background = await GetThemeColor(backgroundBrush);

            Color foreground = await GetThemeColor(foregroundBrush);

            Assert.Equal(background, await colorZone.GetBackgroundColor());
            Assert.Equal(foreground, await colorZone.GetForegroundColor());

            recorder.Success();
        }
Beispiel #10
0
        private static void OnLoaded(object sender, RoutedEventArgs e)
        {
            var _this = (sender as JumpSideAppBar);

            if (_this.CheckIfHandlerShouldExecute == false)
            {
                return;
            }

            StackPanel StackPanel1 = new StackPanel()
            {
                Orientation         = Orientation.Vertical,
                Width               = _this.ActualWidth,
                Background          = Brushes.Transparent,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
            };

            ColorZone ColorZone1 = new ColorZone()
            {
                Mode = ColorZoneMode.PrimaryDark,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                SnapsToDevicePixels = true,
            };

            ShadowAssist.SetShadowEdges(ColorZone1, ShadowEdges.Right);
            ShadowAssist.SetShadowDepth(ColorZone1, ShadowDepth.Depth1);

            foreach (var c in _this.Children.Cast <UIElement>().ToList().AsReadOnly())
            {
                _this.Children.Remove(c);
                StackPanel1.Children.Add(c);
            }

            SetZIndex(ColorZone1, 0);
            SetZIndex(StackPanel1, -1);
            _this.Children.Add(ColorZone1);
            _this.Children.Add(StackPanel1);
            _this.CheckIfHandlerShouldExecute = false;
        }
Beispiel #11
0
 public MainWindow()
 {
     InitializeComponent();
     Window     = this;
     ColorZone  = CtrlPage;
     ComboBox   = C1;
     Frame1     = Frame;
     Tip1       = Tip;
     Label_1    = Label_Name;
     Label_2    = Label_Logined;
     Image1     = head1;
     Image2     = head2;
     CPU        = CPU_;
     RAM        = RAM_;
     cpu_PB     = CPU_PB;
     ram_PB     = RAM_PB;
     Background = MainImage;
     string[] a = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');
     Text_Title.Text        += " " + a[0] + "." + a[1] + a[2] + a[3];
     Card_Login.ClipToBounds = true;
     Frame.Navigate(new Page4());
 }
Beispiel #12
0
    public void RefreshDesign ()
    {
      m_StackPanel.Children.Clear ();

       // target 
       var stack = new StackPanel() 
      { 
        Orientation = Orientation.Horizontal
      };

      // material image
      var materialImage = new Image
      {
        Margin = new Thickness (3),
        Stretch = Stretch.Uniform,
        Width = 16,
        Height = 16,
        Source = rr.Library.Helper.THelper.ByteArrayToBitmapImage (Model.ChildControlModel.GetImage ())
      };

      stack.Children.Add (materialImage);

      // target
      if (string.IsNullOrEmpty (Model.ControlModel.GadgetName).IsFalse ()) {
        var textBlock = new TextBlock ()
        {
          Margin = new Thickness (10, 0, 0, 0),
          VerticalAlignment = VerticalAlignment.Center,
          FontWeight = FontWeights.Bold,
          Text = Model.ControlModel.GadgetName,
        };

        stack.Children.Add (textBlock);
      }

      var cz = new ColorZone ()
      {
        Mode = ColorZoneMode.PrimaryLight,
        Content = stack,
      };

      m_StackPanel.Children.Add (cz);
      m_StackPanel.Children.Add (new Separator ());

      // description 
      if (string.IsNullOrEmpty (Model.ControlModel.Description).IsFalse ()) {
        var textBox = new TextBox ()
        {
          Margin = new Thickness (3),
          Padding = new Thickness (3),
          MaxWidth = 420,
          MaxHeight = 500,
          TextWrapping = TextWrapping.Wrap,
          TextAlignment = TextAlignment.Justify,
          HorizontalAlignment = HorizontalAlignment.Left,
          VerticalAlignment = VerticalAlignment.Top,
          VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
          Text = Model.ControlModel.Description,
        };

        m_StackPanel.Children.Add (textBox); 
      }

      // reference 
      if (string.IsNullOrEmpty (Model.ControlModel.Reference).IsFalse ()) {
        var textBox = new TextBox ()
        {
          Margin = new Thickness (3),
          Padding = new Thickness (3),
          MaxWidth = 420,
          FontWeight = FontWeights.SemiBold,
          TextWrapping = TextWrapping.Wrap,
          TextAlignment = TextAlignment.Left,
          VerticalAlignment = VerticalAlignment.Top,
          VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
          Text = Model.ControlModel.Reference,
        };

        m_StackPanel.Children.Add (textBox); 
      }

      // external link 
      if (string.IsNullOrEmpty (Model.ControlModel.ExternalLink).IsFalse ()) {
        try {
          var externalLink = new System.Windows.Documents.Hyperlink (new System.Windows.Documents.Run (Properties.Resource.RES_MORE_INFO))
          {
            NavigateUri = new Uri (Model.ControlModel.ExternalLink),
            TargetName = "_blanc",
          };

          var textBoxLink = new TextBlock (externalLink)
          {
            HorizontalAlignment = HorizontalAlignment.Center,
            Margin = new Thickness (3),
          };

          textBoxLink.SetValue (Grid.RowProperty, 3);

          m_StackPanel.Children.Add (textBoxLink); // row 3
        }

        catch (Exception) {
          // do nothing
        }
      }
    }
Beispiel #13
0
    public void RefreshDesign ()
    {
      m_Grid.Children.Clear ();

      // material image, test name (row 0)
      var stack = new StackPanel ()
      {
        Orientation = Orientation.Horizontal
      };

      if (Model.HasImage) {
        // image
        var imageSource = rr.Library.Helper.THelper.ByteArrayToBitmapImage (Model.MaterialImage);

        if (imageSource.NotNull ()) {
          var image = new Image ()
          {
            Stretch = Stretch.Fill,
            Width = 18,
            Height = 18,
            Source = imageSource.Clone (),
            Margin = new Thickness (0, 0, 10, 0),
          };

          stack.Children.Add (image);
        }
      }
      
      // name
      var textBlock = new TextBlock ()
      {
        Margin = new Thickness (10, 0, 0, 0),
        VerticalAlignment = VerticalAlignment.Center,
        Text = Model.ControlModel.GadgetName,
        FontWeight = FontWeights.UltraBold,
        FontSize = 14,
      };
      
      stack.Children.Add (textBlock);

      var cz = new ColorZone ()
      {
        Padding = new Thickness (3),
        Mode = Model.HasComponentControlModels ? ColorZoneMode.Accent : ColorZoneMode.PrimaryLight,
        Content = stack,
      };

      cz.SetValue (Grid.RowProperty, 0);  // row  0
      m_Grid.Children.Add (cz);

      // test description (row 1)
      var textBox = new TextBox ()
      {
        Margin = new Thickness (3),
        Padding = new Thickness (3),
        FontSize = 11,
        TextWrapping = TextWrapping.Wrap,
        TextAlignment = TextAlignment.Left,
        VerticalAlignment = VerticalAlignment.Top,
        VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
        Text = Model.ControlModel.Description,
      };
      

      textBox.SetValue (Grid.RowProperty, 1);  // row  1
      m_Grid.Children.Add (textBox);

      // external link (row 2)
      if (string.IsNullOrEmpty (Model.ControlModel.ExternalLink).IsFalse ()) {
        try {
          var externalLink = new System.Windows.Documents.Hyperlink (new System.Windows.Documents.Run (Properties.Resource.RES_MORE_INFO))
          {
            NavigateUri = new Uri (Model.ControlModel.ExternalLink),
            TargetName = "_blanc",
          };

          var textBoxLink = new TextBlock (externalLink)
          {
            HorizontalAlignment = HorizontalAlignment.Center,
            Margin = new Thickness (3),
          };

          textBoxLink.SetValue (Grid.RowProperty, 2);
          m_Grid.Children.Add (textBoxLink); // row 2
        }

        catch (Exception) {
          // do nothing
        }
      }

      // targets (row 3)
      InsertTargetRelation ();
      InsertTestRelation ();
    }
Beispiel #14
0
        private static void OnLoaded(object sender, RoutedEventArgs e)
        {
            var _this = (sender as JumpTopAppBar);

            if (_this.CheckIfHandlerShouldExecute == false)
            {
                return;
            }

            StackPanel StackPanel1 = new StackPanel()
            {
                Margin              = new Thickness(0, 4, 0, 4),
                Orientation         = Orientation.Horizontal,
                Height              = _this.ActualHeight,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Center,
                Background          = Brushes.Transparent,
            };

            ColorZone ColorZone1 = new ColorZone()
            {
                Mode   = ColorZoneMode.PrimaryMid,
                Height = _this.ActualHeight,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Center,
                SnapsToDevicePixels = true,
                Background          = Brushes.Transparent,
            };

            foreach (var c in _this.Children.Cast <UIElement>().ToList().AsReadOnly())
            {
                _this.Children.Remove(c);
                StackPanel1.Children.Add(c);
            }

            SetZIndex(ColorZone1, 0);
            SetZIndex(StackPanel1, 0);
            _this.Children.Add(ColorZone1);
            _this.Children.Add(StackPanel1);

            ShadowAssist.SetShadowDepth(ColorZone1, ShadowDepth.Depth1);

            //foreach (var c in _this.Children.Cast<UIElement>().ToList().AsReadOnly())
            //{
            //    _this.Children.Remove(c);
            //    StackPanel1.Children.Add(c);
            //}

            ////Button Button1 = new Button()
            ////{
            ////    Margin = new Thickness(6, 0, 2, 0),
            ////    Padding = new Thickness(0),
            ////    Width = 24,
            ////    Height = 24,
            ////    HorizontalAlignment = HorizontalAlignment.Center,
            ////    HorizontalContentAlignment = HorizontalAlignment.Center,
            ////    VerticalAlignment = VerticalAlignment.Center,
            ////    VerticalContentAlignment = VerticalAlignment.Center,
            ////    Style = _this.FindResource("MaterialDesignFloatingActionButton") as Style,
            ////    Foreground = _this.FindResource("MaterialDesignPaper") as Brush,
            ////    //Style = _this.FindResource("MaterialDesignRaisedDarkButton") as Style,
            ////    //Background = Brushes.Transparent,
            ////};

            ////RippleAssist.SetIsCentered(Button1, true);
            ////ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth0);

            ////var PackIcon1 = new PackIcon()
            ////{
            ////    HorizontalAlignment = HorizontalAlignment.Center,
            ////    VerticalAlignment = VerticalAlignment.Center,
            ////    Width = 16,
            ////    Height = 16,
            ////    Kind = PackIconKind.Menu,
            ////    Foreground = _this.FindResource("MaterialDesignPaper") as Brush,
            ////};

            ////Button1.Content = PackIcon1;

            ////var TextBlock1 = new TextBlock()
            ////{
            ////    Margin = new Thickness(2, 0, 7, 0),
            ////    //Height = Convert.ToDouble(_this.ActualHeight),
            ////    HorizontalAlignment = HorizontalAlignment.Center,
            ////    VerticalAlignment = VerticalAlignment.Center,
            ////    Text = "Placeholder",
            ////    FontFamily = new FontFamily("Roboto"),
            ////    FontSize = 13,
            ////    //Background = Brushes.Yellow,
            ////    Foreground = _this.FindResource("MaterialDesignPaper") as Brush,
            ////};

            ////StackPanel1.Children.Insert(0, TextBlock1);
            ////StackPanel1.Children.Insert(0, Button1);

            //SetZIndex(ColorZone1, -1);
            //SetZIndex(StackPanel1, 0);

            ////_this.Children.Add(ColorZone1);
            //_this.Children.Add(StackPanel1);

            _this.CheckIfHandlerShouldExecute = false;
        }
Beispiel #15
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;
                }
            }
        }
Beispiel #16
0
 public pPrint(ColorZone Container)
 {
     printDialog.PrintVisual(Container, "Print");
 }
Beispiel #17
0
        private async void Plan_Prises_Click(object sender, RoutedEventArgs e, String mt, String sequi, String pln)
        {
            headerStack.Children.Clear();
            Previous_Button(sender, e, "Plan_Prises_Click");
            gr.Children.Clear();
            gr.RowDefinitions.Clear();
            //gr.ColumnDefinitions.Clear();

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

            var nb  = prises.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 prise in prises)
            {
                if (i == 4)
                {
                    i = 0;
                    j++;
                }

                Grid g = new Grid();

                // Create Rows
                var cp = 0;
                while (cp <= 8)
                {
                    g.RowDefinitions.Add(new RowDefinition());
                    cp++;
                }
                Chip titre = new Chip();
                titre.HorizontalAlignment = HorizontalAlignment.Center;
                titre.FontWeight          = FontWeights.Bold;
                titre.Content             = prise.Key;

                ColorZone colorz = new ColorZone();
                colorz.Mode    = ColorZoneMode.Accent;
                colorz.Content = titre;

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

                Chip note = new Chip();
                note.Width = 200;

                RatingBar noteRt = new RatingBar();
                noteRt.HorizontalAlignment = HorizontalAlignment.Center;
                noteRt.Max = 3;
                if (prise.Object.note == "exellente")
                {
                    noteRt.Value = 3;
                }
                else if (prise.Object.note == "moyenne")
                {
                    noteRt.Value = 2;
                }
                else
                {
                    noteRt.Value = 1;
                }
                note.Content = noteRt;

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

                Chip commentaire = new Chip();
                commentaire.Width   = 200;
                commentaire.Content = "commentaire :" + prise.Object.commentaire;

                Grid.SetRow(commentaire, 2);
                g.Children.Add(commentaire);

                Chip diaff = new Chip();
                diaff.Width   = 200;
                diaff.Content = "diaff :" + prise.Object.diaff;

                Grid.SetRow(diaff, 3);
                g.Children.Add(diaff);

                Chip filtre = new Chip();
                filtre.Width   = 200;
                filtre.Content = "filtre :" + prise.Object.filtre;

                Grid.SetRow(filtre, 4);
                g.Children.Add(filtre);

                Chip minutage = new Chip();
                minutage.Width   = 200;
                minutage.Content = "minutage :" + prise.Object.minutage;

                Grid.SetRow(minutage, 5);
                g.Children.Add(minutage);

                Chip taille = new Chip();
                taille.Width   = 200;
                taille.Content = "taille :" + prise.Object.taille;

                Grid.SetRow(taille, 6);
                g.Children.Add(taille);

                Chip unite = new Chip();
                unite.Width   = 200;
                unite.Content = "unite :" + prise.Object.unite;

                Grid.SetRow(unite, 7);
                g.Children.Add(unite);

                ScrollViewer scrollPrise = new ScrollViewer();
                scrollPrise.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                scrollPrise.Height  = 270;
                scrollPrise.Content = g;

                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 = scrollPrise;


                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++;
            }
        }
Beispiel #18
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++;
                            }
                        }
                    }
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// 创建Flipper的前展示区
        /// </summary>
        /// <param name="preset"></param>
        /// <returns></returns>
        private UIElement CreateFrontContent(PresetData preset, string UUID)
        {
            ColorZone TitlecolorZone = new ColorZone()
            {
                Mode = ColorZoneMode.PrimaryLight, Height = 30
            };
            TextBlock StateText = new TextBlock()
            {
                Text = LocalizedHelper.GetLocalizedString("State_Available", ID.StrRes_Preset), Foreground = (Brush)this.FindResource("AccentColorBrush3"), Margin = new Thickness(10)
            };

            TextBlock NamText = new TextBlock()
            {
                Text = preset.PresetName, Margin = new Thickness(10), Style = (Style)this.FindResource("MaterialDesignTitleTextBlock"), HorizontalAlignment = HorizontalAlignment.Center
            };

            TextBlock CoreText = new TextBlock()
            {
                Text = preset.Core, Margin = new Thickness(10), Style = (Style)this.FindResource("MaterialDesignBody1TextBlock"), HorizontalAlignment = HorizontalAlignment.Center
            };

            TextBlock InstallTime = new TextBlock()
            {
                Text = preset.InstallTime.Date.ToString(), Margin = new Thickness(10, 10, 10, 10), Style = (Style)this.FindResource("MaterialDesignBody1TextBlock"), HorizontalAlignment = HorizontalAlignment.Center
            };

            Button DetailBtn = new Button()
            {
                Style = (Style)this.FindResource("MaterialDesignFlatButton"), Content = LocalizedHelper.GetLocalizedString("Btn_Detail", ID.StrRes_Preset), Margin = new Thickness(10), Tag = UUID
            };

            DetailBtn.Click += new RoutedEventHandler(DetailBtn_Click);

            Button ChangeStateBtn = new Button()
            {
                Style = (Style)this.FindResource("MaterialDesignFloatingActionMiniAccentButton"), Content = new PackIcon()
                {
                    Kind = PackIconKind.Play
                }, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(0, 0, 16, -25), Tag = UUID
            };

            if (preset.isRunning)
            {
                TitlecolorZone.Mode    = ColorZoneMode.PrimaryDark;
                StateText.Foreground   = (Brush)this.FindResource("AccentColorBrush");
                StateText.Text         = LocalizedHelper.GetLocalizedString("State_Running", ID.StrRes_Preset);
                ChangeStateBtn.Content = new PackIcon()
                {
                    Kind = PackIconKind.Stop
                };
                ChangeStateBtn.Click += new RoutedEventHandler(UnApplyPresetBtn_Click);
            }
            else
            {
                ChangeStateBtn.Click += new RoutedEventHandler(ApplyPresetBtn_Click);
            }


            Grid TitleGrid = new Grid()
            {
                RowDefinitions =
                {
                    new RowDefinition(),
                    new RowDefinition()
                }
            };

            TitleGrid.Children.Add(TitlecolorZone);
            TitleGrid.Children.Add(ChangeStateBtn);
            TitleGrid.Children.Add(NamText);
            Grid.SetRow(TitlecolorZone, 0);
            Grid.SetRow(ChangeStateBtn, 0);
            Grid.SetRow(NamText, 1);

            Grid InfoGrid = new Grid()
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition(),
                    new ColumnDefinition()
                },
                VerticalAlignment = VerticalAlignment.Top,
                Margin            = new Thickness(10)
            };

            InfoGrid.Children.Add(CoreText);
            InfoGrid.Children.Add(StateText);
            Grid.SetColumn(CoreText, 0);
            Grid.SetColumn(StateText, 1);

            StackPanel stackPanel = new StackPanel();

            stackPanel.Children.Add(TitleGrid);
            stackPanel.Children.Add(InfoGrid);
            stackPanel.Children.Add(InstallTime);
            stackPanel.Children.Add(DetailBtn);

            return(stackPanel);
        }
Beispiel #20
0
    public void ChangeColor(ParticleColor color)
    {
        ColorZone zone = null;

        for (int i = 0; i < zones.Count; i++)
        {
            zone = zones[i] as ColorZone;
            if (zone != null)
            {
                break;
            }
        }

        if (zone == null)
        {
            if (color == ParticleColor.None)
            {
                return;
            }

            zone          = Instantiate(PrefabLibrary.Instance.ColorZone.gameObject).GetComponent <ColorZone>();
            zone.particle = this;
            zone.transform.SetParent(transform);
            zone.transform.localPosition = Vector3.zero;
        }

        switch (color)
        {
        case ParticleColor.None:
            color = ParticleColor.None;
            Destroy(zone.gameObject);
            break;

        case ParticleColor.Beta:
            if (this.color == ParticleColor.Red)
            {
                color = ParticleColor.Green;
            }
            else if (this.color == ParticleColor.Green)
            {
                color = ParticleColor.Blue;
            }
            else if (this.color == ParticleColor.Blue)
            {
                color = ParticleColor.Red;
            }

            decayTimer = decayTime;
            break;
        }

        this.color = color;
        switch (color)
        {
        case ParticleColor.Blue:
            material.color = Color.blue;
            break;

        case ParticleColor.Green:
            material.color = Color.green;
            break;

        case ParticleColor.Red:
            material.color = Color.red;
            break;
        }
    }
Beispiel #21
0
        private static void OnSizeChanged(object sender, RoutedEventArgs e) // this is called two times
        {
            // Only specify horizontal margin here.
            var _this = (sender as JumpComboBox);

            if (_this.CheckIfHandlerShouldExecute == false)
            {
                return;
            }

            var ColorZone1 = new ColorZone()
            {
                Mode = ColorZoneMode.Light,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                SnapsToDevicePixels = true,
            };

            ShadowAssist.SetShadowEdges(ColorZone1, ShadowEdges.Right);
            ShadowAssist.SetShadowDepth(ColorZone1, ShadowDepth.Depth1);

            var StackPanel1 = new StackPanel()
            {
                Margin              = new Thickness(0, 1, 0, 1),
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                //Background = Brushes.Transparent,
            };

            var PackIcon1 = new PackIcon()
            {
                Margin = new Thickness(6, 0, 0, 0),
                Height = Convert.ToDouble(_this.ActualHeight),
                Width  = Convert.ToDouble(14),
                HorizontalAlignment        = HorizontalAlignment.Center,
                VerticalAlignment          = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Kind = PackIconKind.ViewList,
                //Background = Brushes.Transparent,
            };

            StackPanel1.Children.Add(PackIcon1);

            var MyComboBox1 = new MyComboBox()
            {
                Margin  = new Thickness(0, 0, 12, 0),
                Padding = new Thickness(4, 0, 0, 2),
                HorizontalContentAlignment = HorizontalAlignment.Left,
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                VerticalAlignment          = VerticalAlignment.Stretch,
                //Background = Brushes.Transparent,
                SnapsToDevicePixels = true,
            };

            var srcList = _this.Children.Cast <UIElement>().ToList().AsReadOnly();

            {
                for (int i = 0; i < srcList.Count; i++)
                {
                    var eItem = srcList.ElementAt(i);
                    if (!eItem.GetType().IsEquivalentTo(typeof(MyComboBoxItem)))
                    {
                        continue;
                    }

                    eItem.Visibility = Visibility.Collapsed;
                    eItem.IsEnabled  = false;

                    var newItem = new MyComboBoxItem()
                    {
                        Margin  = new Thickness(0, -(_this.Margin.Top / 2), 0, -(_this.Margin.Bottom / 2)),
                        Content = $"{(eItem as MyComboBoxItem).Content}"
                    };

                    MyComboBox1.Items.Add(newItem);
                }
            }

            StackPanel1.Children.Add(MyComboBox1);
            ColorZone1.Content = StackPanel1;
            _this.Children.Add(ColorZone1);
            _this.CheckIfHandlerShouldExecute = false;
        }
        //Helper Methods
        private void LoadFromFile(XmlDocument doc)
        {
            //grab all accounts from node
            XmlNodeList account = doc.GetElementsByTagName("account");

            var numCol = 3;

            for (var i = 0; i < numCol; ++i)
            {
                ColumnDefinition tempCol = new ColumnDefinition();
                tempCol.Width = new GridLength(1, GridUnitType.Star);
                Accounts.ColumnDefinitions.Add(tempCol);
            }

            for (var i = 0; i < account.Count; ++i)
            {
                if (i % numCol == 0)
                {
                    RowDefinition tempRow = new RowDefinition();
                    tempRow.Height = new GridLength(1, GridUnitType.Star);
                    Accounts.RowDefinitions.Add(tempRow);
                }
            }

            int newRowCounter = 0;

            for (int i = 0; i < account.Count; i++)
            {
                passwordmanagerAccount currentAccount = password.GrabAccount(i);


                var flipper = new Flipper();
                flipper.Margin = new Thickness(20);

                if (i >= numCol)
                {
                    if (i % numCol == 0)
                    {
                        newRowCounter++;
                    }
                }

                flipper.SetValue(Grid.RowProperty, newRowCounter);
                flipper.SetValue(Grid.ColumnProperty, (i % numCol));



                Grid innerGrid = new Grid();
                innerGrid.Height = 300;
                innerGrid.Width  = 200;

                RowDefinition gridRow1 = new RowDefinition();
                gridRow1.Height = new GridLength(160);
                RowDefinition gridRow2 = new RowDefinition();
                gridRow2.Height = new GridLength(1, GridUnitType.Star);

                innerGrid.RowDefinitions.Add(gridRow1);
                innerGrid.RowDefinitions.Add(gridRow2);

                var colorZone = new ColorZone();
                colorZone.Mode = ColorZoneMode.PrimaryLight;
                colorZone.VerticalAlignment = VerticalAlignment.Stretch;
                innerGrid.Children.Add(colorZone);

                PackIcon AccountCircle = new PackIcon();
                AccountCircle.Kind                = PackIconKind.AccountCircle;
                AccountCircle.Height              = 128;
                AccountCircle.Width               = 128;
                AccountCircle.VerticalAlignment   = VerticalAlignment.Center;
                AccountCircle.HorizontalAlignment = HorizontalAlignment.Center;
                innerGrid.Children.Add(AccountCircle);


                StackPanel sp = new StackPanel();
                sp.SetValue(Grid.RowProperty, 1);
                sp.VerticalAlignment = VerticalAlignment.Center;

                TextBlock userID = new TextBlock();
                userID.Text = currentAccount.description;
                userID.HorizontalAlignment = HorizontalAlignment.Center;

                sp.Children.Add(userID);

                Button flipperEditButton = new Button();
                flipperEditButton.Style   = (Style)Application.Current.TryFindResource("MaterialDesignFlatButton");
                flipperEditButton.Content = "EDIT";
                flipperEditButton.Margin  = new Thickness(0, 4, 0, 0);
                flipperEditButton.Command = Flipper.FlipCommand;
                sp.Children.Add(flipperEditButton);

                Button flipperDeleteButton = new Button();
                flipperDeleteButton.Style   = (Style)Application.Current.TryFindResource("MaterialDesignFlatButton");
                flipperDeleteButton.Content = "DELETE";
                flipperDeleteButton.Margin  = new Thickness(0, 4, 0, 0);
                flipperDeleteButton.Command = new Delete(i);
                sp.Children.Add(flipperDeleteButton);

                innerGrid.Children.Add(sp);

                flipper.FrontContent = innerGrid;

                //Back side of flipper

                Grid backGrid = new Grid();
                backGrid.Height = 300;
                backGrid.Width  = 200;

                RowDefinition backGridRow1 = new RowDefinition();
                backGridRow1.Height = new GridLength(1, GridUnitType.Auto);
                RowDefinition backGridRow2 = new RowDefinition();
                backGridRow2.Height = new GridLength(1, GridUnitType.Star);

                backGrid.RowDefinitions.Add(backGridRow1);
                backGrid.RowDefinitions.Add(backGridRow2);

                ColorZone backColorZone = new ColorZone();
                backColorZone.Mode    = ColorZoneMode.Accent;
                backColorZone.Padding = new Thickness(6);

                StackPanel backStack = new StackPanel();
                backStack.Orientation = Orientation.Horizontal;

                Button backButton = new Button();
                backButton.Style               = (Style)Application.Current.TryFindResource("MaterialDesignToolForegroundButton");
                backButton.Command             = Flipper.FlipCommand;
                backButton.HorizontalAlignment = HorizontalAlignment.Left;

                PackIcon backArrowLeft = new PackIcon();
                backArrowLeft.Kind = PackIconKind.ArrowLeft;
                backArrowLeft.HorizontalAlignment = HorizontalAlignment.Right;

                backButton.Content = backArrowLeft;
                backStack.Children.Add(backButton);

                TextBlock backEditUser = new TextBlock();
                backEditUser.Margin            = new Thickness(8, 0, 0, 0);
                backEditUser.VerticalAlignment = VerticalAlignment.Center;
                backEditUser.Text = "EDIT USER";
                backStack.Children.Add(backEditUser);

                backColorZone.Content = backStack;

                backGrid.Children.Add(backColorZone);

                Grid backInformationGrid = new Grid();
                backInformationGrid.SetValue(Grid.RowProperty, 1);
                backInformationGrid.Margin = new Thickness(0, 6, 0, 0);
                backInformationGrid.HorizontalAlignment = HorizontalAlignment.Center;
                backInformationGrid.VerticalAlignment   = VerticalAlignment.Top;
                backInformationGrid.Width = 172;

                for (var j = 0; j < 5; ++j)
                {
                    RowDefinition tempRow = new RowDefinition();
                    tempRow.Height = new GridLength(1, GridUnitType.Star);
                    backInformationGrid.RowDefinitions.Add(tempRow);
                }

                //                    < TextBox materialDesign: HintAssist.Hint = "User ID:" materialDesign: HintAssist.IsFloating = "True"
                //                 Margin = "0 12 0 0" > trandall </ TextBox >

                TextBox backUserID = new TextBox();
                backUserID.Name   = "tbUserID" + i.ToString();
                backUserID.Margin = new Thickness(0, 12, 0, 0);
                backUserID.Text   = currentAccount.userid;
                HintAssist.SetHint(backUserID, "User ID:");
                HintAssist.SetIsFloating(backUserID, true);
                backUserID.KeyDown += OnKeyDownHandler;
                backInformationGrid.Children.Add(backUserID);

                //                    < TextBox Grid.Row = "1" materialDesign: HintAssist.Hint = "Desciption" materialDesign: HintAssist.IsFloating = "True"
                //                 Margin = "0 12 0 0" > CIBC Online Banking</ TextBox >

                TextBox backDescrip = new TextBox();
                backDescrip.SetValue(Grid.RowProperty, 1);
                backDescrip.Margin = new Thickness(0, 12, 0, 0);
                backDescrip.Text   = currentAccount.description;
                HintAssist.SetHint(backDescrip, "Desciption:");
                HintAssist.SetIsFloating(backDescrip, true);
                backInformationGrid.Children.Add(backDescrip);

                //                        < TextBox Grid.Row = "2" materialDesign: HintAssist.Hint = "Password" materialDesign: HintAssist.IsFloating = "True"
                //                 Margin = "0 12 0 0" > pug12345 </ TextBox >

                TextBox backPassword = new TextBox();
                backPassword.SetValue(Grid.RowProperty, 2);
                backPassword.Margin = new Thickness(0, 12, 0, 0);
                backPassword.Text   = currentAccount.password.Value;
                HintAssist.SetHint(backPassword, "Password:"******"3" materialDesign: HintAssist.Hint = "Log-in URL" materialDesign: HintAssist.IsFloating = "True"
                //                 Margin = "0 12 0 0" > very weak </ TextBox >

                TextBox backLogURL = new TextBox();
                backLogURL.SetValue(Grid.RowProperty, 3);
                backLogURL.Margin = new Thickness(0, 12, 0, 0);
                backLogURL.Text   = currentAccount.loginurl;
                HintAssist.SetHint(backLogURL, "Log-in URL:");
                HintAssist.SetIsFloating(backLogURL, true);
                backInformationGrid.Children.Add(backLogURL);

                //                        < TextBox Grid.Row = "4" materialDesign: HintAssist.Hint = "Account Number" materialDesign: HintAssist.IsFloating = "True"
                //                 Margin = "0 12 0 0" > very weak </ TextBox >

                TextBox backAccountNumber = new TextBox();
                backAccountNumber.SetValue(Grid.RowProperty, 4);
                backAccountNumber.Margin = new Thickness(0, 12, 0, 0);
                backAccountNumber.Text   = currentAccount.accountnumber;
                HintAssist.SetHint(backAccountNumber, "Account Number:");
                HintAssist.SetIsFloating(backAccountNumber, true);
                backInformationGrid.Children.Add(backAccountNumber);

                backGrid.Children.Add(backInformationGrid);
                flipper.BackContent = backGrid;

                Accounts.Children.Add(flipper);
            }
        }
Beispiel #23
0
        private void AddCompanyCard(CompanyDto company)
        {
            var card = new Card();

            card.Width  = 200;
            card.Height = 400;
            card.Margin = new Thickness(10, 10, 10, 10);

            var           grid = new Grid();
            RowDefinition row1 = new RowDefinition();
            RowDefinition row2 = new RowDefinition();
            RowDefinition row3 = new RowDefinition();

            //row1.Height = new GridLength(100);

            grid.RowDefinitions.Add(row1);
            grid.RowDefinitions.Add(row2);
            grid.RowDefinitions.Add(row3);

            var colorZone = new ColorZone
            {
                Content = new PackIcon()
                {
                    Kind = PackIconKind.People, Height = 100, Width = 100
                },
                Width  = 200,
                Height = 180,
                Mode   = ColorZoneMode.PrimaryLight,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
            };

            grid.Children.Add(colorZone);
            Grid.SetRow(colorZone, 0);

            var btn = CreatePackIconButton("员工信息", "MaterialDesignFloatingActionMiniAccentButton",
                                           PackIconKind.People, GetEmployeesForCompanyCommand, company);

            btn.Margin = new Thickness(0, 0, 16, -20);
            btn.HorizontalAlignment = HorizontalAlignment.Right;
            btn.VerticalAlignment   = VerticalAlignment.Bottom;
            grid.Children.Add(btn);
            Grid.SetRow(btn, 0);

            var sp = new StackPanel();

            sp.Orientation = Orientation.Vertical;
            sp.Children.Add(new TextBlock {
                Text = company.Name
            });
            sp.Children.Add(new TextBlock {
                Text = company.Introduction
            });
            grid.Children.Add(sp);
            Grid.SetRow(sp, 1);

            var spBottom = new StackPanel();

            spBottom.Orientation         = Orientation.Horizontal;
            spBottom.HorizontalAlignment = HorizontalAlignment.Right;
            spBottom.Margin = new Thickness(8, 8, 8, 8);
            spBottom.Children.Add(CreatePackIconButton("分享", "MaterialDesignToolButton",
                                                       PackIconKind.ShareVariant, null, null));
            spBottom.Children.Add(CreatePackIconButton("关注", "MaterialDesignToolButton",
                                                       PackIconKind.Heart, null, null));
            grid.Children.Add(spBottom);
            Grid.SetRow(spBottom, 2);

            card.Content = grid;

            CompanyCards.Add(card);
        }