public void SendAttachment( [CommandParameter("To")] IEmailAddressFacet emailAddress, [CommandParameter("Attachment")][FilterExtraData("Type", "File")] IFileSystemItemFacet attachment, [CommandParameter("Text", Optional = true)] ITextFacet message) { Process.Start("mailto:" + emailAddress.Value); }
public void MakeAppointment( [CommandParameter("Calendar")] ICalendarFacet calendar, [CommandParameter("With")] IContactFacet contact, [CommandParameter("Time")] IDateTimeFacet time, [CommandParameter("Duration", Optional = true)] IDurationFacet duration, [CommandParameter("Subject", Optional = true)] ITextFacet subject) { calendar.MakeAppointment(contact, time, duration, subject); }
public void OpenProgram( [CommandParameter("Program"), FilterExtraData("Type", "Program")] IFileSystemItemFacet program, [CommandParameter("File", Optional = true), FilterExtraData("Type", "File")] IFileSystemItemFacet file, [CommandParameter("Text", Optional = true)] ITextFacet commandline) { if (file != null) { Process.Start(program.Path, '"' + file.Path + '"'); } else { Process.Start(program.Path); } }
public void SearchWeb(ITextFacet text) { Process.Start("http://www.google.com/search?q=" + Uri.EscapeDataString(text.Text)); }
public void MakeAppointment(IContactFacet contact, IDateTimeFacet at, IDurationFacet duration, ITextFacet subject) { if (contact == null || at == null) { return; } var store = ExtensionHooks.GetKeyValueStore(); var username = store.GetString("username"); var password = store.GetProtectedString("password"); if (username == null || password == null) { throw new RequiresConfigurationException(typeof(Configurators.CredentialsConfigurator), typeof(CalendarFacet)); } var cal = new CalendarService("Commando"); cal.setUserCredentials(username, password); var finalDuration = duration != null ? duration.Duration : TimeSpan.FromHours(1); var e = new EventEntry(subject == null ? "Appointment" : subject.Text); e.Times.Add(new When(at.Value, at.Value.Add(finalDuration))); var who = new Who(); who.Email = contact.Email; who.Rel = Who.RelType.EVENT_ATTENDEE; e.Participants.Add(who); try { cal.Insert(new Uri("https://www.google.com/calendar/feeds/default/private/full"), e); } catch (CaptchaRequiredException) { throw new InvalidOperationException( "Google has locked the account. Please visit http://www.google.com/accounts/DisplayUnlockCaptcha to unlock it."); } catch (InvalidCredentialsException) { throw new RequiresConfigurationException(typeof(Configurators.CredentialsConfigurator), typeof(CalendarFacet), "The username and/or password are incorrect."); } catch (ClientFeedException ex) { throw new InvalidOperationException(string.Format("Could not add the appointment: {0}", ex.Message)); } catch (Exception ex) { throw new InvalidOperationException("Could not add the appointment.", ex); } }
public void SendEmail( [CommandParameter("To")] IEmailAddressFacet emailAddress, [CommandParameter("Text", Optional = true)] ITextFacet message) { Process.Start("mailto:" + emailAddress.Value); }