public SdkPage() { try { plcncliCommunication = Package.GetGlobalService(typeof(SPlcncliCommunication)) as IPlcncliCommunication; model = new SDKPageModel(plcncliCommunication); viewModel = new SDKPageViewModel(model); PageControl = new SDKPageControl(viewModel); } catch (Exception e) { ThreadHelper.ThrowIfNotOnUIThread(); IVsActivityLog log = Package.GetGlobalService(typeof(SVsActivityLog)) as IVsActivityLog; log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, this.ToString(), "An error occurred while creating the sdk page: " + e.Message); } }
public SDKPageControl(SDKPageViewModel viewModel) { this.DataContext = viewModel; try { InitializeComponent(); } catch (Exception e) { ThreadHelper.ThrowIfNotOnUIThread(); IVsActivityLog log = Package.GetGlobalService(typeof(SVsActivityLog)) as IVsActivityLog; if (log == null) { return; } log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, this.ToString(), "Component initialization failed: " + e.Message); } }