private void RunDummyCode() { // Need this or we will get dll problems later on.. ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); var hue = new Hue("Dummy", Colors.AliceBlue, Colors.AntiqueWhite); var o = new TabablzControl(); }
public Dictionary <string, string> PathDict = new Dictionary <string, string>(); //Dictionary used to store layer paths with layer name as key public MainWindow() { InitializeComponent(); ContentControl.Content = new UserControl1(); ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); //Optional: fixed build error bug caused by Material Design dependencies var hue = new Hue("Dummy", Colors.AliceBlue, Colors.AntiqueWhite); //Optional: fixed build error bug caused by Material Design dependencies _dataFolders.Add(@"\\nas\gis\DataPal\Layers\Boundaries"); _dataFolders.Add(@"\\nas\gis\DataPal\Layers\Imagery"); _dataFolders.Add(@"\\nas\gis\DataPal\Layers\Water"); _dataFolders.Add(@"\\nas\gis\DataPal\Layers\Transportation"); _dataFolders.Add(@"\\nas\gis\DataPal\Layers\HabitatEnvironment"); _dataFolders.Add(@"\\nas\gis\DataPal\Layers\AD_Authoritative"); //Populate search source list and layer path dictionary foreach (var pth in _dataFolders) { DirectoryInfo dinfo = new DirectoryInfo(pth); FileInfo[] files = dinfo.GetFiles("*.lyr"); foreach (FileInfo file in files) { string fileName = Path.GetFileNameWithoutExtension(file.FullName); SearchSource.Add(fileName); PathDict.Add(fileName, Path.GetFullPath(file.FullName)); } } }
// Work-around: Manually load resources due to WPF being hosted out-of-process and lack of App.xaml. private void LoadResources() { if (Application.Current == null) { // Application will be null, so create one var application = new Application { Resources = new ResourceDictionary() }; // mahapps // controls application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Controls.xaml", UriKind.Relative))); // fonts and colors application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Fonts.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Colors.xaml", UriKind.Relative))); // themes application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Accents/Blue.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Accents/BaseLight.xaml", UriKind.Relative))); // material design // Work-around: This forces the Material Design .dlls to be compiled and copied. // Otherwise, they won't and loading the assemblies below will throw FileNotFound. // https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/427 ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); var provider = new SwatchesProvider(); FlyoutAssist.GetHeaderShadowDepth(this); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Orange.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Fonts.xaml", UriKind.Relative))); } }
public void GetUsersList() { List.Children.Clear(); JArray jArray = Json.ReadUsers(); for (int i = 0; i < jArray.Count; i++) { Button button = new Button(); button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; button.Margin = new System.Windows.Thickness(0, 0, 10, 0); button.Width = 45; button.Style = (Style)this.FindResource("MaterialDesignFlatButton"); button.Background = button.BorderBrush = new SolidColorBrush(Colors.White); ShadowAssist.SetShadowDepth(button, ShadowDepth.Depth0); button.Foreground = (SolidColorBrush) new BrushConverter().ConvertFromString("#DD000000"); button.Padding = new System.Windows.Thickness(0); button.Click += Button_Click1; button.Tag = JObject.Parse(jArray[i].ToString())["uuid"].ToString(); PackIcon packIcon = new PackIcon(); packIcon.Kind = PackIconKind.Delete; packIcon.Width = packIcon.Height = 22; button.Content = packIcon; RadioButton radioButton = new RadioButton(); radioButton.Margin = new System.Windows.Thickness(10, 0, 0, 0); radioButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; radioButton.Width = 25; radioButton.GroupName = "A"; radioButton.Tag = JObject.Parse(jArray[i].ToString())["uuid"].ToString(); if (Settings.UUID == JObject.Parse(jArray[i].ToString())["uuid"].ToString()) { radioButton.IsChecked = true; } radioButton.Checked += RadioButton_Checked; Label label = new Label(); label.Content = JObject.Parse(jArray[i].ToString())["userName"].ToString() + " - " + JObject.Parse(jArray[i].ToString())["Email"].ToString(); label.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; label.FontFamily = new FontFamily("Microsoft YaHei UI Light"); label.FontSize = 14; label.Margin = new System.Windows.Thickness(30, 0, 90, 0); Grid grid = new Grid(); grid.Height = 40; grid.Background = new SolidColorBrush(Colors.White); grid.Margin = new System.Windows.Thickness(5, 5, 5, 0); if (i == jArray.Count - 1) { grid.Margin = new System.Windows.Thickness(5, 5, 5, 5); } grid.Children.Add(button); grid.Children.Add(radioButton); grid.Children.Add(label); List.Children.Add(grid); } }
private void Previous_Button(object sender, RoutedEventArgs e, String nomMethod) { Button prev = new Button(); Color color = (Color)ColorConverter.ConvertFromString("#FFAEEA00"); prev.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B)); ShadowAssist.SetShadowDepth(prev, ShadowDepth.Depth5); if (nomMethod == "Window_Loaded") { PackIcon prevIcon = new PackIcon(); prevIcon.Kind = PackIconKind.ArrowLeftBold; prevIcon.Background = Brushes.Black; prev.Content = prevIcon; headerStack.Children.Add(prev); prev.Click += (Object, RoutedEventArgs) => { Window_Loaded(sender, e); }; } else if (nomMethod == "Movie_Click") { Button home = new Button(); home.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B)); ShadowAssist.SetShadowDepth(home, ShadowDepth.Depth5); PackIcon homeIcon = new PackIcon(); homeIcon.Kind = PackIconKind.Home; homeIcon.Background = Brushes.Black; home.Content = homeIcon; home.Click += (Object, RoutedEventArgs) => { Window_Loaded(sender, e); }; PackIcon prevIcon = new PackIcon(); prevIcon.Kind = PackIconKind.ArrowLeftBold; prevIcon.Background = Brushes.Black; prev.Content = prevIcon; Label espace = new Label(); headerStack.Children.Add(home); headerStack.Children.Add(espace); headerStack.Children.Add(prev); prev.Click += (Object, RoutedEventArgs) => { Movie_Click(sender, e, movieTile); }; } else if (nomMethod == "Plan_Prises_Click") { Button home = new Button(); home.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B)); ShadowAssist.SetShadowDepth(home, ShadowDepth.Depth5); PackIcon homeIcon = new PackIcon(); homeIcon.Kind = PackIconKind.Home; homeIcon.Background = Brushes.Black; home.Content = homeIcon; home.Click += (Object, RoutedEventArgs) => { Window_Loaded(sender, e); }; PackIcon prevIcon = new PackIcon(); prevIcon.Kind = PackIconKind.ArrowLeftBold; prevIcon.Background = Brushes.Black; prev.Content = prevIcon; Label espace = new Label(); headerStack.Children.Add(home); headerStack.Children.Add(espace); headerStack.Children.Add(prev); prev.Click += (Object, RoutedEventArgs) => { Sequence_Click(sender, e, movieTile, sequenceMovie); }; } }
/// <summary> /// Make the shadow of a card darken when hoover /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Card_MouseEnter(object sender, MouseEventArgs e) { var card = sender as Card; this.defaultShadowDepth = ShadowAssist.GetShadowDepth(card); ShadowAssist.SetShadowDepth(card, DarkShadowDepth); }
public VD1Window(VD1ViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; DataContext = viewModel; Icon = dlqConstraint.IconWindow; ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); }
private void expanderNewSession_Expanded(object sender, RoutedEventArgs e) { ShadowAssist.SetShadowDepth(expanderBase, ShadowDepth.Depth2); NewSessionNameValidationRule.CheckDuplicate = EditSession == null; if (EditSession == null) { NewSessionName = ""; timeNewSession.SelectedTime = null; } }
private void expanderNewSession_Collapsed(object sender, RoutedEventArgs e) { ShadowAssist.SetShadowDepth(expanderBase, ShadowDepth.Depth0); if (EditSession != null) { EditSession = null; NewSessionName = ""; timeNewSession.SelectedTime = null; expanderNewSession.Header = "New Session Type"; } }
private static void OnLoaded(object sender, RoutedEventArgs e) { var _this = (sender as SideAppBar); if (_this.CheckIfHandlerShouldExecute == false) { return; } _this.m_StackPanel1 = new StackPanel() { Margin = new Thickness(0, 0, 0, 0), Orientation = Orientation.Vertical, Width = _this.ActualWidth, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, Background = Brushes.Transparent, }; _this.m_ColorZone1 = new ColorZone() { Mode = ColorZoneMode.PrimaryDark, Width = _this.ActualWidth, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, SnapsToDevicePixels = true, }; ShadowAssist.SetShadowEdges(_this.m_ColorZone1, ShadowEdges.Right); ShadowAssist.SetShadowDepth(_this.m_ColorZone1, ShadowDepth.Depth0); SetZIndex(_this.m_ColorZone1, 0); SetZIndex(_this.m_StackPanel1, 0); foreach (var c in _this.Children.Cast <UIElement>().ToList().AsReadOnly()) { _this.Children.Remove(c); _this.m_StackPanel1.Children.Add(c); } _this.Children.Add(_this.m_ColorZone1); _this.Children.Add(_this.m_StackPanel1); _this.StartAnimExpand(); _this.CheckIfHandlerShouldExecute = false; }
public AutoComplete() { AutoCompleteBox = new ListView(); AutoCompleteBox.MouseDoubleClick += AutoCompleteBox_MouseDoubleClick; AutoCompletePopup = new Popup { Child = AutoCompleteBox, StaysOpen = false, Placement = PlacementMode.Bottom, MaxHeight = 300 }; ShadowAssist.SetShadowDepth(AutoCompletePopup, ShadowDepth.Depth3); AutoCompletePopup.Closed += AutoCompletePopup_Closed; }
private static void OnLoad(object sender, RoutedEventArgs e) { var _this = (sender as TopAppBar_Navigation); if (_this.m_CheckIfHandlerShouldExecute == false) { return; } var Button1 = new Button() { Name = "TopAppBar_Navigation_Button1", Margin = new Thickness(0), Padding = new Thickness(0), Width = 40, Height = 32, HorizontalAlignment = HorizontalAlignment.Center, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, Foreground = _this.FindResource("MaterialDesignPaper") as Brush, //Style = _this.FindResource("MaterialDesignFloatingActionButton") as Style, Style = _this.FindResource("MaterialDesignRaisedButton") as Style, Content = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 18, Height = 18, Kind = PackIconKind.Menu, Foreground = _this.FindResource("MaterialDesignPaper") as Brush, }, }; Button1.AddHandler(MouseDownEvent, new MouseButtonEventHandler(SideAppBar.OnMouseDown), true); RippleAssist.SetIsCentered(Button1, true); RippleAssist.SetClipToBounds(Button1, true); RippleAssist.SetIsDisabled(Button1, true); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth0); _this.Children.Add(Button1); _this.m_CheckIfHandlerShouldExecute = false; }
private static void OnLoad(object sender, RoutedEventArgs e) { var _this = (sender as TopAppBar_Button); if (_this.m_CheckIfHandlerShouldExecute == false) { return; } var Button1 = new Button() { Padding = new Thickness(0), Width = 32, Height = 32, HorizontalAlignment = HorizontalAlignment.Center, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, Foreground = _this.FindResource("MaterialDesignPaper") as Brush, Style = _this.FindResource("MaterialDesignFloatingActionDarkButton") as Style, //Style = _this.FindResource("MaterialDesignRaisedDarkButton") as Style, //Background = Brushes.Transparent, Content = new PackIcon() { Background = Brushes.Transparent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 18, Height = 18, Kind = _this.Icon, Foreground = _this.FindResource("MaterialDesignPaper") as Brush, }, }; RippleAssist.SetIsCentered(Button1, true); RippleAssist.SetClipToBounds(Button1, true); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth0); _this.Children.Add(Button1); _this.m_CheckIfHandlerShouldExecute = false; }
private Button finalRoomCard(Grid roomDataContainer, FeedsJson.FeedProprety dataJson) { Button FinalRoom = new Button(); FinalRoom.Padding = new Thickness(8, 8, 8, 4); ShadowAssist.SetShadowDepth(FinalRoom, ShadowDepth.Depth2); ButtonAssist.SetCornerRadius(FinalRoom, new CornerRadius(1)); RippleAssist.SetFeedback(FinalRoom, (SolidColorBrush)(new BrushConverter().ConvertFrom("#212121"))); FinalRoom.BorderBrush = Brushes.White; FinalRoom.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#212121")); FinalRoom.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); FinalRoom.Width = 305; FinalRoom.Height = 60; FinalRoom.VerticalAlignment = VerticalAlignment.Center; FinalRoom.HorizontalAlignment = HorizontalAlignment.Center; FinalRoom.Content = roomDataContainer; FinalRoom.Name = "Room_" + Rooms.RowDefinitions.Count.ToString() + "_" + dataJson.id; FinalRoom.Click += new RoutedEventHandler(selectRoom_Click); return(FinalRoom); }
public MultiTemplateView() { try { ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); FontAwesome.WPF.ImageAwesome im = new ImageAwesome(); if (Application.Current == null) { // create the Application object // ReSharper disable once ObjectCreationAsStatement new Application(); } var resourceXmlFiles = new List <string> { "/MultiTemplateGenerator.UI;component/Resources/ViewResources.xaml", "/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml", "/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml", "/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" }; // merge in your application resources foreach (var resourceXmlFile in resourceXmlFiles) { Application.Current?.Resources.MergedDictionaries.Add( Application.LoadComponent(new Uri(resourceXmlFile, UriKind.Relative)) as ResourceDictionary); } InitializeComponent(); this.Icon = Properties.Resources.MultiTemplateGenerator.ToImageSource(); } catch (Exception e) { Trace.WriteLine(e); e.ShowErrorMessageBox(); throw; } }
public void SetupTopBar() { TopbarContent = new StackPanel(); TopbarContent.Orientation = Orientation.Horizontal; var modules = DataHelpers.Modules.Where(a => a.EstTopBar); foreach (var item in modules) { Button btn = new Button(); btn.Tag = item; PackIcon pi = new PackIcon(); try { pi.Kind = (PackIconKind)Enum.Parse(typeof(PackIconKind), item.ModuleIcon); } catch (Exception s) { pi.Kind = PackIconKind.OpenInApp; } pi.Width = 23; pi.HorizontalAlignment = HorizontalAlignment.Center; pi.Height = 23; btn.Content = pi; btn.Click += Btn_Click; // btn.Foreground = Brushes.Black; btn.ToolTip = item.Libelle; ShadowAssist.SetShadowDepth(btn, ShadowDepth.Depth0); btn.BorderThickness = new Thickness(0); //btn.Background = Brushes.Transparent; //btn.Foreground = Brushes. btn.Style = App.Current.TryFindResource("ToolbarButtonHd") as Style; TopbarContent.Children.Add(btn); } NotifyOfPropertyChange("TopbarContent"); }
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++; } }
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++; } }
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++; } }
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; }
public MainWindow() { InitializeComponent(); var card = new Card { Margin = new Thickness(10), Padding = new Thickness(30), Content = new Grid { Background = new SolidColorBrush(Colors.White), Children = { new TextBlock { Text = "Done in Code Behind", HorizontalAlignment = HorizontalAlignment.Center } } } }; RenderOptions.SetClearTypeHint((Grid)card.Content, ClearTypeHint.Enabled); //Turn off the shadow (it defaults to Depth2) - we will do our own so we can animate it ShadowAssist.SetShadowDepth(card, ShadowDepth.Depth0); var shadow1 = (DropShadowEffect)FindResource("MaterialDesignShadowDepth1"); var shadow2 = (DropShadowEffect)FindResource("MaterialDesignShadowDepth4"); //Cloning so we only change this instance var effect = new DropShadowEffect { BlurRadius = shadow1.BlurRadius, ShadowDepth = shadow1.ShadowDepth, Direction = shadow1.Direction, Color = shadow1.Color, Opacity = shadow1.Opacity, RenderingBias = shadow1.RenderingBias }; card.Effect = effect; //Create storyboard for mouse enter Storyboard mouseEnterStoryboard = new Storyboard(); var enterBlurRadiusAnimation = new DoubleAnimation(shadow2.BlurRadius, new Duration(TimeSpan.FromSeconds(0.5))); Storyboard.SetTargetProperty(enterBlurRadiusAnimation, new PropertyPath(nameof(DropShadowEffect.BlurRadius))); Storyboard.SetTarget(enterBlurRadiusAnimation, effect); mouseEnterStoryboard.Children.Add(enterBlurRadiusAnimation); var enterShadowDepthAnimation = new DoubleAnimation(shadow2.ShadowDepth, new Duration(TimeSpan.FromSeconds(0.5))); Storyboard.SetTargetProperty(enterShadowDepthAnimation, new PropertyPath(nameof(DropShadowEffect.ShadowDepth))); Storyboard.SetTarget(enterShadowDepthAnimation, effect); mouseEnterStoryboard.Children.Add(enterShadowDepthAnimation); mouseEnterStoryboard.Freeze(); //Create storybaord for mouse leave Storyboard mouseLeaveStoryboard = new Storyboard(); var leaveBlurRadiusAnimation = new DoubleAnimation(shadow1.BlurRadius, new Duration(TimeSpan.FromSeconds(0.5))); Storyboard.SetTargetProperty(leaveBlurRadiusAnimation, new PropertyPath(nameof(DropShadowEffect.BlurRadius))); Storyboard.SetTarget(leaveBlurRadiusAnimation, effect); mouseLeaveStoryboard.Children.Add(leaveBlurRadiusAnimation); var leaveShadowDepthAnimation = new DoubleAnimation(shadow1.ShadowDepth, new Duration(TimeSpan.FromSeconds(0.5))); Storyboard.SetTargetProperty(leaveShadowDepthAnimation, new PropertyPath(nameof(DropShadowEffect.ShadowDepth))); Storyboard.SetTarget(leaveShadowDepthAnimation, effect); mouseLeaveStoryboard.Children.Add(leaveShadowDepthAnimation); mouseLeaveStoryboard.Freeze(); card.MouseEnter += (sender, e) => { card.BeginStoryboard(mouseEnterStoryboard); }; card.MouseLeave += (sender, e) => { card.BeginStoryboard(mouseLeaveStoryboard); }; StackPanel.Children.Add(card); }
private void txbCut_Loaded(object sender, RoutedEventArgs e) { ShadowAssist.SetShadowDepth(colorZone, ShadowDepth.Depth0); }
public PhoneBookSearch() { InitializeComponent(); ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); }
/// <summary> /// Changes the card back to its default shadow depth /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Card_MouseLeave(object sender, MouseEventArgs e) { var card = sender as Card; ShadowAssist.SetShadowDepth(card, this.defaultShadowDepth); }
private static void OnLoad(object sender, RoutedEventArgs e) { var This = (sender as TopAppBar_Apps); if (This.m_CheckIfHandlerShouldExecute == false) { return; } ///////////////////////////////////////////////////////////////////////////////// // PopupBox Button var PopupBox1 = new PopupBox() { Name = "TopAppBar_Notifications_PopupBox1", //Style = _this.FindResource("MaterialDesignToolPopupBox") as Style, //Width = 32, Height = 32, ClipToBounds = true, StaysOpen = true, Margin = new Thickness(0), Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Center, Foreground = This.FindResource("MaterialDesignPaper") as Brush, PopupMode = PopupBoxPopupMode.Click, UnfurlOrientation = Orientation.Vertical, PlacementMode = PopupBoxPlacementMode.BottomAndAlignRightEdges, FlowDirection = FlowDirection.LeftToRight, SnapsToDevicePixels = true, }; //EventManager.RegisterClassHandler(typeof(PopupBox), PopupBox.OpenedEvent, new RoutedEventHandler(OnPopupOpened)); var PackIcon1 = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 18, Height = 18, Kind = PackIconKind.Apps, Foreground = This.FindResource("MaterialDesignPaper") as Brush, }; PopupBox1.ToggleContent = PackIcon1; ShadowAssist.SetShadowDepth(PopupBox1, ShadowDepth.Depth0); RippleAssist.SetRippleSizeMultiplier(PopupBox1, 0.5f); RippleAssist.SetClipToBounds(PopupBox1, false); RippleAssist.SetIsCentered(PopupBox1, true); RippleAssist.SetIsDisabled(PopupBox1, true); // PopupBox Button End // Card var PrimaryStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; var HeaderStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, Orientation = Orientation.Vertical, Background = Brushes.WhiteSmoke, }; var TextBlock1 = new TextBlock() { FontFamily = new FontFamily("Roboto"), Padding = new Thickness(96, 9, 96, 9), TextAlignment = TextAlignment.Center, FontSize = 13, Opacity = 0.75f, Text = Application.Current.MainWindow.Title == "" ? "Apps" : Application.Current.MainWindow.Title, //Background = Brushes.Purple, }; HeaderStackPanel1.Children.Add(TextBlock1); var Button1 = new Button() { Style = This.FindResource("MaterialDesignToolButton") as Style, Height = 16, Content = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 11, Height = 11, Kind = PackIconKind.ArrowCollapseDown, Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(0, 0, 0, 0), }, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(0, 0, 0, 0), Background = Brushes.Gainsboro, }; ShadowAssist.SetShadowEdges(Button1.Content as PackIcon, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); ShadowAssist.SetShadowEdges(Button1, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); RippleAssist.SetIsDisabled(Button1, false); RippleAssist.SetIsCentered(Button1, true); RippleAssist.SetClipToBounds(Button1, true); RippleAssist.SetRippleSizeMultiplier(Button1, 12.0f); var ListView1 = new StackPanel() { MinWidth = 96, MinHeight = 192, Orientation = Orientation.Horizontal, FlowDirection = FlowDirection.LeftToRight, //HorizontalContentAlignment = HorizontalAlignment.Left, //VerticalContentAlignment = VerticalAlignment.Top, Background = Brushes.WhiteSmoke, }; //ListView1.Children.Add(new TextBlock() //{ // FontSize = 11, // Opacity = 0.75f, // Text = "Nothing to see here!", // //Width = 80, Height = 40, // TextAlignment = TextAlignment.Center, // HorizontalAlignment = HorizontalAlignment.Stretch, // VerticalAlignment = VerticalAlignment.Stretch, // Margin = new Thickness(0, 96, 0, 96), //}); var Button_App1 = new Button() { Name = "TopAppBar_Apps_App1_Button", Style = This.FindResource("MaterialDesignFlatButton") as Style, Margin = new Thickness(4), Padding = new Thickness(0), Width = 48, Height = 48, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Content = new PackIcon() { Width = 32, Height = 32, Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0), //Foreground = This.FindResource("MaterialDesignPaper") as Brush, Kind = PackIconKind.Launch, }, ToolTip = "Launch Portal" }; RippleAssist.SetClipToBounds(Button_App1, true); RippleAssist.SetIsCentered(Button_App1, true); ShadowAssist.SetShadowDepth(Button_App1, ShadowDepth.Depth1); ListView1.Children.Add(Button_App1); var Button_App0 = new Button() { Name = "TopAppBar_Apps_App0_Button", Style = This.FindResource("MaterialDesignFlatButton") as Style, Margin = new Thickness(4), Padding = new Thickness(0), Width = 48, Height = 48, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Content = new PackIcon() { Width = 32, Height = 32, Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0), //Foreground = This.FindResource("MaterialDesignPaper") as Brush, Kind = PackIconKind.Home, }, ToolTip = "Home" }; RippleAssist.SetClipToBounds(Button_App0, true); RippleAssist.SetIsCentered(Button_App0, true); ShadowAssist.SetShadowDepth(Button_App0, ShadowDepth.Depth1); ListView1.Children.Add(Button_App0); EventManager.RegisterClassHandler(typeof(Button), MouseUpEvent, new RoutedEventHandler(OnAppChangedMouseUp)); PrimaryStackPanel1.Children.Add(HeaderStackPanel1); PrimaryStackPanel1.Children.Add(ListView1); PrimaryStackPanel1.Children.Add(Button1); // Card End PopupBox1.PopupContent = PrimaryStackPanel1; // Move PopupBox Attempt var part = PopupBox1.PopupContent as FrameworkElement; if (part == null) { Console.WriteLine("part = Null"); } else { var parent = part.Parent as FrameworkElement; if (parent == null) { Console.WriteLine("parent = Null"); } else if (parent != null) { parent.RenderTransform = new TranslateTransform(100, 0); } part.ClipToBounds = true; } // End This.Children.Add(PopupBox1); ///////////////////////////////////////////////////////////////////////////////// This.m_CheckIfHandlerShouldExecute = false; }
private static void OnLoad(object sender, RoutedEventArgs e) { var This = (sender as TopAppBar_Message); if (This.m_CheckIfHandlerShouldExecute == false) { return; } ///////////////////////////////////////////////////////////////////////////////// // PopupBox Button var PopupBox1 = new PopupBox() { Name = "TopAppBar_Notifications_PopupBox1", //Style = _this.FindResource("MaterialDesignToolPopupBox") as Style, //Width = 32, Height = 32, ClipToBounds = true, StaysOpen = true, Margin = new Thickness(0), Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Center, Foreground = This.FindResource("MaterialDesignPaper") as Brush, PopupMode = PopupBoxPopupMode.Click, UnfurlOrientation = Orientation.Horizontal, PlacementMode = PopupBoxPlacementMode.BottomAndAlignRightEdges, FlowDirection = FlowDirection.LeftToRight, UseLayoutRounding = true, }; EventManager.RegisterClassHandler(typeof(PopupBox), PopupBox.OpenedEvent, new RoutedEventHandler(OnMouseDown)); var PackIcon1 = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 18, Height = 18, Kind = PackIconKind.MessageProcessing, Foreground = This.FindResource("MaterialDesignPaper") as Brush, }; PopupBox1.ToggleContent = PackIcon1; ShadowAssist.SetShadowDepth(PopupBox1, ShadowDepth.Depth0); RippleAssist.SetRippleSizeMultiplier(PopupBox1, 0.5f); RippleAssist.SetClipToBounds(PopupBox1, false); RippleAssist.SetIsCentered(PopupBox1, true); RippleAssist.SetIsDisabled(PopupBox1, true); // PopupBox Button End // Card var PrimaryStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; var HeaderStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, Orientation = Orientation.Vertical, Background = Brushes.WhiteSmoke, }; var TextBlock1 = new TextBlock() { FontFamily = new FontFamily("Roboto"), Padding = new Thickness(96, 9, 96, 9), TextAlignment = TextAlignment.Center, FontSize = 13, Opacity = 0.75f, Text = Application.Current.MainWindow.Title == "" ? "Messages" : Application.Current.MainWindow.Title, //Background = Brushes.Purple, }; HeaderStackPanel1.Children.Add(TextBlock1); var Button1 = new Button() { Style = This.FindResource("MaterialDesignToolButton") as Style, Height = 16, Content = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 11, Height = 11, Kind = PackIconKind.ArrowCollapseDown, Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(0, 0, 0, 0), }, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(0, 0, 0, 0), Background = Brushes.Gainsboro, }; ShadowAssist.SetShadowEdges(Button1.Content as PackIcon, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); ShadowAssist.SetShadowEdges(Button1, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); RippleAssist.SetIsDisabled(Button1, false); RippleAssist.SetIsCentered(Button1, true); RippleAssist.SetClipToBounds(Button1, true); RippleAssist.SetRippleSizeMultiplier(Button1, 12.0f); var ListView1 = new StackPanel() { Orientation = Orientation.Vertical, Background = Brushes.WhiteSmoke, }; ListView1.Children.Add(new TextBlock() { FontSize = 11, Opacity = 0.75f, Text = "All caught up!", //Width = 80, Height = 40, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(0, 96, 0, 96), }); ShadowAssist.SetShadowEdges(ListView1, ShadowEdges.Bottom); ShadowAssist.SetShadowDepth(ListView1, ShadowDepth.Depth1); ShadowAssist.SetDarken(ListView1, true); PrimaryStackPanel1.Children.Add(HeaderStackPanel1); PrimaryStackPanel1.Children.Add(ListView1); PrimaryStackPanel1.Children.Add(Button1); // Card End PopupBox1.PopupContent = PrimaryStackPanel1; This.Children.Add(PopupBox1); ///////////////////////////////////////////////////////////////////////////////// This.m_CheckIfHandlerShouldExecute = false; }
private void Card_MouseLeave(object sender, MouseEventArgs e) { Card card = sender as Card; ShadowAssist.SetShadowDepth(card, ShadowDepth.Depth2); }
private static void OnLoad(object sender, RoutedEventArgs e) { var This = (sender as AppBar_Button); if (This.m_CheckIfHandlerShouldExecute == false) { return; } ///////////////////////////////////////////////////////////////////////////////// // Routed Events EventManager.RegisterClassHandler(typeof(AppBar_Button), MouseEnterEvent, new RoutedEventHandler(OnMouseEnter)); EventManager.RegisterClassHandler(typeof(AppBar_Button), MouseLeaveEvent, new RoutedEventHandler(OnMouseLeave)); EventManager.RegisterClassHandler(typeof(AppBar_Button), MouseDownEvent, new RoutedEventHandler(OnMouseDown)); EventManager.RegisterClassHandler(typeof(AppBar_Button), MouseUpEvent, new RoutedEventHandler(OnMouseUp)); // Routed Events End // Default Properties This.Margin = new Thickness(0); This.Padding = new Thickness(0); This.HorizontalContentAlignment = HorizontalAlignment.Center; This.VerticalContentAlignment = VerticalAlignment.Center; This.Foreground = This.FindResource("MaterialDesignPaper") as Brush; // Default Properties End // Icon This.m_PackIcon = new PackIcon() { Kind = This.Icon, Foreground = This.FindResource("MaterialDesignPaper") as Brush, }; RippleAssist.SetClipToBounds(This, true); RippleAssist.SetIsCentered(This, true); ShadowAssist.SetShadowDepth(This, ShadowDepth.Depth0); This.Content = This.m_PackIcon; // Icon End // Mode var Root = (This.Parent as StackPanel).Parent as AppBar; if (Root.m_ColorZone1.Mode == ColorZoneMode.PrimaryMid) { //This.Margin = new Thickness(0, 2, 2, 2); This.Margin = new Thickness(0, 4, 4, 4); This.m_PackIcon.Width = 18; This.m_PackIcon.Height = 18; This.Width = 28; This.Height = 28; This.Style = This.FindResource("MaterialDesignFloatingActionButton") as Style; RippleAssist.SetIsCentered(This, false); RippleAssist.SetRippleSizeMultiplier(This, 1.50f); } else if (Root.m_ColorZone1.Mode == ColorZoneMode.PrimaryDark) { This.Margin = new Thickness(0); This.m_PackIcon.Width = 20; This.m_PackIcon.Height = 20; This.Height = 32; This.Style = This.FindResource("MaterialDesignRaisedDarkButton") as Style; RippleAssist.SetIsCentered(This, false); RippleAssist.SetRippleSizeMultiplier(This, 1.50f); } // Mode End // Init animation //var fade = new DoubleAnimation() //{ // From = 0, // To = 1, // Duration = TimeSpan.FromSeconds(0.33333333333333333333333333333333f), //}; //Storyboard.SetTarget(fade, This); //Storyboard.SetTargetProperty(fade, new PropertyPath(OpacityProperty)); //var storyboard = new Storyboard(); //storyboard.Children.Add(fade); //storyboard.Begin(); ///////////////////////////////////////////////////////////////////////////////// This.m_CheckIfHandlerShouldExecute = false; }
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++; } }
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); } } }