Beispiel #1
0
        public TradeWindow(TradeViewModel viewModel, IContextFactory contextFactory, TradesRepository tradesRepo)
        {
            _contextFactory = contextFactory;
            _tradesRepo     = tradesRepo;
            ViewModel       = viewModel;
            InitializeComponent();

            DataContext = ViewModel;

            InitializeFontSizes();

            FontFamilyComboBox.ItemsSource = Fonts.SystemFontFamilies;
            FontSizeComboBox.ItemsSource   = FontSizes;

            //load the notes
            LoadNotes();
        }
Beispiel #2
0
        public TradeWindow(Trade trade, IDBContext context, IDataSourcer dataSourcer)
        {
            Trade    = trade;
            _context = context;

            InitializeComponent();

            ViewModel   = new TradeViewModel(trade, dataSourcer, context);
            DataContext = ViewModel;

            InitializeFontSizes();

            FontFamilyComboBox.ItemsSource = Fonts.SystemFontFamilies;
            FontSizeComboBox.ItemsSource   = FontSizes;

            //load the notes
            LoadNotes();
        }
Beispiel #3
0
        public TradeWindow(Trade trade, IDBContext context, IDataSourcer dataSourcer)
        {
            Trade = trade;
            _context = context;

            InitializeComponent();

            ViewModel = new TradeViewModel(trade, dataSourcer, context);
            DataContext = ViewModel;

            InitializeFontSizes();

            FontFamilyComboBox.ItemsSource = Fonts.SystemFontFamilies;
            FontSizeComboBox.ItemsSource = FontSizes;

            //load the notes
            LoadNotes();
        }
Beispiel #4
0
        private void TradesGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //the stuff here is to make sure the click is in a row and not elsewher on the grid
            if (e.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }
            var result = VisualTreeHelper.HitTest(TradesGrid, e.GetPosition(TradesGrid));
            var cell   = Utils.FindVisualParent <DataGridCell>(result.VisualHit);

            if (cell == null)
            {
                return;
            }

            if (TradesGrid.SelectedItems == null || TradesGrid.SelectedItems.Count != 1)
            {
                return;
            }
            var tradeVm     = new TradeViewModel((Trade)TradesGrid.SelectedItem, ContextFactory, DataSourcer, Settings);
            var tradeWindow = new TradeWindow(tradeVm, ContextFactory, ViewModel.TradesPageViewModel.TradesRepository);

            tradeWindow.ShowDialog();
        }