public void Run() { // Running in a background thread, perform the web query which may take awhile. LogbookSettings settings = new LogbookSettings(); settings.Load(logbook); if (settings.UserId.Length > 0 && settings.PublicKey.Length > 0) { IList <WithingsWebServiceProxy.MeasurementInfo> measurements = null; try { measurements = WithingsWebServiceProxy.GetMeasurementsSinceLastUpdate(culture, settings.UserId, settings.PublicKey, settings.LastUpdate); } catch (Exception ex) { measurements = null; AddLogEntry(settings, "Could not read user measurements. " + ex.Message); } // Jump back to the UI thread to process the web response since it may cause data change events and UI updates. // TODO: Ugly way to get back on the UI thread via the ActiveView. Possibly a better solution in 3.0? IView activeView = Plugin.Instance.Application.ActiveView; while (activeView == null) { Thread.Sleep(2000); activeView = Plugin.Instance.Application.ActiveView; } activeView.CreatePageControl().BeginInvoke(new ProcessResponseCallback(ProcessResponse), new object[] { logbook, settings, measurements }); } }
public void Run() { // Running in a background thread, perform the web query which may take awhile. LogbookSettings settings = new LogbookSettings(); settings.Load(logbook); if (settings.UserId.Length > 0 && settings.PublicKey.Length > 0) { IList<WithingsWebServiceProxy.MeasurementInfo> measurements = null; try { measurements = WithingsWebServiceProxy.GetMeasurementsSinceLastUpdate(culture, settings.UserId, settings.PublicKey, settings.LastUpdate); } catch (Exception ex) { measurements = null; AddLogEntry(settings, "Could not read user measurements. " + ex.Message); } // Jump back to the UI thread to process the web response since it may cause data change events and UI updates. // TODO: Ugly way to get back on the UI thread via the ActiveView. Possibly a better solution in 3.0? IView activeView = Plugin.Instance.Application.ActiveView; while (activeView == null) { Thread.Sleep(2000); activeView = Plugin.Instance.Application.ActiveView; } activeView.CreatePageControl().BeginInvoke(new ProcessResponseCallback(ProcessResponse), new object[] { logbook, settings, measurements }); } }
public ConfigureWizard() { InitializeComponent(); Text = ResourceLookup.UI_ConfigureWizard_Title; logbook = Plugin.Instance.Application != null ? Plugin.Instance.Application.Logbook : null; settings = new LogbookSettings(); if (logbook != null) { settings.Load(logbook); } accountInfoPage = new ConfigureWizard_Page_AccountInfo(this); selectUserPage = new ConfigureWizard_Page_SelectUser(this); importSettingsPage = new ConfigureWizard_Page_ImportSettings(this); importHistoryPage = new ConfigureWizard_Page_ImportHistory(this); Pages = new IWizardPage[] { accountInfoPage, selectUserPage, importSettingsPage, importHistoryPage }; }
public ConfigureWizard() { InitializeComponent(); Text = ResourceLookup.UI_ConfigureWizard_Title; logbook = Plugin.Instance.Application != null ? Plugin.Instance.Application.Logbook : null; settings = new LogbookSettings(); if (logbook != null) { settings.Load(logbook); } accountInfoPage = new ConfigureWizard_Page_AccountInfo(this); selectUserPage = new ConfigureWizard_Page_SelectUser(this); importSettingsPage = new ConfigureWizard_Page_ImportSettings(this); importHistoryPage = new ConfigureWizard_Page_ImportHistory(this); Pages = new IWizardPage[] { accountInfoPage, selectUserPage, importSettingsPage, importHistoryPage }; }
public void RefreshControls() { settings = new LogbookSettings(); ILogbook logbook = Plugin.Instance.Application != null ? Plugin.Instance.Application.Logbook : null; if (logbook != null) { settings.Load(logbook); } if (settings.PublicKey.Length == 0) { configureButton.Visible = true; tableLayoutPanel.RowStyles[0].Height = 60; settingsPanel.Visible = false; } else { configureButton.Visible = false; tableLayoutPanel.RowStyles[0].Height = 0; settingsPanel.SetSettings(logbook, settings); settingsPanel.Visible = true; } }
public void RefreshControls() { settings = new LogbookSettings(); ILogbook logbook = Plugin.Instance.Application != null ? Plugin.Instance.Application.Logbook : null; if (logbook != null) { settings.Load(logbook); } if (settings.PublicKey.Length == 0) { configureButton.Visible = true; tableLayoutPanel.RowStyles[0].Height = 60; settingsPanel.Visible = false; } else { configureButton.Visible = false; tableLayoutPanel.RowStyles[0].Height = 0; settingsPanel.SetSettings(logbook, settings); settingsPanel.Visible = true; } }