示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            WPFdataGrid.DataGridControl dataGrid = elementHost1.Child as WPFdataGrid.DataGridControl;
            Control.DataGrid            grid     = dataGrid.grid;

            var detailGrids = FindVisualChildren <Control.DataGrid>(grid);

            grid.IsReadOnly                   = true;
            grid.MouseRightButtonUp          += new MouseButtonEventHandler(dataGrid_MouseRightClick);
            grid.CellEditEnding              += new EventHandler <Control.DataGridCellEditEndingEventArgs>(dataGrid_CellValueChanged);
            grid.RowDetailsVisibilityChanged += new EventHandler <Control.DataGridRowDetailsEventArgs>(dataGrid_RowDetailsVisibilityChanged);

            foreach (var detailGrid in detailGrids)
            {
                detailGrid.IsReadOnly      = true;
                detailGrid.CellEditEnding += new EventHandler <Control.DataGridCellEditEndingEventArgs>(detailGrid_CellValueChanged);
            }

            Pokemon = new Pokemon();
            Pokemon.PokemonBaseStats.Load();
            Pokemon.PokemonBaseStats.Local.ToBindingList();

            using (Pokemon db = new Pokemon())
            {
                var monster = (from p in db.PokemonBaseStats
                               select p).ToList();

                foreach (var p in monster)
                {
                    observable.Add(p);
                }

                grid.Items.Clear();
                grid.ItemsSource = observable;
            }

            foreach (var value in search.Values)
            {
                toolStripComboBox1.Items.Add(value);
            }

            fileNameToolStripMenuItem.Text        = $"{Path.GetFileName(Pokemon.GetFile())}";
            fileNameToolStripMenuItem.ToolTipText = "Click to Open File";
            fileToolStripMenuItem.ToolTipText     = "Refresh, Edit Database";
            fileNameToolStripMenuItem.Alignment   = ToolStripItemAlignment.Right;
            menuStrip1.ShowItemToolTips           = true;
            fileNameToolStripMenuItem.Visible     = true;
        }
示例#2
0
 private void fileNameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     System.Diagnostics.Process.Start(Path.GetFullPath($"{Pokemon.GetFile()}"));
 }