private string GenerateTestDeviceXML(string deviceName) { var testDevice = new SyncDevice(); testDevice.Name = deviceName; testDevice.SyncVersionId = SyncListenerService.SyncVersionId; return XmlSerialization.Serialize<SyncDevice>(testDevice); }
public void RefreshDevice(SyncDevice device) { Gtk.Application.Invoke(delegate{ Title = "Syncing library with " + device.Name; lblTitle.Text = "Syncing library with " + device.Name; }); }
protected override void OnCreate(Bundle bundle) { Console.WriteLine("SyncMenuActivity - OnCreate"); base.OnCreate(bundle); SetContentView(Resource.Layout.SyncMenu); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetHomeButtonEnabled(true); _loadingLayout = FindViewById<LinearLayout>(Resource.Id.syncMenu_loadingLayout); _mainLayout = FindViewById<LinearLayout>(Resource.Id.syncMenu_mainLayout); _lblStatus = FindViewById<TextView>(Resource.Id.syncMenu_lblStatus); _lblTotal = FindViewById<TextView>(Resource.Id.syncMenu_lblTotal); _lblFreeSpace = FindViewById<TextView>(Resource.Id.syncMenu_lblFreeSpace); _btnSelectAll = FindViewById<Button>(Resource.Id.syncMenu_btnSelectAll); _btnSelectAll.Click += (sender, args) => OnSelectButtonClick(); _listView = FindViewById<ListView>(Resource.Id.syncMenu_listView); _listAdapter = new SyncMenuListAdapter(this, new List<SyncMenuItemEntity>()); _listView.SetAdapter(_listAdapter); _listView.ItemClick += ListViewOnItemClick; _listView.ItemLongClick += ListViewOnItemLongClick; string json = Intent.GetStringExtra("device"); _device = JsonConvert.DeserializeObject<SyncDevice>(json); var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>(); navigationManager.BindSyncMenuView(this, _device); }
private void RefreshDeviceDetails(SyncDevice device) { string iconName = string.Empty; switch (device.DeviceType) { case SyncDeviceType.Linux: iconName = "pc_linux_large"; break; case SyncDeviceType.OSX: iconName = "pc_mac_large"; break; case SyncDeviceType.Windows: iconName = "pc_windows_large"; break; case SyncDeviceType.iPhone: iconName = "phone_iphone_large"; break; case SyncDeviceType.iPad: iconName = "tablet_ipad_large"; break; case SyncDeviceType.AndroidPhone: iconName = "phone_android_large"; break; case SyncDeviceType.AndroidTablet: iconName = "tablet_android_large"; break; case SyncDeviceType.WindowsPhone: iconName = "phone_windows_large"; break; case SyncDeviceType.WindowsStore: iconName = "tablet_windows_large"; break; } lblDeviceName.Content = device.Name; lblDeviceUrl.Content = string.IsNullOrEmpty(device.Url) ? "Unknown" : device.Url; lblStatus.Content = device.IsOnline ? "Online" : "Offline"; //imageViewDeviceType.Image = ImageResources.Images.FirstOrDefault(x => x.Name == iconName); lblLastUpdated.Content = device.IsOnline ? string.Format("Last updated: {0}", device.LastUpdated) : string.Format("Last seen online: {0}", device.LastUpdated); if (device.PlayerMetadata != null) { lblArtistName.Content = device.PlayerMetadata.CurrentAudioFile.ArtistName; lblAlbumTitle.Content = device.PlayerMetadata.CurrentAudioFile.AlbumTitle; lblSongTitle.Content = device.PlayerMetadata.CurrentAudioFile.Title; lblPosition.Content = string.Format("{0} / {1}", device.PlayerMetadata.Position + 1, device.PlayerMetadata.Length); lblPlaylist.Content = string.Format("On-the-fly Playlist ({0}/{1})", device.PlayerMetadata.PlaylistIndex, device.PlayerMetadata.PlaylistCount); //LoadAlbumArt(device.AlbumArt); } else { lblArtistName.Content = string.Empty; lblAlbumTitle.Content = string.Empty; lblSongTitle.Content = string.Empty; lblPosition.Content = string.Empty; lblPlaylist.Content = string.Empty; } }
public void RemoveDevice(SyncDevice device) { lock (_locker) { _devices.Remove(device); } OnDeviceRemoved(device); }
public void NotifyRemovedDevice(SyncDevice device) { }
public override void CreateSyncMenuView(SyncDevice device) { var intent = new Intent(MainActivity, typeof(SyncMenuActivity)); string json = JsonConvert.SerializeObject(device); intent.PutExtra("device", json); MainActivity.StartActivity(intent); }
private void HandleOnDeviceFound(SyncDevice deviceFound) { // Create another task because this event is inside a task from the discovery service and can affect timeout Task.Factory.StartNew(() => { //Console.WriteLine("SyncDeviceManagerService - HandleOnDeviceFound - deviceName: {0} url: {1}", deviceFound.Name, deviceFound.Url); AddDevice(deviceFound); }); }
public void RemoteRepeat(SyncDevice device) { RemoteCommand(device, "repeat"); }
public void RemotePrevious(SyncDevice device) { RemoteCommand(device, "previous"); }
public void RemotePause(SyncDevice device) { RemoteCommand(device, "pause"); }
public override ISyncDownloadView CreateSyncDownloadView(SyncDevice device, IEnumerable<AudioFile> audioFiles) { ISyncDownloadView view = null; using (var pool = new NSAutoreleasePool()) { pool.InvokeOnMainThread(delegate { view = base.CreateSyncDownloadView(device, audioFiles); }); } return view; }
public override ISyncMenuView CreateSyncMenuView(SyncDevice device) { ISyncMenuView view = null; using (var pool = new NSAutoreleasePool()) { pool.InvokeOnMainThread(delegate { view = base.CreateSyncMenuView(device); }); } return view; }
public virtual void BindSyncMenuView(ISyncMenuView view, SyncDevice device) { _syncMenuView = view; _syncMenuView.OnViewDestroy = (view2) => { _syncMenuPresenter.ViewDestroyed(); _syncMenuPresenter = null; _syncMenuView = null; }; _syncMenuPresenter = Bootstrapper.GetContainer().Resolve<ISyncMenuPresenter>(new NamedParameterOverloads() { { "device", device } }); _syncMenuPresenter.BindView(view); }
public virtual void CreateSyncMenuView(SyncDevice device) { if (_syncMenuView == null) _syncMenuView = Bootstrapper.GetContainer().Resolve<ISyncMenuView>(new NamedParameterOverloads() { { "device", device } }); else BindSyncMenuView(_syncMenuView, device); PushTabView(MobileNavigationTabType.More, _syncMenuView); }
public void SyncDevice(SyncDevice device) { InvokeOnMainThread(() => { }); }
public void NotifyUpdatedDevice(SyncDevice device) { }
private void RemoteCommand(SyncDevice device, string command) { if (device == null || string.IsNullOrEmpty(device.Url)) return; string remoteUrl = string.Format("{0}api/remote/{1}", device.Url, command); _webClientRemote.DownloadStringAsync(new Uri(remoteUrl)); }
public void RemotePlay(SyncDevice device) { RemoteCommand(device, "play"); }
public void NotifyRemovedDevice(SyncDevice device) { InvokeOnMainThread(() => { int row = tableViewDevices.SelectedRow; SyncDevice selectedDevice = row >= 0 && row <= _items.Count - 1 ? _items[row] : null; lock (_locker) { _items.Remove(device); } tableViewDevices.ReloadData(); if(selectedDevice != null) { int newRow = -1; lock(_locker) { newRow = _items.IndexOf(selectedDevice); } if(newRow >= 0) tableViewDevices.SelectRow(newRow, false); } }); }
public void RemoteStop(SyncDevice device) { RemoteCommand(device, "stop"); }
public void NotifyUpdatedDevice(SyncDevice device) { // Should be the same instance... do we need to update the list? InvokeOnMainThread(() => { //tableViewDevices.ReloadData(NSIndexSet.FromIndex(_items.IndexOf(device)), NSIndexSet.FromIndex(0)); int row = tableViewDevices.SelectedRow; tableViewDevices.ReloadData(); if(row >= 0) { tableViewDevices.SelectRow(row, false); if(_items[row] == device) RefreshDeviceDetails(device); } }); }
public void RemoteNext(SyncDevice device) { RemoteCommand(device, "next"); }
public void SyncDevice(SyncDevice device) { }
public void RemoteShuffle(SyncDevice device) { RemoteCommand(device, "shuffle"); }
public void RefreshDevice(SyncDevice device) { }
public void RefreshDevice(SyncDevice device) { InvokeOnMainThread(delegate { lblTitle.StringValue = "Syncing Library With " + device.Name; Window.Title = "Syncing Library With " + device.Name; }); }
public void AddDevice(SyncDevice device) { bool isDeviceAdded = false; lock (_locker) { var deviceFound = _devices.FirstOrDefault(x => x.Url == device.Url); if (deviceFound == null) { isDeviceAdded = true; _devices.Add(device); OnStatusUpdated(string.Format("New device found: {0}", device.Name)); } } if(isDeviceAdded) OnDeviceAdded(device); }
public void RefreshDevice(SyncDevice device) { RunOnUiThread(() => { ActionBar.Title = "Syncing Library With " + device.Name; }); }
public void NotifyAddedDevice(SyncDevice device) { }