private Button initSizeChange() { Button changeSize = new Button(); changeSize.VerticalAlignment = VerticalAlignment.Top; changeSize.HorizontalAlignment = HorizontalAlignment.Right; changeSize.Name = "ChangeSize"; //changeSize.Content = "Oven Specifics"; //changeSize.Content = MaterialDesignThemes.Wpf.PackIconKind.AccountEdit; MaterialDesignThemes.Wpf.PackIcon packIcon = new MaterialDesignThemes.Wpf.PackIcon(); packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.TableEdit; packIcon.Width = 18; packIcon.Height = 18; packIcon.VerticalAlignment = VerticalAlignment.Center; packIcon.HorizontalAlignment = HorizontalAlignment.Center; changeSize.Content = packIcon; Thickness margin = changeSize.Margin; margin.Right = 25; changeSize.Margin = margin; changeSize.Height = 20; changeSize.Width = 20; changeSize.Background = Brushes.LightSlateGray; changeSize.Click += ChangeSize_Click; return(changeSize); }
public Board() { addIcon = new MaterialDesignThemes.Wpf.PackIcon(); addIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Add; addIcon.Width = 50; addIcon.Height = 50; addButton = new System.Windows.Controls.Button() { Width = 60, Height = 60, BorderBrush = Brushes.White, Background = Brushes.White, Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFB9CBE4")), HorizontalAlignment = System.Windows.HorizontalAlignment.Center, VerticalAlignment = System.Windows.VerticalAlignment.Center, Content = addIcon }; contentGrid = new System.Windows.Controls.Grid(); contentGrid.Children.Add(addButton); backgroundCard = new MaterialDesignThemes.Wpf.Card(); backgroundCard.Background = Brushes.White; backgroundCard.Margin = new System.Windows.Thickness(20); backgroundCard.MinHeight = 150; backgroundCard.Content = contentGrid; }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values[1] == null || values[1].ToString() == "") { return(values[0].ToString()[0].ToString()); } else { try { using (System.IO.MemoryStream stream = new System.IO.MemoryStream(System.Convert.FromBase64String(values[1].ToString()))) { PngBitmapDecoder decoder = new PngBitmapDecoder(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad); BitmapFrame frame = decoder.Frames.First(); frame.Freeze(); System.Windows.Controls.Image m = new System.Windows.Controls.Image(); m.Source = frame; return(m); } } catch (Exception) { MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon(); icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Account; return(icon); } } }
public void setMarks(double markValue) { mMark = markValue; double numOfFullStars; MaterialDesignThemes.Wpf.PackIcon[] starIcons = new MaterialDesignThemes.Wpf.PackIcon[5]; double rounded = Math.Round(markValue, 1); if (rounded >= 4.5) { //5 stars numOfFullStars = 5; } else if (rounded >= 3.5) { //4 stars numOfFullStars = 4; } else if (rounded >= 2.5) { //3 stars numOfFullStars = 3; } else if (rounded >= 1.5) { //2 stars numOfFullStars = 2; } else if (rounded >= 0.5) { //1 star numOfFullStars = 1; } else { numOfFullStars = 0; } int i; for (i = 0; i < numOfFullStars; i++) { MaterialDesignThemes.Wpf.PackIcon star = new MaterialDesignThemes.Wpf.PackIcon(); star.Kind = MaterialDesignThemes.Wpf.PackIconKind.Star; star.Foreground = Brushes.Yellow; starIcons[i] = star; } for (int k = i; k < 5; k++) { MaterialDesignThemes.Wpf.PackIcon star = new MaterialDesignThemes.Wpf.PackIcon(); star.Kind = MaterialDesignThemes.Wpf.PackIconKind.StarBorder; star.Foreground = Brushes.Yellow; starIcons[k] = star; } }
private void ToggleIconStatus(MaterialDesignThemes.Wpf.PackIcon btn) { if (btn.Kind == MaterialDesignThemes.Wpf.PackIconKind.ArrowBottom) { btn.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowTop; btn.Foreground = Brushes.Green; } else { btn.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowBottom; btn.Foreground = Brushes.Red; } }
public Board(string name) { boardName = name; editIcon = new MaterialDesignThemes.Wpf.PackIcon(); editIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Pencil; deleteIcon = new MaterialDesignThemes.Wpf.PackIcon(); deleteIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Bin; editButton = new System.Windows.Controls.Button() { Width = 50, Height = 50, BorderBrush = Brushes.White, Background = Brushes.White, Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF3A6FBB")), HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Content = editIcon }; deleteButton = new System.Windows.Controls.Button() { Width = 50, Height = 50, BorderBrush = Brushes.White, Background = Brushes.White, Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFD13F3F")), HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = System.Windows.VerticalAlignment.Top, Content = deleteIcon }; titleLabel = new System.Windows.Controls.Label() { Content = boardName, FontSize = 50, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, VerticalAlignment = System.Windows.VerticalAlignment.Center, Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF464E64")), FontFamily = new FontFamily("Freestyle Script") }; contentGrid = new System.Windows.Controls.Grid(); contentGrid.Children.Add(titleLabel); contentGrid.Children.Add(editButton); contentGrid.Children.Add(deleteButton); backgroundCard = new MaterialDesignThemes.Wpf.Card(); backgroundCard.Background = Brushes.White; backgroundCard.Margin = new System.Windows.Thickness(20); backgroundCard.MinHeight = 150; backgroundCard.Content = contentGrid; backgroundCard.MouseDown += BoardClick; }
private void SwitchButton(TextBlock txt, MaterialDesignThemes.Wpf.PackIcon packIcon, Button btn) { if (txt.Text == "Join") { txt.Text = "Leave"; btn.Background = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#F78181")); packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Close; } else if (txt.Text == "Leave") { txt.Text = "Join"; btn.Background = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#01DFA5")); packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; } }
private MaterialDesignThemes.Wpf.PackIcon pckIcone(MaterialDesignThemes.Wpf.PackIcon pck, bool connection) { if (connection) { pck.Kind = MaterialDesignThemes.Wpf.PackIconKind.DatabaseCheck; pck.Foreground = new SolidColorBrush(Colors.Green); } else { pck.Kind = MaterialDesignThemes.Wpf.PackIconKind.DatabaseRemove; pck.Foreground = new SolidColorBrush(Colors.Red); } return(pck); }
public void listBuilder(unitDialogue pointa) { ListView temp = new ListView(); for (int i = 0; i < pointa.paths.Count; i++) { ListViewItem lmao = new ListViewItem(); StackPanel cols = new StackPanel(); cols.Orientation = Orientation.Horizontal; Label nums = new Label(); nums.Content = (i + 1).ToString() + ".)"; nums.Margin = new Thickness(10, 0, 100, 0); cols.Children.Add(nums); TextBox optname = new TextBox(); optname.Width = 200; optname.Text = pointa.paths[i].optname.ToString(); optname.Tag = pointa.paths[i]; optname.TextChanged += editOption; cols.Children.Add(optname); Label pointername = new Label(); pointername.Width = 200; pointername.Content = (pointa.paths[i].next != null ? ("Dialogue " + pointa.paths[i].next.no.ToString()) : "Null"); pointername.Margin = new Thickness(100, 0, 100, 0); cols.Children.Add(pointername); Button deleter = new Button(); MaterialDesignThemes.Wpf.PackIcon b = new MaterialDesignThemes.Wpf.PackIcon(); b.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; deleter.Content = b; deleter.Style = (Style)mw.FindResource("MaterialDesignIconForegroundButton"); deleter.Width = 26; deleter.Height = 26; deleter.Tag = pointa.paths[i]; deleter.Margin = new Thickness(100, 0, 0, 0); deleter.Click += deleteOption; cols.Children.Add(deleter); lmao.Content = cols; temp.Items.Add(lmao); } slave.Content = temp; hmm.Children.Add(slave); }
public void addPositions() { List <BE.Shop> shops = new List <BE.Shop>(bl.getShopsList()); for (int i = 0; i < shops.Count; i++) { Canvas canvas = new Canvas(); MapLayer mapla = new MapLayer(); MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon(); icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.MapMarker; icon.ToolTip = shops[i].id; // icon.Height = icon.Height + 2; // icon.Width = icon.Width + 2; icon.MouseDown += new MouseButtonEventHandler(open); mapla.AddChild(icon, new Location(shops[i].address.latitude, shops[i].address.longitude)); map1.Children.Add(mapla); } }
private void ProductPanel_MouseLeave(object sender, MouseEventArgs e) { BrushConverter bc = new BrushConverter(); Brush brush = (Brush)bc.ConvertFrom("#018cd1"); brush.Freeze(); StackPanel stap = sender as StackPanel; stap.Background = Brushes.White; WrapPanel wp = stap.FindName("WrapProduct") as WrapPanel; wp.Background = Brushes.Transparent; TextBlock tb = wp.FindName("xTextBlock") as TextBlock; tb.Foreground = brush; MaterialDesignThemes.Wpf.PackIcon icon = wp.FindName("xIcon") as MaterialDesignThemes.Wpf.PackIcon; icon.Foreground = brush; }
private void Row_DoubleClick(object sender, MouseButtonEventArgs e) { // Shop shop = bl.getShopByID(); map1.Center = new Location(((BE.Shop)datagridShops.CurrentItem).address.latitude, ((BE.Shop)datagridShops.CurrentItem).address.longitude); map1.Children.Clear(); Canvas canvas = new Canvas(); MapLayer mapla = new MapLayer(); MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon(); icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.MapMarker; icon.ToolTip = ((BE.Shop)datagridShops.CurrentItem).id; // icon.Height = icon.Height + 2; // icon.Width = icon.Width + 2; icon.MouseDown += new MouseButtonEventHandler(open); mapla.AddChild(icon, new Location(((BE.Shop)datagridShops.CurrentItem).address.latitude, ((BE.Shop)datagridShops.CurrentItem).address.longitude)); map1.Children.Add(mapla); }
private void PackIcon_PreviewMouseMove(object sender, MouseEventArgs e) { MaterialDesignThemes.Wpf.PackIcon pi = (MaterialDesignThemes.Wpf.PackIcon)sender; if (e.LeftButton == MouseButtonState.Pressed) { if (emplFilesListView.SelectedItem != null && emplFilesListView.SelectedItem is EmplFiles) { EmplFiles ef = (EmplFiles)emplFilesListView.SelectedItem; string file = moveFile(ef); string[] array = { file }; var data = new DataObject(DataFormats.FileDrop, array); DragDrop.DoDragDrop(pi, data, DragDropEffects.Move); e.Handled = true; } } }
//private void Item5CheckBox_Click(object sender, RoutedEventArgs e) //{ // MessageBox.Show(Item5CheckBox.Content.ToString()); // if(icon.Kind == MaterialDesignThemes.Wpf.PackIconKind.CheckDecagram) // icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CheckCircleOutline; // else // icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CheckDecagram; //} private void IconSwitch(object sender, RoutedEventArgs e) { MaterialDesignThemes.Wpf.PackIcon icon = null; Button btn = e.Source as Button; if (btn != null) { icon = btn.Content as MaterialDesignThemes.Wpf.PackIcon; if (icon.Kind == MaterialDesignThemes.Wpf.PackIconKind.CheckDecagram) { icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CheckCircleOutline; } else { icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CheckDecagram; } btn.Content = icon; } }
private Button initDeleteButton() { Button delButton = new Button(); delButton.VerticalAlignment = VerticalAlignment.Top; delButton.HorizontalAlignment = HorizontalAlignment.Right; delButton.Width = 20; delButton.Height = 20; MaterialDesignThemes.Wpf.PackIcon packIcon = new MaterialDesignThemes.Wpf.PackIcon(); packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Close; packIcon.Width = 18; packIcon.Height = 18; packIcon.VerticalAlignment = VerticalAlignment.Center; packIcon.HorizontalAlignment = HorizontalAlignment.Center; delButton.Content = packIcon; //delButton.Content = "X"; //delButton.SetValue(Button.FontWeightProperty, FontWeights.Bold); //delButton.Foreground = Brushes.Black; delButton.Background = Brushes.LightSlateGray; delButton.Click += Delete_Click; return(delButton); }
public void memberALL(string[] allin) { chatRoom.MemberBox.Children.Clear(); for (int i = 0; i < allin.Length; i++) { StackPanel sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; TextBlock tb_name = new TextBlock(); tb_name.Text = allin[i]; tb_name.VerticalAlignment = VerticalAlignment.Center; tb_name.HorizontalAlignment = HorizontalAlignment.Center; MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon() { Kind = MaterialDesignThemes.Wpf.PackIconKind.UserBadge }; icon.VerticalAlignment = VerticalAlignment.Center; icon.Height = 30; icon.Width = 30; sp.Children.Add(icon); Border border = new Border(); border.CornerRadius = new CornerRadius(10.0); border.Background = Brushes.Orange; border.Height = 38; border.Margin = new System.Windows.Thickness { Left = 5 }; //border.Width = tb.Width + 100; border.BorderBrush = Brushes.Orange; border.BorderThickness = new Thickness(10, 10, 10, 10); border.Child = tb_name; sp.Children.Add(border); sp.Margin = new Thickness { Top = 10 }; chatRoom.MemberBox.Children.Add(sp); } }
private Button initHelpButton() { Button helpButton = new Button(); helpButton.VerticalAlignment = VerticalAlignment.Top; helpButton.HorizontalAlignment = HorizontalAlignment.Right; helpButton.Width = 20; helpButton.Height = 20; MaterialDesignThemes.Wpf.PackIcon packIcon = new MaterialDesignThemes.Wpf.PackIcon(); packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Help; packIcon.Width = 18; packIcon.Height = 18; packIcon.VerticalAlignment = VerticalAlignment.Center; packIcon.HorizontalAlignment = HorizontalAlignment.Center; helpButton.Content = packIcon; Thickness margin = helpButton.Margin; margin.Right = 50; helpButton.Margin = margin; helpButton.Background = Brushes.LightSlateGray; helpButton.Click += HelpButton_Click; return(helpButton); }
protected void CreateModpackCard(string name, string description) { var card = new MaterialDesignThemes.Wpf.Card(); card.Name = "card" + name.Replace(" ", ""); try { modpacksContainer.RegisterName(card.Name, card); } catch (Exception e) { modpacksContainer.UnregisterName(card.Name); modpacksContainer.RegisterName(card.Name, card); } card.Height = 320; card.Width = 300; card.Margin = new Thickness(4); card.HorizontalAlignment = HorizontalAlignment.Left; var insiderStackPanel = new StackPanel(); card.Content = insiderStackPanel; //INSIDE STACKPANEL Style buttonstyle = Application.Current.FindResource("MaterialDesignFloatingActionMiniAccentButton") as Style; var fullscreenbutton = new Button(); fullscreenbutton.ToolTip = "Fullscreen"; var iconpackfullscreen = new MaterialDesignThemes.Wpf.PackIcon(); iconpackfullscreen.Kind = MaterialDesignThemes.Wpf.PackIconKind.Fullscreen; fullscreenbutton.Content = iconpackfullscreen; fullscreenbutton.Style = buttonstyle; fullscreenbutton.HorizontalAlignment = HorizontalAlignment.Right; fullscreenbutton.VerticalAlignment = VerticalAlignment.Bottom; fullscreenbutton.Margin = new Thickness(0, 0, 16, -130); Panel.SetZIndex(fullscreenbutton, 10); fullscreenbutton.Click += new RoutedEventHandler((sender, e) => fullscreen_click(this, e, card.Name, name)); var sharebutton = new Button(); sharebutton.ToolTip = "Share"; var iconpackshare = new MaterialDesignThemes.Wpf.PackIcon(); iconpackshare.Kind = MaterialDesignThemes.Wpf.PackIconKind.ShareVariant; sharebutton.Content = iconpackshare; sharebutton.Style = buttonstyle; sharebutton.HorizontalAlignment = HorizontalAlignment.Right; sharebutton.VerticalAlignment = VerticalAlignment.Bottom; sharebutton.Margin = new Thickness(0, 0, 66, -130); Panel.SetZIndex(sharebutton, 10); insiderStackPanel.Children.Add(fullscreenbutton); insiderStackPanel.Children.Add(sharebutton); var image = new Image(); image.Source = new BitmapImage(new Uri(@"/Images/modpacks.jpg", UriKind.Relative)); image.Stretch = Stretch.Fill; image.Width = 300; image.Height = 120; insiderStackPanel.Children.Add(image); var title = new Label(); title.FontWeight = FontWeights.ExtraBold; title.Content = name; title.Margin = new Thickness(0, 10, 0, 0); title.FontSize = 15; title.HorizontalAlignment = HorizontalAlignment.Center; insiderStackPanel.Children.Add(title); var scrollviewer = new ScrollViewer(); scrollviewer.Height = 70; var textblock = new TextBlock(); textblock.TextWrapping = TextWrapping.Wrap; textblock.Text = description; scrollviewer.Content = textblock; insiderStackPanel.Children.Add(scrollviewer); var ratingStackPanel = new StackPanel(); ratingStackPanel.Orientation = Orientation.Horizontal; ratingStackPanel.HorizontalAlignment = HorizontalAlignment.Center; var ratingtitle = new Label(); ratingtitle.VerticalAlignment = VerticalAlignment.Center; ratingtitle.Content = "Rate this modpack"; var ratingbar = new MaterialDesignThemes.Wpf.RatingBar(); ratingbar.Margin = new Thickness(10); ratingStackPanel.Children.Add(ratingtitle); ratingStackPanel.Children.Add(ratingbar); insiderStackPanel.Children.Add(ratingStackPanel); var buttonStackPanel = new StackPanel(); buttonStackPanel.Orientation = Orientation.Horizontal; var button1 = new Button(); var button2 = new Button(); var button3 = new Button(); button1.Foreground = new SolidColorBrush(Colors.White); button2.Foreground = new SolidColorBrush(Colors.White); button3.Foreground = new SolidColorBrush(Colors.White); button1.Margin = new Thickness(15, 0, 3, 0); button3.Margin = new Thickness(3, 0, 0, 0); button1.Content = "Install"; button2.Content = "View Mods"; button3.Content = "Website"; buttonStackPanel.Children.Add(button1); buttonStackPanel.Children.Add(button2); buttonStackPanel.Children.Add(button3); button1.Click += new RoutedEventHandler((sender, e) => installModpack_click(this, e, card.Name, name)); button2.Click += new RoutedEventHandler((sender, e) => mods_click(this, e, card.Name, name)); insiderStackPanel.Children.Add(buttonStackPanel); modpacksContainer.Children.Add(card); }
public void AtualizaButton(MaterialDesignThemes.Wpf.PackIcon packIcon) { if (packIcon.Name == pckManutencao.Name) { pckManutencao.Foreground = VariaveisGlobais.Verde; pckConfiguracoes.Foreground = VariaveisGlobais.Branco; pckHome.Foreground = VariaveisGlobais.Branco; pckProducao.Foreground = VariaveisGlobais.Branco; pckRelatorio.Foreground = VariaveisGlobais.Branco; pckUser.Foreground = VariaveisGlobais.Branco; } else if (packIcon.Name == pckConfiguracoes.Name) { pckManutencao.Foreground = VariaveisGlobais.Branco; pckConfiguracoes.Foreground = VariaveisGlobais.Verde; pckHome.Foreground = VariaveisGlobais.Branco; pckProducao.Foreground = VariaveisGlobais.Branco; pckRelatorio.Foreground = VariaveisGlobais.Branco; pckUser.Foreground = VariaveisGlobais.Branco; } else if (packIcon.Name == pckHome.Name) { pckManutencao.Foreground = VariaveisGlobais.Branco; pckConfiguracoes.Foreground = VariaveisGlobais.Branco; pckHome.Foreground = VariaveisGlobais.Verde; pckProducao.Foreground = VariaveisGlobais.Branco; pckRelatorio.Foreground = VariaveisGlobais.Branco; pckUser.Foreground = VariaveisGlobais.Branco; } else if (packIcon.Name == pckProducao.Name) { pckManutencao.Foreground = VariaveisGlobais.Branco; pckConfiguracoes.Foreground = VariaveisGlobais.Branco; pckHome.Foreground = VariaveisGlobais.Branco; pckProducao.Foreground = VariaveisGlobais.Verde; pckRelatorio.Foreground = VariaveisGlobais.Branco; pckUser.Foreground = VariaveisGlobais.Branco; } else if (packIcon.Name == pckRelatorio.Name) { pckManutencao.Foreground = VariaveisGlobais.Branco; pckConfiguracoes.Foreground = VariaveisGlobais.Branco; pckHome.Foreground = VariaveisGlobais.Branco; pckProducao.Foreground = VariaveisGlobais.Branco; pckRelatorio.Foreground = VariaveisGlobais.Verde; pckUser.Foreground = VariaveisGlobais.Branco; } else if (packIcon.Name == pckUser.Name) { pckManutencao.Foreground = VariaveisGlobais.Branco; pckConfiguracoes.Foreground = VariaveisGlobais.Branco; pckHome.Foreground = VariaveisGlobais.Branco; pckProducao.Foreground = VariaveisGlobais.Branco; pckRelatorio.Foreground = VariaveisGlobais.Branco; pckUser.Foreground = VariaveisGlobais.Verde; } }
private void AddToBasket(Book A) { Grid g = new Grid(); g.Height = 92; var bc = new BrushConverter(); g.Background = (Brush)bc.ConvertFrom("#FFF9F9F9"); g.Margin = new Thickness(5, 5, 5, 0); TextBlock tb1 = new TextBlock(); tb1.FontFamily = new FontFamily("Jura"); tb1.Text = A.Name; tb1.FontSize = 18; tb1.Height = 82; tb1.VerticalAlignment = VerticalAlignment.Top; tb1.TextWrapping = TextWrapping.Wrap; tb1.Margin = new Thickness(119, 6, 134, 0); g.Children.Add(tb1); TextBlock tb2 = new TextBlock(); tb2.FontFamily = new FontFamily("Jura"); tb2.Text = A.price * A.discount + "₴"; tb2.FontSize = 32; tb2.Height = 50; tb2.TextAlignment = TextAlignment.Center; tb2.Margin = new Thickness(345, 4, 4, 38); g.Children.Add(tb2); MaterialDesignThemes.Wpf.PackIcon i = new MaterialDesignThemes.Wpf.PackIcon(); i.Kind = MaterialDesignThemes.Wpf.PackIconKind.Information; i.Foreground = Brushes.White; Button b2 = new Button(); b2.Name = "inf" + basketBook.getCount(); var bc2 = new BrushConverter(); b2.Click += InfoAboutBook; b2.Background = (Brush)bc.ConvertFrom("#FFD19743"); b2.BorderBrush = (Brush)bc.ConvertFrom("#FFD19743"); b2.Margin = new Thickness(339, 57, 74, 5); b2.Height = Double.NaN; b2.Content = i; g.Children.Add(b2); MaterialDesignThemes.Wpf.PackIcon i2 = new MaterialDesignThemes.Wpf.PackIcon(); i2.Kind = MaterialDesignThemes.Wpf.PackIconKind.Trash; i2.Foreground = Brushes.White; Button b = new Button(); b.Click += DeleteFromBaslet; b.Name = "del" + basketBook.getCount(); b.Margin = new Thickness(408, 57, 5, 5); b.Height = Double.NaN; b.Content = i2; g.Children.Add(b); Image im = new Image(); im.HorizontalAlignment = HorizontalAlignment.Left; im.Height = 92; im.Margin = new Thickness(13, 0, 0, 0); im.VerticalAlignment = VerticalAlignment.Top; im.Width = 100; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); DirectoryInfo di = new DirectoryInfo(Directory.GetCurrentDirectory().ToString()); bitmap.UriSource = new Uri(di.Parent.Parent.FullName + @"\images\" + A.ImagePath); bitmap.EndInit(); im.Source = bitmap; g.Children.Add(im); list_b.Children.Add(g); }
private void addbooktobass(Book A) { Grid grid = new Grid(); var bc = new BrushConverter(); grid.Background = (Brush)bc.ConvertFrom("#4CFFB7B7"); grid.Margin = new Thickness(5, 5, 0, 10); grid.Height = 300; grid.Width = 320; TextBlock tb = new TextBlock(); tb.FontFamily = new FontFamily("Jura"); tb.Text = A.Name;//Назва книги tb.Foreground = Brushes.White; tb.FontSize = 18; tb.TextWrapping = TextWrapping.Wrap; tb.Margin = new Thickness(8, 177, 13, 38); grid.Children.Add(tb); TextBlock tb2 = new TextBlock(); tb2.FontFamily = new FontFamily("Jura"); tb2.Text = A.Author;//автор tb2.Foreground = Brushes.White; tb2.Margin = new Thickness(9, 249, 9, 6); grid.Children.Add(tb2); TextBlock tb3 = new TextBlock(); tb3.Text = (A.price * A.discount) + "₴"; tb3.FontFamily = new FontFamily("Jura"); tb3.Foreground = Brushes.White; tb3.Margin = new Thickness(166, 129, 1, 104); tb3.TextAlignment = TextAlignment.Center; tb3.FontSize = 36; grid.Children.Add(tb3); Image image = new Image(); image.HorizontalAlignment = HorizontalAlignment.Left; image.Height = 167; image.Margin = new Thickness(21, 0, 0, 0); image.VerticalAlignment = VerticalAlignment.Top; image.Width = 169; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); DirectoryInfo di = new DirectoryInfo(Directory.GetCurrentDirectory().ToString()); bitmap.UriSource = new Uri(di.Parent.Parent.FullName + @"\images\" + A.ImagePath); bitmap.EndInit(); image.Source = bitmap; grid.Children.Add(image); Button b = new Button(); b.Name = "i" + books.Children.Count; b.HorizontalAlignment = HorizontalAlignment.Left; b.VerticalAlignment = VerticalAlignment.Top; b.Background = null; b.BorderBrush = null; b.Click += addtoBasket; b.Height = 300; b.Width = 320; grid.Children.Add(b); MaterialDesignThemes.Wpf.PackIcon i = new MaterialDesignThemes.Wpf.PackIcon(); i.Kind = MaterialDesignThemes.Wpf.PackIconKind.About; i.Width = 20; i.Height = 20; i.HorizontalAlignment = HorizontalAlignment.Center; i.VerticalAlignment = VerticalAlignment.Center; i.Foreground = Brushes.White; Button b2 = new Button(); b2.Background = null; b2.Name = "j" + books.Children.Count; b2.Margin = new Thickness(241, 4, 5, 254); b2.BorderBrush = null; b2.Height = Double.NaN; b2.Click += bookinfo; b2.Content = i; grid.Children.Add(b2); books.Children.Add(grid); }
public void chatAdd(string name, string s) { StackPanel sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; if (name.Equals(this.user_name)) { //TextBlock tb_name = new TextBlock(); //tb_name.Text = name; TextBlock tb = new TextBlock(); tb.Background = Brushes.LightBlue; tb.Text = s; tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Center; //MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon() { Kind = MaterialDesignThemes.Wpf.PackIconKind.User }; //sp.Children.Add(icon); //sp.Children.Add(tb_name); //sp.Children.Add(tb); Border border = new Border(); border.CornerRadius = new CornerRadius(10.0); border.Background = Brushes.LightBlue; border.Height = 38; //border.Width = 100 + tb.Width + 100; border.BorderBrush = Brushes.LightBlue; border.BorderThickness = new Thickness(10, 10, 10, 10); border.Child = tb; sp.Children.Add(border); sp.Margin = new Thickness { Top = 10 }; sp.HorizontalAlignment = HorizontalAlignment.Right; } else { //border.BorderThickness = new Thickness(3, 3, 3, 3); TextBlock tb_name = new TextBlock(); tb_name.Text = name; tb_name.VerticalAlignment = VerticalAlignment.Center; TextBlock tb = new TextBlock(); //tb.Background = Brushes.LightBlue; tb.Text = s; tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Center; MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon() { Kind = MaterialDesignThemes.Wpf.PackIconKind.User }; icon.VerticalAlignment = VerticalAlignment.Center; icon.Height = 30; icon.Width = 30; sp.Children.Add(icon); sp.Children.Add(tb_name); Border border = new Border(); border.CornerRadius = new CornerRadius(10.0); border.Background = Brushes.LightBlue; border.Height = 38; border.Margin = new System.Windows.Thickness { Left = 10 }; //border.Width = tb.Width + 100; border.BorderBrush = Brushes.LightBlue; border.BorderThickness = new Thickness(10, 10, 10, 10); border.Child = tb; sp.Children.Add(border); sp.Margin = new Thickness { Top = 10 }; } chatRoom.ChatBox.Children.Add(sp); }
public Button CreateNewButton(Film film) { Button button = new Button(); button.Margin = new Thickness(5); button.Style = (Style)FindResource("myButtonStyle"); button.BorderBrush = null; button.Click += new RoutedEventHandler(YourButtonClick); ImageBrush imageBrush = new ImageBrush(); try { imageBrush.ImageSource = new BitmapImage(new Uri(film.Link)); } catch (Exception) { imageBrush.ImageSource = new BitmapImage(new Uri(@"pack://application:,,,/Resources/screen-0.jpg")); } imageBrush.Stretch = Stretch.UniformToFill; button.Background = imageBrush; //father StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; stackPanel.Background = Brushes.Black; stackPanel.Opacity = new Double(); stackPanel.Opacity = 0.8; stackPanel.Height = 30; //children 1 StackPanel filmNameStackPanel = new StackPanel(); filmNameStackPanel.Orientation = Orientation.Horizontal; filmNameStackPanel.Width = 180; TextBlock FilmTextBlock = new TextBlock(); FilmTextBlock.Text = film.Name; FilmTextBlock.Foreground = Brushes.White; FilmTextBlock.HorizontalAlignment = HorizontalAlignment.Stretch; FilmTextBlock.TextAlignment = TextAlignment.Center; FilmTextBlock.VerticalAlignment = VerticalAlignment.Center; FilmTextBlock.FontSize = 14; FilmTextBlock.FontWeight = FontWeights.Light; FilmTextBlock.FontFamily = new FontFamily("helvetica"); FilmTextBlock.Margin = new Thickness(3, 0, 3, 0); //children 1/ filmNameStackPanel.Children.Add(FilmTextBlock); //children 2 StackPanel markStackPanel = new StackPanel(); markStackPanel.Orientation = Orientation.Horizontal; markStackPanel.Margin = new Thickness(3, 0, 0, 0); markStackPanel.Width = 40; MaterialDesignThemes.Wpf.PackIcon packIcon = new MaterialDesignThemes.Wpf.PackIcon(); packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.StarCircleOutline; packIcon.VerticalAlignment = VerticalAlignment.Center; packIcon.HorizontalAlignment = HorizontalAlignment.Center; packIcon.Foreground = Brushes.Gold; packIcon.Width = 20; packIcon.Height = 20; TextBlock markTextBlock = new TextBlock(); markTextBlock.Text = film.Mark.ToString(); markTextBlock.Foreground = Brushes.White; markTextBlock.HorizontalAlignment = HorizontalAlignment.Right; markTextBlock.TextAlignment = TextAlignment.Center; markTextBlock.VerticalAlignment = VerticalAlignment.Center; markTextBlock.FontFamily = new FontFamily("helvetica"); markTextBlock.FontWeight = FontWeights.Light; markTextBlock.Margin = new Thickness(1, 0, 1, 0); markTextBlock.FontSize = 14; //children 2/ markStackPanel.Children.Add(packIcon); markStackPanel.Children.Add(markTextBlock); //children 3 StackPanel PopUpBoxStackPanel = new StackPanel(); PopUpBoxStackPanel.Orientation = Orientation.Horizontal; MaterialDesignThemes.Wpf.PopupBox popupBox = new MaterialDesignThemes.Wpf.PopupBox(); popupBox.PlacementMode = MaterialDesignThemes.Wpf.PopupBoxPlacementMode.BottomAndAlignRightEdges; popupBox.StaysOpen = true; popupBox.Foreground = Brushes.White; popupBox.HorizontalAlignment = HorizontalAlignment.Left; popupBox.VerticalAlignment = VerticalAlignment.Center; StackPanel stackPanel1 = new StackPanel(); stackPanel1.Width = 100; Button button1 = new Button(); StackPanel stackPanel2 = new StackPanel(); stackPanel2.Orientation = Orientation.Horizontal; TextBlock insideTextBlock = new TextBlock(); insideTextBlock.Text = "Change"; insideTextBlock.FontSize = 14; insideTextBlock.TextAlignment = TextAlignment.Center; insideTextBlock.VerticalAlignment = VerticalAlignment.Center; insideTextBlock.HorizontalAlignment = HorizontalAlignment.Center; insideTextBlock.FontFamily = new FontFamily("helvetica"); insideTextBlock.FontWeight = FontWeights.Light; MaterialDesignThemes.Wpf.PackIcon packIcon1 = new MaterialDesignThemes.Wpf.PackIcon(); packIcon1.Kind = MaterialDesignThemes.Wpf.PackIconKind.Cached; packIcon1.Margin = new Thickness(4); stackPanel2.Children.Add(insideTextBlock); stackPanel2.Children.Add(packIcon1); //3.1 button1.Content = stackPanel2; //3.2 Separator separator = new Separator(); //3.3 Button button2 = new Button(); //button2.Click += new RoutedEventHandler(YourButtonClick); StackPanel stackPanel3 = new StackPanel(); stackPanel3.Orientation = Orientation.Horizontal; TextBlock textBlock = new TextBlock(); textBlock.Text = "Delete"; textBlock.FontSize = 14; textBlock.TextAlignment = TextAlignment.Center; textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.HorizontalAlignment = HorizontalAlignment.Center; textBlock.FontFamily = new FontFamily("helvetica"); textBlock.FontWeight = FontWeights.Light; MaterialDesignThemes.Wpf.PackIcon packIcon2 = new MaterialDesignThemes.Wpf.PackIcon(); packIcon2.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; packIcon2.Margin = new Thickness(4); stackPanel3.Children.Add(textBlock); stackPanel3.Children.Add(packIcon2); button2.Content = stackPanel3; stackPanel1.Children.Add(button1); stackPanel1.Children.Add(separator); stackPanel1.Children.Add(button2); popupBox.PopupContent = stackPanel1; PopUpBoxStackPanel.Children.Add(popupBox); stackPanel.Children.Add(filmNameStackPanel); stackPanel.Children.Add(markStackPanel); stackPanel.Children.Add(PopUpBoxStackPanel); button.Content = stackPanel; return(button); }
public int LoadIrregularEnters() { //lastId = 0; //List.Children.Clear(); List.Children.Clear(); Data.GymContextDataContext db = new Data.GymContextDataContext(); //var twentyfour = DateTime.Now.AddHours(-24); var passages = (from enter in db.Passages where //enter.Time > twentyfour && enter.IsEntrance && !enter.Member.IsRegular && !enter.Member.IsStaff && !enter.Member.IsMentor && !db.Passages.Any(exit => exit.Time > enter.Time && exit.MemberId == enter.MemberId && exit.IsEntrance == false) select new { enter.MemberId, enter.IsEntrance, enter.Time, Member = enter.Member.Firstname + " " + enter.Member.Lastname, IsRegular = enter.Member.IsRegular }).ToList(); if (passages.Count == 0) { return(passages.Count); } var style = new Style(); var trigger = new Trigger { Property = IsMouseOverProperty, Value = true }; trigger.Setters.Add(new Setter { Property = OpacityProperty, Value = 1.0 }); var triggeroff = new Trigger { Property = IsMouseOverProperty, Value = false }; triggeroff.Setters.Add(new Setter { Property = OpacityProperty, Value = 0.5 }); style.Triggers.Add(trigger); style.Triggers.Add(triggeroff); passages.ToList().ForEach(pass => { StackPanel panel = new StackPanel { Orientation = Orientation.Horizontal, FlowDirection = FlowDirection.RightToLeft, Style = style, }; MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon { Kind = pass.IsEntrance ? MaterialDesignThemes.Wpf.PackIconKind.TrendingUp : MaterialDesignThemes.Wpf.PackIconKind.TrendingDown, Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.Maroon), Margin = new Thickness(0, 6, 0, 0) }; Label time = new Label { Foreground = new SolidColorBrush(Colors.White), Content = $"{pass.Time.ToString("HH:mm")} {pass.Member}", Margin = new Thickness(2, 1, 2, 1), Tag = pass.MemberId, Cursor = Cursors.Hand, //FontWeight = pass.IsRegular ? FontWeights.Bold : FontWeights.Normal }; time.MouseDoubleClick += Time_MouseDoubleClick; panel.Children.Add(icon); panel.Children.Add(time); List.Children.Add(panel); if (List.Children.Count > 100) { List.Children.RemoveRange(0, List.Children.Count - 100); } }); return(passages.Count); }
private void SaveNoteButton_Click(object sender, RoutedEventArgs e) { try { switch (NameGridChangeOrAddNotes.Text) { case "Добавление заметки": try { string[] parseDate = DateNoteTextBlock.Text.Split(' '); if (new ReferenseDALClass().SetConnectionDBNoteAdd(_userInfo.ID, NewNoteTextBox.Text, Convert.ToDateTime(parseDate[1]), ParaNoteTextBlock.Text, paraNumber)) { Storyboard sb = FindResource("CloseModalWindowAddNewNote") as Storyboard; sb.Begin(); MaterialDesignThemes.Wpf.PackIcon kindNoteSave = new MaterialDesignThemes.Wpf.PackIcon { Kind = MaterialDesignThemes.Wpf.PackIconKind.NoteMultipleOutline, Width = 20, Height = 20 }; _buttonRefAddNote.Content = kindNoteSave; _buttonRefAddNote.ToolTip = "Изменить заметку"; KindThrowMessage.Foreground = FindResource("ForegroundColorUIElements") as SolidColorBrush; KindThrowMessage.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; TextBlockMessageThrow.Text = "Заметка сохранена!"; Storyboard sbShowNodalWindow = this.FindResource("ShowMessageThrowGrid") as Storyboard; sbShowNodalWindow.Begin(); _homePage.notes.NoteText = NewNoteTextBox.Text; } else { KindThrowMessage.Foreground = FindResource("ErrorForegroundColorUIElements") as SolidColorBrush; KindThrowMessage.Kind = MaterialDesignThemes.Wpf.PackIconKind.Close; TextBlockMessageThrow.Text = "Заметка не добавлена!"; Storyboard sb = this.FindResource("ShowMessageThrowGrid") as Storyboard; sb.Begin(); } DosentOpacityGrid.IsEnabled = true; } catch { Storyboard sb = FindResource("CloseModalWindowAddNewNote") as Storyboard; sb.Begin(); KindThrowMessage.Foreground = FindResource("ErrorForegroundColorUIElements") as SolidColorBrush; KindThrowMessage.Kind = MaterialDesignThemes.Wpf.PackIconKind.Close; TextBlockMessageThrow.Text = "Заметка не добавлена!"; Storyboard sbThrowMessge = FindResource("ShowMessageThrowGrid") as Storyboard; sb.Begin(); DosentOpacityGrid.IsEnabled = true; } break; case "Изменение заметки": try { if (!String.IsNullOrWhiteSpace(NewNoteTextBox.Text)) { if (new ReferenseDALClass().SetConnectionDBNoteClass(tmpNoteUserId, NewNoteTextBox.Text)) { KindThrowMessage.Foreground = FindResource("ForegroundColorUIElements") as SolidColorBrush; KindThrowMessage.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; TextBlockMessageThrow.Text = "Заметка изменена!"; Storyboard sb = FindResource("CloseModalWindowAddNewNote") as Storyboard; sb.Begin(); Storyboard sbShowNodalWindow = this.FindResource("ShowMessageThrowGrid") as Storyboard; sbShowNodalWindow.Begin(); _homePage.notes.NoteText = NewNoteTextBox.Text; _homePage.ListViewSheldueDay.ItemsSource = _homePage.allSheldueList; } else { KindThrowMessage.Foreground = FindResource("ErrorForegroundColorUIElements") as SolidColorBrush; KindThrowMessage.Kind = MaterialDesignThemes.Wpf.PackIconKind.Close; TextBlockMessageThrow.Text = "Заметка не изменена!"; Storyboard sb = FindResource("CloseModalWindowAddNewNote") as Storyboard; sb.Begin(); Storyboard sbThrowMessge = this.FindResource("ShowMessageThrowGrid") as Storyboard; sbThrowMessge.Begin(); } DosentOpacityGrid.IsEnabled = true; } } catch { KindThrowMessage.Foreground = FindResource("ErrorForegroundColorUIElements") as SolidColorBrush; KindThrowMessage.Kind = MaterialDesignThemes.Wpf.PackIconKind.Close; TextBlockMessageThrow.Text = "Заметка не изменена!"; Storyboard sb = FindResource("CloseModalWindowAddNewNote") as Storyboard; sb.Begin(); Storyboard sbThrowMessge = this.FindResource("ShowMessageThrowGrid") as Storyboard; sbThrowMessge.Begin(); DosentOpacityGrid.IsEnabled = true; } break; } } catch { } GridModalWindows.Visibility = System.Windows.Visibility.Hidden; ModalWindowAddNotes.Visibility = System.Windows.Visibility.Hidden; }
public void UpdatePassages() { //lastId = 0; //List.Children.Clear(); Data.GymContextDataContext db = new Data.GymContextDataContext(); var h = Domain.Dynamics.TransitFarthestHour; //var today = DateTime.Today; var passages = (from p in db.Passages where !p.Member.IsStaff && !p.Member.IsMentor && p.Id > lastId && p.Time >= DateTime.Now.AddHours(-1 * h) select new { p.Id, p.IsEntrance, p.Time, Member = p.Member.Firstname + " " + p.Member.Lastname, MemberId = p.MemberId, IsRegular = p.Member.IsRegular, Closet = db.ClosetUsages.Where(u => u.MemberId == p.MemberId && u.FromTime >= p.Time && u.FromTime <= p.Time.AddSeconds(30)).Select(c => c).FirstOrDefault() }).ToList(); lastId = passages.Any() ? passages.Select(p => p.Id).Max() : lastId; if (passages.Count == 0) { return; } var style = new Style(); var trigger = new Trigger { Property = IsMouseOverProperty, Value = true }; trigger.Setters.Add(new Setter { Property = OpacityProperty, Value = 1.0 }); var triggeroff = new Trigger { Property = IsMouseOverProperty, Value = false }; triggeroff.Setters.Add(new Setter { Property = OpacityProperty, Value = 0.5 }); style.Triggers.Add(trigger); style.Triggers.Add(triggeroff); passages.ToList().ForEach(pass => { StackPanel panel = new StackPanel { Orientation = Orientation.Horizontal, FlowDirection = FlowDirection.RightToLeft, Style = style, }; panel.ContextMenu = new ContextMenu(); var enrollitem = new MenuItem { Header = "فرم ثبت نام" }; enrollitem.Click += (s, ce) => { Enroll member = new Enroll(); member.Owner = Main.Home; member.Show(); member.LoadMember(pass.MemberId); }; enrollitem.IsEnabled = pass.IsRegular; panel.ContextMenu.Items.Add(enrollitem); string tip = ""; if (pass.IsEntrance) { var firstUsageAfter = db.ClosetUsages.Where(u => u.MemberId == pass.MemberId && u.FromTime >= pass.Time).OrderBy(u => u.FromTime).FirstOrDefault(); if (firstUsageAfter != null) { tip += "کمد: " + firstUsageAfter.ClosetId.ToString(); } } else { var closetAtTheTime = db.ClosetUsages.Where(u => u.MemberId == pass.MemberId && u.FromTime <= pass.Time).OrderByDescending(u => u.FromTime).FirstOrDefault(); if (closetAtTheTime != null) { tip += "کمد: " + closetAtTheTime.ClosetId.ToString(); } } tip += Environment.NewLine + "تاریخ: " + pass.Time.Date.ToFa() + Environment.NewLine + "زمان: " + pass.Time.ToLongTimeString() + Environment.NewLine + "عضو: " + pass.Member + Environment.NewLine + "وضعیت تردد : " + (pass.IsEntrance ? "ورود" : "خروج"); panel.ToolTip = tip; var infoitem = new MenuItem { Header = "مشاهده اطلاعات عضو" }; List <string> facilities = new List <string>(); infoitem.Click += (s, ce) => { bool facilitiesCached = false; if (!facilitiesCached) { var mmbr = db.Members.Where(m => m.Id == pass.MemberId).FirstOrDefault(); var nrols = mmbr.Enrolls.Where(e => e.StartDate <= DateTime.Today && (e.ExpireDate == null || e.ExpireDate >= DateTime.Today)).ToList(); var nf = nrols.SelectMany(n => n.EnrollFacilities).ToList(); facilities = nf.Select(f => f.Facility.Name).ToList(); } MemberInformation member = new MemberInformation(); member.Owner = Main.Home; member.SetMember(pass.MemberId, pass.IsEntrance ? "ورود" : "خروج", facilities); member.Show(); }; infoitem.IsEnabled = pass.IsRegular; panel.ContextMenu.Items.Add(infoitem); var financial = new MenuItem { Header = "لیست تراکنش های عضو" }; financial.Click += (s, ce) => { Enroll member = new Enroll(); member.Owner = Main.Home; member.Show(); member.LoadMember(pass.MemberId); member.Section = 3; }; panel.ContextMenu.Items.Add(financial); MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon { Kind = pass.IsEntrance ? MaterialDesignThemes.Wpf.PackIconKind.TrendingUp : MaterialDesignThemes.Wpf.PackIconKind.TrendingDown, Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed), Margin = new Thickness(0, 6, 0, 0) }; Label time = new Label { Foreground = new SolidColorBrush(pass.IsRegular ? Colors.DodgerBlue : Colors.Gray), Content = $"{pass.Time.ToString("HH:mm")} {pass.Member}", Margin = new Thickness(2, 1, 2, 1), //FontWeight = pass.IsRegular ? FontWeights.Bold : FontWeights.Normal }; var mem = db.Members.First(m => m.Id == pass.MemberId); var validUntill = DateTime.Now.AddDays(4); var needsExtension = db.Enrolls.Where(n => n.MemberId == mem.Id && (n.ExpireDate <= validUntill && n.ExpireDate >= DateTime.Now)).Any(); panel.Children.Add(icon); panel.Children.Add(time); if (needsExtension) { MaterialDesignThemes.Wpf.PackIcon ext = new MaterialDesignThemes.Wpf.PackIcon { Kind = MaterialDesignThemes.Wpf.PackIconKind.ClockEnd, Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed), Margin = new Thickness(0, 6, 0, 0), ToolTip = "نیازمند تمدید" }; panel.Children.Add(ext); } if (mem.Debtor > 0) { panel.Children.Add(new MaterialDesignThemes.Wpf.PackIcon { Kind = MaterialDesignThemes.Wpf.PackIconKind.CurrencyUsd, Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed), Margin = new Thickness(0, 6, 0, 0), ToolTip = "بدهکار شهریه" }); } if (mem.Debtor > 0) { panel.Children.Add(new MaterialDesignThemes.Wpf.PackIcon { Kind = MaterialDesignThemes.Wpf.PackIconKind.Carrot, Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed), Margin = new Thickness(0, 6, 0, 0), ToolTip = "بدهکار بوفه" }); } List.Children.Add(panel); if (List.Children.Count > 100) { List.Children.RemoveRange(0, List.Children.Count - 100); } }); //while (true) //{ // //return; // if (DateTime.Now.Subtract(lastcheck).TotalMilliseconds < 1000) // continue; // lastcheck = DateTime.Now; // List.Children.Add(new Label // { // Foreground = new SolidColorBrush(Colors.Gray), // Content = DateTime.Now.ToString("HH:mm:ss") // }); // if (List.Children.Count > 100) // List.Children.RemoveAt(0); //} }
private void open(object sender, RoutedEventArgs e) { MaterialDesignThemes.Wpf.PackIcon icon = (MaterialDesignThemes.Wpf.PackIcon)sender; BE.Shop temp = bl.getShopByID(int.Parse(icon.ToolTip.ToString())); MessageBox.Show("name:" + temp.name + "\n\n" + "Address: " + temp.address.street + " " + temp.address.num + ", " + temp.address.city); }
/// <summary> /// Card create method, XAML /// </summary> public void cardAdapter() { foreach (RecipeModel model in rootModel.results) { // Create Card MaterialDesignThemes.Wpf.Card card = new MaterialDesignThemes.Wpf.Card { Width = 200, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(10), }; wrap.Children.Add(card); // Create Grid Grid grid = new Grid(); grid.Height = 288; RowDefinition row1 = new RowDefinition(); RowDefinition row2 = new RowDefinition(); RowDefinition row3 = new RowDefinition(); row1.Height = new GridLength(140); row2.Height = new GridLength(1, GridUnitType.Star); row3.Height = new GridLength(1, GridUnitType.Auto); grid.RowDefinitions.Add(row1); grid.RowDefinitions.Add(row2); grid.RowDefinitions.Add(row3); card.Content = grid; //Create image Image image = new Image(); BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); if (string.IsNullOrWhiteSpace(model.thumbnail)) { bitmap.UriSource = new Uri("background.jpg", UriKind.Relative); } else { bitmap.UriSource = new Uri(model.thumbnail, UriKind.Absolute); } bitmap.EndInit(); image.Stretch = Stretch.UniformToFill; image.Source = bitmap; image.Height = 140; grid.Children.Add(image); // Create Button Button button = new Button { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(0, 0, 16, -20) }; Style style = this.FindResource("MaterialDesignFloatingActionMiniAccentButton") as Style; button.Style = style; button.Foreground = new SolidColorBrush(Color.FromRgb(225, 225, 225)); button.Background = new SolidColorBrush(Color.FromRgb(77, 41, 145)); button.BorderBrush = new SolidColorBrush(Color.FromRgb(225, 225, 225)); MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon(); icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Food; button.Content = icon; Grid.SetRow(button, 0); grid.Children.Add(button); StackPanel stackPanel = new StackPanel(); stackPanel.Margin = new Thickness(8, 24, 8, 0); Grid.SetRow(stackPanel, 1); grid.Children.Add(stackPanel); TextBlock textBlock1 = new TextBlock { FontWeight = FontWeights.Bold, Text = model.title, }; stackPanel.Children.Add(textBlock1); TextBlock textBlock2 = new TextBlock { Text = model.ingredients, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap }; stackPanel.Children.Add(textBlock2); StackPanel stackPanel2 = new StackPanel { HorizontalAlignment = HorizontalAlignment.Right, Orientation = Orientation.Horizontal, Margin = new Thickness(8), }; Grid.SetRow(stackPanel2, 2); grid.Children.Add(stackPanel2); Button buttonMore = new Button(); Style style2 = this.FindResource("MaterialDesignRaisedButton") as Style; buttonMore.Style = style2; buttonMore.Height = 35; buttonMore.FontSize = 11; buttonMore.Content = "See more"; buttonMore.Click += new RoutedEventHandler(btn_Click); buttonMore.Tag = model.href; stackPanel2.Children.Add(buttonMore); } }
private void WordView_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { string inValue = (e.EditingElement as TextBox).Text; string wordValue = ds.Tables[0].Rows[int.Parse((WordView.Columns[0].GetCellContent(WordView.SelectedItem) as TextBlock).Text) - 1][1].ToString(); int Crr = int.Parse(txtCrrBlk.Text); int Err = int.Parse(txtErrBlk.Text); DataRowView drv = WordView.SelectedItem as DataRowView; DataGridRow row = (DataGridRow)this.WordView.ItemContainerGenerator.ContainerFromIndex(WordView.SelectedIndex); DataGridCellsPresenter presenter = GetVisualChild <DataGridCellsPresenter>(row); DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(4); DataGridTemplateColumn tempColum = this.WordView.Columns[1] as DataGridTemplateColumn; FrameworkElement element = this.WordView.Columns[1].GetCellContent(this.WordView.SelectedItem); if (inValue.ToUpper() == wordValue.ToUpper()) { if ((Crr + Err) > WordView.SelectedIndex) { Crr++; Err--; } else { Crr++; } cell.Foreground = new SolidColorBrush(Colors.Black); if (element != null) { TextBlock txtBlock = tempColum.CellTemplate.FindName("txtBlk", element) as TextBlock; MaterialDesignThemes.Wpf.PackIcon pIcon = tempColum.CellTemplate.FindName("PICON", element) as MaterialDesignThemes.Wpf.PackIcon; pIcon.Foreground = new SolidColorBrush(Colors.Gray); } } else { if ((Crr + Err) > WordView.SelectedIndex) { Crr--; Err++; } else { Err++; } cell.Foreground = new SolidColorBrush(Colors.Red); if (element != null) { TextBlock txtBlock = tempColum.CellTemplate.FindName("txtBlk", element) as TextBlock; MaterialDesignThemes.Wpf.PackIcon pIcon = tempColum.CellTemplate.FindName("PICON", element) as MaterialDesignThemes.Wpf.PackIcon; pIcon.Foreground = new SolidColorBrush(Colors.Red); txtBlock.Text = (int.Parse(txtBlock.Text) + 1).ToString(); } } //for(int i=0;i<=WordView.Items.Count-1;i++) //{ // if(i==WordView.SelectedIndex) // { // inValue = (e.EditingElement as TextBox).Text; // } // else // { // inValue = ds.Tables[0].Rows[i][5].ToString(); // (WordView.Columns[3].GetCellContent(WordView.Items[i]) as TextBlock).Text; // } // wordValue = ds.Tables[0].Rows[i][1].ToString(); // if (inValue != "") // { // if (inValue == wordValue) // { // Crr += 1; // } // else // { // Err += 1; // } // } //} txtCrrBlk.Text = Crr.ToString(); txtErrBlk.Text = Err.ToString(); }
public int LoadTransits() { List.Children.Clear(); bool IsStaff = Type == MemberSelectionCategory.PersonnelTransit; bool IsMentor = Type == MemberSelectionCategory.PersonnelTransit; var h = Domain.Dynamics.TransitFarthestHour; Data.GymContextDataContext db = new Data.GymContextDataContext(); var passages = (from enter in db.Passages where (enter.Member.IsStaff == IsStaff || enter.Member.IsMentor == IsMentor) && enter.Member.IsRegular == (Type != MemberSelectionCategory.IrregularTransit) && enter.Time >= DateTime.Now.AddHours(-1 * h) select new { enter.MemberId, enter.IsEntrance, enter.Time, Member = enter.Member.Firstname + " " + enter.Member.Lastname, IsRegular = enter.Member.IsRegular }).ToList(); if (passages.Count == 0) { return(passages.Count); } var style = new Style(); var trigger = new Trigger { Property = IsMouseOverProperty, Value = true }; trigger.Setters.Add(new Setter { Property = OpacityProperty, Value = 1.0 }); var triggeroff = new Trigger { Property = IsMouseOverProperty, Value = false }; triggeroff.Setters.Add(new Setter { Property = OpacityProperty, Value = 0.5 }); style.Triggers.Add(trigger); style.Triggers.Add(triggeroff); passages.ToList().ForEach(pass => { StackPanel panel = new StackPanel { Orientation = Orientation.Horizontal, FlowDirection = FlowDirection.RightToLeft, Style = style, }; MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon { Kind = pass.IsEntrance ? MaterialDesignThemes.Wpf.PackIconKind.TrendingUp : MaterialDesignThemes.Wpf.PackIconKind.TrendingDown, Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.Maroon), Margin = new Thickness(0, 6, 0, 0) }; Label time = new Label { Foreground = new SolidColorBrush(Colors.White), Content = $"{pass.Time.ToString("HH:mm")} {pass.Member}", Margin = new Thickness(2, 1, 2, 1), Tag = pass.MemberId, Cursor = Cursors.Hand, //FontWeight = pass.IsRegular ? FontWeights.Bold : FontWeights.Normal }; panel.Children.Add(icon); panel.Children.Add(time); List.Children.Add(panel); if (List.Children.Count > 100) { List.Children.RemoveRange(0, List.Children.Count - 100); } }); return(passages.Count); }