private void buttonExecute_Click(object sender, RoutedEventArgs e) { AddInToken t = comboBoxProvider.SelectedItem as AddInToken; AddInProcess addInProcess = new AddInProcess(); try { using (IAccessComposition iac = t.Activate <IAccessComposition>(addInProcess, AddInSecurityLevel.FullTrust)) { if (radioButtonLoad.IsChecked == true) { iac.Open(textBoxFile.Text); iac.LoadObjects(textBoxFolder.Text); iac.Close(); } else if (radioButtonSave.IsChecked == true) { iac.Open(textBoxFile.Text); iac.SaveObjects(textBoxFolder.Text); iac.Close(); } else if (radioButtonClear.IsChecked == true) { iac.Open(textBoxFile.Text); iac.ClearObjects(); iac.Close(); } } } catch (Exception ex) { MessageBox.Show(string.Format("Message: {0}\r\n\r\nStack Trace: {1}", ex.Message, ex.StackTrace), "Error"); } finally { if (!addInProcess.IsCurrentProcess) { addInProcess.Shutdown(); } } }
public void Open(string filename) { _view.Open(filename); }