private void DrawOccupantList(PagingControl pagination)
        {
            int count = 0;
            
            WrapPanel wrap_Occupants = (WrapPanel)LogicalTreeHelper.FindLogicalNode(WindowController.Get<MainWindow>(), "wrap_Occupants");

            wrap_Occupants.Children.Clear();
            wrap_Occupants.Height = 0;

            foreach (Person occupant in pagination.GetData<Person>())
            {
                GroupBox panel = new GroupBox();
                panel.Width = wrap_Occupants.Width - 0;
                panel.Header = occupant.Name;
                wrap_Occupants.Children.Add(panel);

                Grid grid = new Grid();
                panel.Content = grid;

                StackPanel stack_Parent = new StackPanel();
                stack_Parent.Orientation = Orientation.Horizontal;
                grid.Children.Add(stack_Parent);

                Image pb = new Image();
                pb.Width = panel.Width * .25;
                pb.Height = 50;
                pb.Stretch = System.Windows.Media.Stretch.Uniform;
                pb.Source = new BitmapImage(new Uri(occupant.HeadImage));
                pb.Margin = new Thickness(10, 20, 0, 0);
                pb.VerticalAlignment = VerticalAlignment.Top;
                pb.HorizontalAlignment = HorizontalAlignment.Left;

                pb.MouseLeftButtonDown += (sender2, e2) =>
                {
                    if (e2.ClickCount == 2)
                    {
                        Game.Instance.WindowController.Add<PersonInformationWindow>(occupant).Show();
                        WindowController.Get<PersonInformationWindow>(occupant).UpdateWindow();
                    }
                };

                stack_Parent.Children.Add(pb);



                StackPanel stack_Info = new StackPanel();
                stack_Parent.Children.Add(stack_Info);

                Label lbl_Sex = new Label();
                lbl_Sex.Content = "Apparent sex: " + (occupant.Physique.Sex == Sexes.Futanari ? Sexes.Female.ToString() : occupant.Physique.Sex.ToString());
                stack_Info.Children.Add(lbl_Sex);

                Label lbl_Age = new Label();
                lbl_Age.Content = "Apparent age: " + occupant.GetApparentAge().CaptializeWords();
                stack_Info.Children.Add(lbl_Age);




                ContextMenu menu = new ContextMenu();

                MenuItem actions = new MenuItem();
                actions.Header = "Actions";

                menu.Items.Add(actions);
                menu.Opened += (sender2, e2) =>
                {
                    foreach (GameAction action in GameAction.GetAll("Person").Where(e => e.CanBeDoneByPlayer))
                    {
                        MenuItem displayAction = action.GetMenuItemForPerson(new ActionEventArgs(Game.Instance.Player, occupant, null));

                        if (displayAction != null)
                        {
                            actions.Items.Add(displayAction);
                        }
                    }
                };

                pb.ContextMenu = menu;

                ToolTip tooltip = new ToolTip();
                tooltip.Content = occupant.FirstName + " " + occupant.LastName;
                pb.ToolTip = tooltip;

                count++;

                wrap_Occupants.Height += panel.Height;
            }
        }
Beispiel #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.GameWindow = ((HLife.MainWindow)(target));
     
     #line 9 "..\..\..\..\GUI\Windows\MainWindow.xaml"
     this.GameWindow.Unloaded += new System.Windows.RoutedEventHandler(this.GameWindow_Unloaded);
     
     #line default
     #line hidden
     
     #line 9 "..\..\..\..\GUI\Windows\MainWindow.xaml"
     this.GameWindow.PreviewKeyUp += new System.Windows.Input.KeyEventHandler(this.GameWindow_PreviewKeyUp);
     
     #line default
     #line hidden
     return;
     case 2:
     this.grid_Main = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.tabs_Location = ((System.Windows.Controls.TabControl)(target));
     return;
     case 4:
     this.tab_Info = ((System.Windows.Controls.TabItem)(target));
     return;
     case 5:
     this.tab_Occupants = ((System.Windows.Controls.TabItem)(target));
     return;
     case 6:
     this.grid_Occupants = ((System.Windows.Controls.Grid)(target));
     return;
     case 7:
     this.Pagination = ((HLife.GUI.Controls.PagingControl)(target));
     return;
     case 8:
     this.wrap_Occupants = ((System.Windows.Controls.WrapPanel)(target));
     return;
     case 9:
     this.tab_Inventory = ((System.Windows.Controls.TabItem)(target));
     return;
     case 10:
     this.grid_Inventory = ((System.Windows.Controls.Grid)(target));
     return;
     case 11:
     this.wrap_Inventory = ((System.Windows.Controls.WrapPanel)(target));
     return;
     case 12:
     this.menu_Toolbar = ((System.Windows.Controls.Menu)(target));
     return;
     case 13:
     this.menuItem_File = ((System.Windows.Controls.MenuItem)(target));
     return;
     case 14:
     this.menuItem_Edit = ((System.Windows.Controls.MenuItem)(target));
     return;
     case 15:
     this.lbl_Date = ((System.Windows.Controls.Label)(target));
     return;
     case 16:
     this.grid_View = ((System.Windows.Controls.Grid)(target));
     return;
     case 17:
     this.img_LocationBackground = ((System.Windows.Controls.Image)(target));
     
     #line 39 "..\..\..\..\GUI\Windows\MainWindow.xaml"
     this.img_LocationBackground.Unloaded += new System.Windows.RoutedEventHandler(this.img_LocationBackground_Unloaded);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }