private void OnFetchClimateButtonClick(object sender, RibbonControlEventArgs e) { try { var dialog = new FetchClimateView(); System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(dialog); helper.Owner = (IntPtr)ThisAddIn.ExcelApplication.Hwnd; var viewModel = new FetchClimateViewModel(); viewModel.RequestClose += new EventHandler(dialog.OnRequestClose); dialog.DataContext = viewModel; dialog.ShowDialog(); viewModel.RequestClose -= new EventHandler(dialog.OnRequestClose); dialog.Close(); } catch (CustomException ex) { Ribbon.ShowError(ex.HasCustomMessage ? ex.Message : Resources.LayerOperationError); } catch (Exception exception) { Logger.LogException(exception); Ribbon.ShowError(Resources.DefaultErrorMessage); } }
private void OnFetchClimateButtonClick(object sender, RibbonControlEventArgs e) { try { var dialog = new FetchClimateView(); System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(dialog); helper.Owner = (IntPtr)ThisAddIn.ExcelApplication.Hwnd; var viewModel = new FetchClimateViewModel(); viewModel.RequestClose += new EventHandler(dialog.OnRequestClose); dialog.DataContext = viewModel; dialog.ShowDialog(); viewModel.RequestClose -= new EventHandler(dialog.OnRequestClose); dialog.Close(); } catch (CustomException ex) { Ribbon.ShowError(ex.HasCustomMessage ? ex.Message : Resources.LayerOperationError); } catch (Exception exception) { Logger.LogException(exception); Ribbon.ShowError(Resources.DefaultErrorMessage); } }