emilsD Posted July 26, 2019 Report Share Posted July 26, 2019 Sveiki visiem,esu sacis darboties ar c#. Un nekadi nevaru saprast kas man te pa vainu: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WMPLib; namespace radio { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Button1_Click(object sender, EventArgs e) { new WindowsMediaPlayer() { URL = "http://www.radioskonto.lv/online_radio/stereo.m3u" }.controls.play(); } private void Button2_Click(object sender, EventArgs e) { } } } Problema tada ka ir ideja lai kad uzspiezot uz pogas skan radio,un uzspiezot atpakal apstajas(Uz tas pasas pogas) un tada gara ar visam stacijam,izrakaju googli neko neatradu. Paldies,ceru uz kadu atbildi :) Quote Link to comment Share on other sites More sharing options...
e-remit Posted July 26, 2019 Report Share Posted July 26, 2019 Tev objekts WindowsMediaPlayer jāsaglabā privātajā mainīgajā. Tad, spiežot play, paskaties, kāds ir stāvoklis - vai tobrīd spēlē un un kādu staciju spēlē. Ja spēlē izvēlēto, tad izslēdz, pretējā gadījumā uzliek pareizo URLi un palaiž play(). Quote Link to comment Share on other sites More sharing options...
emilsD Posted July 27, 2019 Author Report Share Posted July 27, 2019 (edited) Es nezinu ,bet man nesanak,reali te visu nakti nemos Velos vienkarsak parskatamak un lai saprotu ne tikkai es Edited July 27, 2019 by emilsD Quote Link to comment Share on other sites More sharing options...
e-remit Posted July 27, 2019 Report Share Posted July 27, 2019 Nu, apmēram šādi man strādā. Pāris sekundes gan jāpagaida, līdz sāk spēlēt. using System; using System.Collections.Generic; using System.Windows; using WMPLib; namespace Radio { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private WindowsMediaPlayer _player; private Dictionary<int, string> _urls = new Dictionary<int, string> { { 1, "http://www.radioskonto.lv/online_radio/stereo.m3u" }, { 2, "http://live.pieci.lv/live19-hq.mp3" }, }; private int _active = -1; public MainWindow() { InitializeComponent(); _player = new WindowsMediaPlayer(); } private void Play(int station) { if (_active == station) { _player.controls.stop(); _active = -1; return; } _player.URL = _urls[station]; _player.controls.play(); _active = station; } private void Btn1_Click(object sender, RoutedEventArgs e) { Play(1); } private void Btn2_Click(object sender, RoutedEventArgs e) { Play(2); } } } Quote Link to comment Share on other sites More sharing options...
emilsD Posted July 27, 2019 Author Report Share Posted July 27, 2019 Man kautkas tur neiet,varbut vari visu source sazipotu iemest? Paldies. Quote Link to comment Share on other sites More sharing options...
e-remit Posted July 27, 2019 Report Share Posted July 27, 2019 Kas tieši neiet? Nekompilējas, vai nestrādā? Pagaidīji dažas sekundes, lai sāk spēlēt? Quote Link to comment Share on other sites More sharing options...
emilsD Posted July 27, 2019 Author Report Share Posted July 27, 2019 (edited) Paldies e-remit,problema atrisinata :) Janu kadam noder,te bus ar visu source --> T a izskatas,vnk ,lai nav katru reizi browseris javer vala tad vismaz man noder si neliela programma :) https://failiem.lv/u/xn2v4wqv https://prnt.sc/ol2dl7 Edited July 31, 2019 by emilsD Quote Link to comment Share on other sites More sharing options...
emilsD Posted July 31, 2019 Author Report Share Posted July 31, 2019 Lai netaisitu jaunu topiku velos pajautat jusu domas saistiba ar sms sutisano no c# aplikacijas. Skatos uz so pasakumu http://www.text2reach.com/ Bet nekadi nevaru saprast ka lai api pievieno hmmm Paldies :) Quote Link to comment Share on other sites More sharing options...
Kemito Posted July 31, 2019 Report Share Posted July 31, 2019 https://lmgtfy.com/?q=c%23+perform+http+request Quote Link to comment Share on other sites More sharing options...
emilsD Posted July 31, 2019 Author Report Share Posted July 31, 2019 OK,bet api kadu vajag viennozimgi,lai varetu kautko darit. Un man nav ne jausmas kur vinu dabut. Quote Link to comment Share on other sites More sharing options...
Kemito Posted July 31, 2019 Report Share Posted July 31, 2019 http://www.text2reach.com/docs/ Quote Link to comment Share on other sites More sharing options...
emilsD Posted July 31, 2019 Author Report Share Posted July 31, 2019 Mjaa tas viss ir sarezgiti hmmm Quote Link to comment Share on other sites More sharing options...
jurgenzz Posted August 1, 2019 Report Share Posted August 1, 2019 Sarežģīti būs to darot pirmās 5-7x :) Pēc tam kļūs vieglāk, bet atmetot uzreiz ar roku un sakot, ka "tas viss ir sarežģīti", vieglāk nepaliks nevienā no reizēm :) Quote Link to comment Share on other sites More sharing options...
emilsD Posted August 1, 2019 Author Report Share Posted August 1, 2019 (edited) 2 hours ago, jurgenzz said: Sarežģīti būs to darot pirmās 5-7x :) Pēc tam kļūs vieglāk, bet atmetot uzreiz ar roku un sakot, ka "tas viss ir sarežģīti", vieglāk nepaliks nevienā no reizēm :) Piekritu,mekleju tagad risinajumu :) + bezmaksas nemaz nevar atrast es domaju api. Nesaprotu kas pa problemu,nesanak aizsutit errors failure to send mail. hmmm using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Net; using System.Net.Mail; namespace smssutit { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Button1_Click(object sender, EventArgs e) { MailMessage message = new MailMessage(); message.To.Add("37122222222@txt.att.net");//te jabut kautkam citam message.From = new MailAddress("kautkas@gmail.com", "App"); message.Body = "Sveiki"; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); smtp.EnableSsl = true; smtp.Port = 465; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential("kautkas@gmail.com", "tava parole"); try { smtp.Send(message); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } Edited August 1, 2019 by emilsD Quote Link to comment Share on other sites More sharing options...
e-remit Posted August 1, 2019 Report Share Posted August 1, 2019 Kāds ir kļūdas paziņojums? Googlē esi atļāvis savu kontu izmantot sūtīšanai? Vispār jau, ja skatās Googles epasta instrukcijās, tur cits ports norādīts! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.