private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DependencyObject dep = (DependencyObject)e.OriginalSource;

            // iteratively traverse the visual tree
            while ((dep != null) && !(dep is DataGridRow))
            {
                dep = VisualTreeHelper.GetParent(dep);
            }

            if (dep == null)
            {
                return;
            }

            if (dep is DataGridRow)
            {
                DataGridRow row    = dep as DataGridRow;
                string      viewID = "id_name_realtoreditmode_" + (row.Item as RealtorViewModel).ID.ToString();

                if (!Api.ActivateTab(viewID))
                {
                    // create new Tab by this RealtorViewModel
                    MyCompanyCommands.ShowRealtorViewCommand.Execute(row.Item);
                }
            }
        }
Ejemplo n.º 2
0
        public void ShowSimpleGridView(object o)
        {
            Api.ActivateTab("id_name_database_dictionary");

            string tablename = o as string;

            SimpleGridView _simpleGridView = new SimpleGridView(tablename);

            _simpleGridView.Name = "id_name_database_dictionary";

            Api.AddTabItem(_simpleGridView);
        }
        private void ShowRealtorView(object param)
        {
            if (param == null)
            {
                if (Api.ActivateTab("id_name_realtoreditmode_0"))
                {
                    return;
                }
                else
                {
                    RealtorView _newRealtorView = new RealtorView();

                    _newRealtorView.Name    = "id_name_realtoreditmode_0";
                    _newRealtorView.ToolTip = "Добавление риэлтора";

                    _newRealtorView.DataContext = new RealtorViewModel(param as int?);

                    Api.AddTabItem(_newRealtorView);
                    return;
                }
            }

            // else if param is RealtorViewModel

            RealtorViewModel viewModel = param as RealtorViewModel;

            if (viewModel == null)
            {
                return;
            }

            string viewID = "id_name_realtoreditmode_" + viewModel.ID.ToString();

            if (Api.ActivateTab(viewID))
            {
                return;
            }

            // else create new tab

            RealtorView view = new RealtorView();

            view.DataContext = viewModel;

            view.ToolTip = "Риелтор №" + viewModel.ID.ToString();
            view.Name    = viewID;

            Api.AddTabItem(view);
        }
        private void ShowMainView(object param)
        {
            if (Api.ActivateTab("id_name_mycompany"))
            {
                return;
            }

            MyAgencyView _agencyView = new MyAgencyView();

            _agencyView.Name        = "id_name_mycompany";
            _agencyView.ToolTip     = "Моя компания";
            _agencyView.DataContext = new MyCompanyViewModel();

            Api.AddTabItem(_agencyView);
        }
        private void ShowRealtorTable(object param)
        {
            if (Api.ActivateTab("id_name_realtorstable"))
            {
                return;
            }

            RealtorsTableView view = new RealtorsTableView();

            view.Name    = "id_name_realtorstable";
            view.ToolTip = "Таблица сотрудников";

            view.DataContext = new RealtorsTableViewModel(1); // FIX: id

            Api.AddTabItem(view);
        }
Ejemplo n.º 6
0
        public void ShowRegionEditorView(object o)
        {
            if (Api.ActivateTab("id_name_database_dictionary"))
            {
                return;
            }

            RegionsEditorView _regionEditorView = new RegionsEditorView();

            _regionEditorView.DataContext = new RegionsEditorViewModel();
            _regionEditorView.Name        = "id_name_database_dictionary_regions";

            _regionEditorView.ToolTip = "Справочник: Регионы";
            Api.AddTabItem(_regionEditorView);
            System.Windows.MessageBox.Show("xxx");
        }