private void lbNewConnections_SelectionChanged(object sender, SelectionChangedEventArgs e) { base.Close(); SelectConnection.WindowOpen = true; AddNewServer addNewServer = new AddNewServer(); Application.ShowModalWindow(addNewServer); }
public static bool?ShowDialog([NotNull] List <IError> errors) { var errVM = new ErrorsVM(errors) { IsDialog = true }; var errView = new ErrorsView(errVM); var res = Application.ShowModalWindow(errView); return(res); }
public static bool?ShowDialog(ViewModelBase viewModel) { Type view; if (dictVmViews.TryGetValue(viewModel.GetType(), out view)) { var win = (Window)Activator.CreateInstance(view); win.DataContext = viewModel; return(Application.ShowModalWindow(win)); } throw new Exception("Окно не определено - тип = " + viewModel.GetType()); }
private void btnNext_Click(object sender, RoutedEventArgs e) { base.Close(); if (!this.SelectService()) { Application.ShowModalWindow(new SelectConnection { lbConnections = { ItemsSource = App.Connections } }); } }
public void Main() { try { var win = new SettingsWindow(); var viewModel = new SettingsViewModel(win); win.DataContext = viewModel; win.Closed += (sender, args) => viewModel.ApplySettings(); AcApp.ShowModalWindow(AcApp.MainWindow.Handle, win); } catch (System.Exception exception) { ExceptionBox.Show(exception); } }
private void ListBox_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2 && this.lbConnections.SelectedItem != null) { base.Close(); if (!this.SelectService()) { Application.ShowModalWindow(new SelectConnection { lbConnections = { ItemsSource = App.Connections } }); } } }
public static void OpenStyleEditor() { if (_styleEditor == null) { _styleEditor = new StyleEditor(); _styleEditor.Closed += (sender, args) => _styleEditor = null; } if (_styleEditor.IsLoaded) { _styleEditor.Activate(); } else { AcApp.ShowModalWindow(AcApp.MainWindow.Handle, _styleEditor, false); } }
public void Start() { Statistic.SendCommandStarting(new ModPlusConnector()); try { MoveDwgBase(); // Директория расположения базы создается при первом обращении к свойству Constants.DwgBaseDirectory! var win = new MpDwgBaseMainWindow(); AcApp.ShowModalWindow(AcApp.MainWindow.Handle, win, false); } catch (System.Exception exception) { ExceptionBox.Show(exception); } }
private void OnClickNext(object sender, RoutedEventArgs e) { this.lblErrorMessage.Content = ""; if (string.IsNullOrEmpty(this.tbName.Text)) { this.lblErrorMessage.Content = AfaStrings.NameCannotBeBlank; return; } string text = this.tbName.Text; if (!string.IsNullOrEmpty(text)) { text = text.Trim(); } if (string.IsNullOrEmpty(text)) { this.lblErrorMessage.Content = AfaStrings.NameCannotBeBlank; return; } text = NewFeatureClass.FixFeatureClassName(text); MSCDataset docDataset = AfaDocData.ActiveDocData.DocDataset; MSCFeatureClass mSCFeatureClass = new MSCFeatureClass(docDataset); this.tbName.Text = text; mSCFeatureClass.Name = text; mSCFeatureClass.SetGeometryType(this.cbType.SelectedValue.ToString()); mSCFeatureClass.Query = new ResultBuffer(new TypedValue[] { new TypedValue(8, "*") }); mSCFeatureClass.Write(AfaDocData.ActiveDocData.Document); docDataset.FeatureClasses.Add(mSCFeatureClass.Name, mSCFeatureClass); docDataset.FeatureClassViewList.Add(new FCView(mSCFeatureClass)); base.Close(); FeatureClassProperties featureClassProperties = new FeatureClassProperties(mSCFeatureClass); try { Application.ShowModalWindow(featureClassProperties); } catch (Exception) { } AfaDocData.ActiveDocData.SetActiveFeatureClass(mSCFeatureClass); ArcGISRibbon.SetActiveFeatureClass(mSCFeatureClass); }
public void ChangeProperties() { // Получаем текущий документ, его БД и Editor Document acDocument = Application.DocumentManager.MdiActiveDocument; Database acCurDb = acDocument.Database; Editor acEditor = acDocument.Editor; // Начинаем транзакцию Transaction transaction = acCurDb.TransactionManager.StartTransaction(); #if !DEBUG try { #endif // Создаём окно плагина MainView mainWindow = new MainView(); //Создаём модель данных DataService dataService = new DataService(transaction, acCurDb, acEditor); //Создаём viewmodel и соединяем элементы под MVVM MainViewModel mainViewModel = new MainViewModel(dataService); mainWindow.DataContext = mainViewModel; //Вызов окна плагина в режиме диалога Application.ShowModalWindow(mainWindow); #if !DEBUG } catch (Exception exception) { acEditor.WriteMessage("Error: " + exception.Message); } #endif // Освобождение транзакции, если у транзакции не было Commit(), то изменения не применяются transaction.Dispose(); }
private static void Application_Idle(object sender, EventArgs e) { try { Application.Idle -= Application_Idle; Logger.Log.Info("RestoreTabs Application_Idle"); var tabVM = new TabsVM(_tabs); var tabsView = new TabsView(tabVM); if (Application.ShowModalWindow(tabsView) == true) { try { Application.DocumentManager.DocumentCreated -= DocumentManager_DocumentCreated; var closeDocs = Application.DocumentManager.Cast <Document>().Where(w => !w.IsNamedDrawing).ToList(); var tabsRestore = tabVM.Sessions.SelectMany(s => s.Tabs.Where(w => w.Restore)).Select(s => s.File).ToList(); if (tabVM.HasHistory) { tabsRestore = tabsRestore.Union(tabVM.History.Where(w => w.Restore).Select(s => s.File)).Distinct().ToList(); } foreach (var item in tabsRestore) { try { Application.DocumentManager.Open(item, false); } catch (Exception ex) { Inspector.AddError($"Ошибка открытия файла '{item}' - {ex.Message}"); } } // Закрыть пустые чертежи foreach (var doc in closeDocs) { try { doc.CloseAndDiscard(); } catch (Exception ex) { Logger.Log.Error(ex, "RestoreTabs. Закрыть пустые чертежи."); } } if (tabsRestore?.Any() == true) { LogRestoreTabs(tabsRestore); } } finally { Application.DocumentManager.DocumentCreated += DocumentManager_DocumentCreated; Inspector.Show(); } } if (tabVM.SessionCount != _tabs.SessionCount) { _tabs.SessionCount = tabVM.SessionCount; var tabsData = LoadData(); tabsData.Data.SessionCount = tabVM.SessionCount; tabsData.TrySave(); } } catch (Exception ex) { Logger.Log.Error(ex, "RestoreTabs.Application_Idle"); } }