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 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); }