Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }