//constructor public RadioDetail() { InitializeComponent(); rData = new RadioData(); radioTitles = rData.returnTitle(); radioUris = rData.returnUrl(); Loaded += RadioDetail_Loaded; interstitialAd = new InterstitialAd(rData.detailInterstitial); AdRequest adRequest = new AdRequest(); interstitialAd.ReceivedAd += OnAdReceived; interstitialAd.DismissingOverlay += interstitialAd_DismissingOverlay; interstitialAd.LoadAd(adRequest); AdView bannerAd = new AdView { Format = AdFormats.Banner, AdUnitID = rData.adBanner }; AdRequest BanneradRequest = new AdRequest(); // Assumes we've defined a Grid that has a name // directive of ContentPanel. mainPanel.Children.Add(bannerAd); bannerAd.VerticalAlignment = VerticalAlignment.Bottom; bannerAd.LoadAd(BanneradRequest); }
void LoadRadioData() { //Items = new ObservableCollection<ItemViewModel>(); RadioData rData = new RadioData(); radioTitles = rData.returnTitle(); radioUrls = rData.returnUrl(); for (int i = 0; i < radioTitles.Length; i++) { this.RadioItems.Add(new RadioViewModel() { RadioTitle = radioTitles[i], RadioUrl = radioUrls[i] }); } }
public void QueueRadioMessage(string radioClip, bool endOfQueue, int owner) { RadioData data = new RadioData(); data.ClipName = radioClip; data.Owner = owner; if (endOfQueue) { _radioMessageQueue.Enqueue(data); } else { Queue <RadioData> tempQueue = new Queue <RadioData>(_radioMessageQueue); _radioMessageQueue.Clear(); _radioMessageQueue.Enqueue(data); while (tempQueue.Count > 0) { _radioMessageQueue.Enqueue(tempQueue.Dequeue()); } } }
void MainPage_Loaded(object sender, RoutedEventArgs e) { rdata = new RadioData(); interstitialAd = new InterstitialAd(rdata.homeInterstitial); AdRequest adRequest = new AdRequest(); interstitialAd.ReceivedAd += OnAdReceived; interstitialAd.DismissingOverlay += interstitialAd_DismissingOverlay; interstitialAd.LoadAd(adRequest); AdView bannerAd = new AdView { Format = AdFormats.Banner, AdUnitID = rdata.adBanner }; AdRequest BanneradRequest = new AdRequest(); // Assumes we've defined a Grid that has a name // directive of ContentPanel. LayoutRoot.Children.Add(bannerAd); bannerAd.VerticalAlignment = VerticalAlignment.Bottom; bannerAd.LoadAd(BanneradRequest); }
private void Update() { if (_radioSource.isPlaying) { if (_currentOwner == null || _currentOwner.Alive) { return; } _radioSource.Stop(); _currentOwner = null; } DestroyAudioClip(); if (_radioMessageQueue.Count > 0) { RadioData radioData = _radioMessageQueue.Dequeue(); if (radioData.Owner != -1) { Car car = EntityManager.Instance.GetCar(radioData.Owner); if (car == null || !car.Alive) { return; } _currentOwner = car; } AudioClip clip = VirtualFilesystem.Instance.GetAudioClip(radioData.ClipName); if (clip != null) { _radioSource.clip = clip; _radioSource.Play(); } } }
public void Start() { try { _data = new RadioData { vfoa = "0", vfob = "0", Mode = "99", mox = false, DisplayMode = "0", Smeter = "0", dspfilters = "", dspfilterarray = new ArrayList { "6.0", "4.0", "2.6", "2.1", "1.0", "500", "250", "100", "50", "25", "VAR1", "VAR2", "UNKN" }, }; if (Properties.Settings.Default.SerialPortIdx == 0) { // RIOX try { Console.WriteLine("RIOX initializing"); _riox = new RIOX.RIOXClient(typeof(RIOXData), Properties.Settings.Default.RIOXIP, Properties.Settings.Default.RIOXPort); _riox.ObjectReceivedEvent += new RIOX.RIOXClient.ObjectReceivedEventHandler(_riox_ObjectReceivedEvent); _usingRIOX = true; } catch (Exception ex) { _notifyIcon.MessageBox("RIOX error: " + ex.Message + "\r\n" + ex.StackTrace); throw ex; } } else { _cat = new CATConnector(new SerialPort(Properties.Settings.Default.SerialPort)); _timerShort = new Timer(Properties.Settings.Default.HighInterval); _cat.CATEvent += CatcatEvent; _timerShort.Elapsed += TimerShortElapsed; } _timerLong = new Timer(Properties.Settings.Default.LowInterval); _timerLong.Elapsed += TimerLongElapsed; //_listenOnly = Properties.Settings.Default.ListenOnly; _server = new HRDTCPServer(this); } catch (Exception e) { _notifyIcon.MessageBox("While starting: " + e.Message + "\n" + "Server is disabled. Please check configuration.\nIf using RIOX mode, please make sure DDUtil is running."); ShowOptionsForm(); return; } _server.HRDTCPEvent += ServerHRDTCPEvent; // Start the timers only if serial polling is enabled if (!_usingRIOX) { // write initial commands to the radio to fill in initial data WriteCommand("ZZIF;"); WriteCommand("ZZFA;"); WriteCommand("ZZFB;"); WriteCommand("ZZBS;"); WriteCommand("ZZDM;"); WriteCommand("ZZGT;"); WriteCommand("ZZPA;"); WriteCommand("ZZFI;"); _timerShort.Start(); //_timerLong.Start(); } else // using RIOX { // subscribe to what we want from DDUtil _riox.SendCommand(new RIOXCommand("UpDateType", "PSH:500")); //_riox.SendCommand(new RIOXCommand("UnSub", "NONE")); _riox.SendCommand(new RIOXCommand("Sub", "ZZIF;ZZFA;ZZFB;ZZBS;ZZDM;ZZGT;ZZPA;ZZFI;")); } _timerLong.Start(); _server.Start(); SetNotifyIconText("MiniDeluxe - Running (0 connections)"); }
public void Start() { try { _data = new RadioData { vfoa = "0", vfob = "0", Mode = "99", mox = false, DisplayMode = "0", Smeter = "0", dspfilters = "", dspfilterarray = new ArrayList { "6.0","4.0","2.6","2.1","1.0", "500","250","100","50","25","VAR1","VAR2","UNKN" }, }; if (Properties.Settings.Default.SerialPortIdx == 0) { // RIOX try { Console.WriteLine("RIOX initializing"); _riox = new RIOX.RIOXClient(typeof(RIOXData), Properties.Settings.Default.RIOXIP, Properties.Settings.Default.RIOXPort); _riox.ObjectReceivedEvent += new RIOX.RIOXClient.ObjectReceivedEventHandler(_riox_ObjectReceivedEvent); _usingRIOX = true; } catch (Exception ex) { _notifyIcon.MessageBox("RIOX error: " + ex.Message + "\r\n" + ex.StackTrace); throw ex; } } else { _cat = new CATConnector(new SerialPort(Properties.Settings.Default.SerialPort)); _timerShort = new Timer(Properties.Settings.Default.HighInterval); _cat.CATEvent += CatcatEvent; _timerShort.Elapsed += TimerShortElapsed; } _timerLong = new Timer(Properties.Settings.Default.LowInterval); _timerLong.Elapsed += TimerLongElapsed; //_listenOnly = Properties.Settings.Default.ListenOnly; _server = new HRDTCPServer(this); } catch (Exception e) { _notifyIcon.MessageBox("While starting: " + e.Message + "\n" + "Server is disabled. Please check configuration.\nIf using RIOX mode, please make sure DDUtil is running."); ShowOptionsForm(); return; } _server.HRDTCPEvent += ServerHRDTCPEvent; // Start the timers only if serial polling is enabled if (!_usingRIOX) { // write initial commands to the radio to fill in initial data WriteCommand("ZZIF;"); WriteCommand("ZZFA;"); WriteCommand("ZZFB;"); WriteCommand("ZZBS;"); WriteCommand("ZZDM;"); WriteCommand("ZZGT;"); WriteCommand("ZZPA;"); WriteCommand("ZZFI;"); _timerShort.Start(); //_timerLong.Start(); } else // using RIOX { // subscribe to what we want from DDUtil _riox.SendCommand(new RIOXCommand("UpDateType", "PSH:500")); //_riox.SendCommand(new RIOXCommand("UnSub", "NONE")); _riox.SendCommand(new RIOXCommand("Sub","ZZIF;ZZFA;ZZFB;ZZBS;ZZDM;ZZGT;ZZPA;ZZFI;")); } _timerLong.Start(); _server.Start(); SetNotifyIconText("MiniDeluxe - Running (0 connections)"); }