static void Main(string[] args) { if (args.Count() == 6) { string teamCityUrl = args[0].Trim(); string userName = args[1].Trim(); string password = args[2].Trim(); string buildId = args[3].Trim(); string assemblyPath = args[4].Trim(); string prefix = args[5].Trim(); TCConnection tcConnection = new TCConnection(teamCityUrl, userName, password); if (!String.IsNullOrEmpty(assemblyPath)) { Assembly assembly = Assembly.LoadFrom(assemblyPath); if (assembly != null) { Version ver = assembly.GetName().Version; tcConnection.AddBuildTags(buildId, nTeamCity.Core.Locators.Locator.ById, String.Concat(prefix, ver.ToString())); } } else { Console.WriteLine("Invalid assembly"); } } else { Console.WriteLine("Invalid arguments"); Console.WriteLine("TCAssemblyTagger.exe <url> <username> <password> <buildId> <assemblyPath> <tagPrefix>"); } }
private void SetupDeviceEvents() { if (_device != null) { // When a new connection comes in, //store it and use it to accept the incoming call. _device.ReceivedIncomingConnection += (sender, e) => { _connection = e.Connection; _connection.Accept(); }; } }
public static void AddBuildTags(TCConnection connection, string locatorBuildValue, Locator locator, params string[] tags) { var url = connection.UrlResolver.ResolveURL<BuildTagCollectionInfo>(locatorBuildValue, locator); RestRequest request = new RestRequest(url, Method.POST); BuildTagsInfo tagsInfo = new BuildTagsInfo() { Tags = tags }; connection.CallPostRequest<BuildTagsInfo>(request, tagsInfo); }
public static ArtifactFileInfo GetBuildArtifact(TCConnection connection, string href) { RestRequest request = new RestRequest(href, Method.GET); ArtifactFileInfo fileInfo = connection.CallRequest<ArtifactFileInfo>(request); if (fileInfo.IsFile == true) { RestRequest requestContent = new RestRequest(fileInfo.Content.Href, Method.GET); fileInfo.Content = connection.CallRequest<ArtifactContentInfo>(requestContent); } return fileInfo; }
static void Main(string[] args) { if (args.Count() >= 4) { string teamCityUrl = args[0].Trim(); int buildsDeep = int.Parse(args[1]); string[] buildTypes = args[2].Split(new char[] { ',', ';' }); string outputXmlFile = args[3]; string xsltFile = args[4]; TCConnection tcConnection = new TCConnection(teamCityUrl); XElement root = new XElement("reports"); foreach (string buildTypeId in buildTypes) { ReportParameters parameters = new ReportParameters( teamCityUrl, buildTypeId, 0, buildsDeep, f => { return (f.DefaultBranch == true); } ); IReportGenerator<ReportParameters> reportGenerator = new ReportGenerator(); IReport<ReportParameters> report = reportGenerator.Generate(parameters); root.Add(report.ToXML(buildTypeId)); } XDocument xdoc = new XDocument( new XDeclaration("1.0", "utf-8", null), root); xdoc.Save(outputXmlFile); if (!String.IsNullOrEmpty(xsltFile)) { string outputHtmlFile = Path.Combine( Path.GetDirectoryName(outputXmlFile), String.Concat(Path.GetFileNameWithoutExtension(outputXmlFile), ".html")); XslCompiledTransform myXslTrans = new XslCompiledTransform(); myXslTrans.Load(xsltFile); myXslTrans.Transform(outputXmlFile, outputHtmlFile); } } else { Console.WriteLine("Invalid arguments"); } }
private void MainActivity_OnPhoneCall(object sender, TwilioEventArgs e) { //NSDictionary parameters = NSDictionary.FromObjectsAndKeys( // new object[] { from, to }, // new object[] { "Source", "Target" } //); NSDictionary parameters = NSDictionary.FromObjectsAndKeys( new object[] { e.CallID }, new object[] { "CallId" } ); _connection = _device.Connect(parameters, null); }
partial void UIButton5_TouchUpInside(UIButton sender) { ///Source represents the the phone number that you want Twilio to use as the Caller ID when it calls the /// Target. The Source number must be either a phone number you've purchased from Twilio, or a phone number that /// has been verified by Twilio. var parameters = NSDictionary.FromObjectsAndKeys( new object[] { "61411024553", "61411024553" }, new object[] { "Target", "Source" } ); try { _connection = _device.Connect(parameters, null); } catch (Exception ex) { } }
void SetupConnectionEvents() { if (connection != null) { connection.Failed += delegate { UpdateStatus(); }; connection.StartedConnecting += delegate { UpdateStatus(); }; connection.Connected += delegate { callButton.SetCaptionAndUpdate("Hangup"); UpdateStatus(); }; connection.Disconnected += delegate { callButton.SetCaptionAndUpdate("Call"); UpdateStatus(); connection = null; }; } }
void SetupDeviceEvents() { device.StoppedListeningForIncomingConnections += delegate { UpdateStatus(); }; device.StartedListeningForIncomingConnections += delegate { UpdateStatus(); }; device.ReceivedIncomingConnection += (sender, e) => { if (connection != null && connection.State == TCConnectionState.Connected) { connection.Disconnect(); } connection = e.Connection; SetupConnectionEvents(); UpdateStatus(); var alert = new UIAlertView("Incoming call", e.Connection.Parameters["From"].ToString(), null, "Answer", new string[] { "Reject" }); alert.Clicked += (s, b) => { //label1.Text = "Button " + b.ButtonIndex.ToString () + " clicked"; //Console.WriteLine ("Button " + b.ButtonIndex.ToString () + " clicked"); if (b.ButtonIndex == 0) { connection.Accept(); } else { connection.Reject(); } }; alert.Show(); }; device.ReceivedPresenceUpdate += delegate { Debug.WriteLine("Received Presence Update"); }; }
static void Main(string[] args) { if (args.Count() >= 5) { string teamCityUrl = args[0].Trim(); string buildTypeId = args[1].Trim(); string artifactName = args[2].Trim(); int buildsDeep = int.Parse(args[3].Trim()); string outputFolder = args[4].Trim(); TCConnection tcConnection = new TCConnection(teamCityUrl); BuildCollectionInfo buildType = tcConnection.GetBuildCollection(buildTypeId, Locator.ById); List<BuildInfo> buildInfoArrayTmp = buildType.Items .Where(b => b.Status == BuildStatus.SUCCESS) .OrderByDescending(o => o.Id) .Take(buildsDeep) .ToList(); foreach (var item in buildInfoArrayTmp) { var x = tcConnection.GetBuildArtifacts(item.Id.ToString(), Locator.ById); if (x.StatusCode == System.Net.HttpStatusCode.OK) { //x.SaveToFolder(outputFolder); } } Console.ReadKey(); // temporary } else { Console.WriteLine("Invalid arguments"); } }
partial void btnCall(NSObject sender) { device.StoppedListeningForIncomingConnections += delegate { Console.WriteLine("StoppedListeningForIncomingConnection"); updateStateLabels(); }; device.StartedListeningForIncomingConnections += delegate { Console.WriteLine("StartedListeningForIncomingConnections"); updateStateLabels(); }; device.ReceivedIncomingConnection += (s, a) => { Console.WriteLine("ReceivedIncomingConnection"); if (connection != null && connection.State == TCConnectionState.Connected) { connection.Disconnect(); } connection = a.Connection; updateStateLabels(); }; device.ReceivedPresenceUpdate += delegate { Console.WriteLine("ReceivedPresenceUpdate"); }; NSDictionary param = NSDictionary.FromObjectsAndKeys( new object[] { "+14159929754", "+13144586142" }, new object[] { "Source", "Target" } ); // HACK: // In order to setup events you need to first initialize connection so we have a reference to it, also the delegate param should be null // this is because when you set up an event we internally will create a Objc delegate that will be assigned to the delegate property // and if we see that delegate property is not null then we will not be able to set you up connection = device.Connect(param, null); connection.Failed += delegate { Console.WriteLine("FailedWithError"); updateStateLabels(); }; connection.StartedConnecting += delegate { Console.WriteLine("StartedConnecting"); updateStateLabels(); }; connection.Connected += delegate { Console.WriteLine("Connected"); updateStateLabels(); }; connection.Disconnected += delegate { Console.WriteLine("Disconnected"); updateStateLabels(); connection = null; }; }
public void TestAddTags() { tcConnection = new TCConnection("http://192.168.137.49", "admin", "admin"); tcConnection.AddBuildTags("20", Core.Locators.Locator.ById, "TAG1", "TAG2"); }
public override void DidFail(TCConnection connection, NSError error) { //Console.WriteLine("DidFailWithError: " + error.LocalizedDescription); }
public void TestTags() { tcConnection = new TCConnection("http://192.168.137.49"); var result = tcConnection.GetBuildTagCollection("22", Core.Locators.Locator.ById); }
public void Setup() { tcConnection = new TCConnection(tcTestUrl); }
public static BuildTypeInfo GetBuildType(this ProjectDetailsInfo projectDetails, TCConnection connection) { return connection.CallRequest<BuildTypeInfo>(projectDetails.Href); }
public async override void FinishedLaunching(UIApplication application) { this.Window = new UIWindow(UIScreen.MainScreen.Bounds); var client = new HttpClient(); var token = await client.GetStringAsync("** Your AuthToken URL goes here **"); device = new TCDevice(token, null); var dialogController = new DialogViewController(new RootElement("Twilio Client Test") { new Section("Call Options") { (numberOrClient = new EntryElement("Target", "Phone # or client name", "")), (callButton = new StyledStatusStringElement("Call", delegate { if (connection == null || connection.State == TCConnectionState.Disconnected) { var param = new TCConnectionParameters { Source = "** Your Twilio Phone Number goes here **", Target = numberOrClient.Value }; connection = device.Connect(param, null); SetupConnectionEvents(); } else { connection.Disconnect(); } })), }, new Section("Status") { (deviceState = new StatusStringElement("Device", device.State.ToString())), (connectionState = new StatusStringElement("Connection", "Uninitialized")) }, new Section("Sounds") { (disconnectSoundEnabled = new BooleanElement("Disconnect Sound", device.DisconnectSoundEnabled)), (incomingCallSoundEnabled = new BooleanElement("Incoming Sound", device.IncomingSoundEnabled)), (outgoingCallSoundEnabled = new BooleanElement("Outgoing Sound", device.OutgoingSoundEnabled)) }, new Section("Options") { (muted = new BooleanElement("Muted", false)), (listening = new BooleanElement("Device Listening", true)) } }); callButton.Alignment = UITextAlignment.Center; callButton.TextColor = UIColor.FromRGB(0x00, 0x7A, 0xFF); var navigationController = new UINavigationController(dialogController); //navigationController.NavigationBar.BarTintColor = UIColor.Red; //navigationController.NavigationBar.TintColor = UIColor.White; Window.RootViewController = navigationController; Window.MakeKeyAndVisible(); SetupSoundOptionEvents(); SetupOptions(); SetupDeviceEvents(); device.Listen(); }
public static BuildTagCollectionInfo GetBuildTagCollection(TCConnection connection, string locatorBuildValue, Locator locator) { RestRequest request = new RestRequest( connection.UrlResolver.ResolveURL<BuildTagCollectionInfo>(locatorBuildValue, locator), Method.GET); return connection.CallRequest<BuildTagCollectionInfo>(request); }