Ejemplo n.º 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);
            }
        }
 /// <summary>
 /// Initializes a new instance of the FetchClimateHandler class.
 /// </summary>
 /// <param name="fetchClimateViewModel">Parent view model.</param>
 public FetchClimateHandler(FetchClimateViewModel fetchClimateViewModel)
 {
     this.parent = fetchClimateViewModel;
 }
 /// <summary>
 /// Initializes a new instance of the CancelEventHandler class.
 /// </summary>
 /// <param name="fetchClimateViewModel">Parent view model.</param>
 public CancelEventHandler(FetchClimateViewModel fetchClimateViewModel)
 {
     this.parent = fetchClimateViewModel;
 }
 /// <summary>
 /// Initializes a new instance of the FetchClimateHandler class.
 /// </summary>
 /// <param name="fetchClimateViewModel">Parent view model.</param>
 public FetchClimateHandler(FetchClimateViewModel fetchClimateViewModel)
 {
     this.parent = fetchClimateViewModel;
 }
 /// <summary>
 /// Initializes a new instance of the CancelEventHandler class.
 /// </summary>
 /// <param name="fetchClimateViewModel">Parent view model.</param>
 public CancelEventHandler(FetchClimateViewModel fetchClimateViewModel)
 {
     this.parent = fetchClimateViewModel;
 }
Ejemplo n.º 6
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);
            }
        }