예제 #1
0
 private string GenerateTestDeviceXML(string deviceName)
 {
     var testDevice = new SyncDevice();
     testDevice.Name = deviceName;
     testDevice.SyncVersionId = SyncListenerService.SyncVersionId;
     return XmlSerialization.Serialize<SyncDevice>(testDevice);
 }            
예제 #2
0
 public void RefreshDevice(SyncDevice device)
 {
     Gtk.Application.Invoke(delegate{
         Title = "Syncing library with " + device.Name;
         lblTitle.Text = "Syncing library with " + device.Name;
     });
 }
예제 #3
0
        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);
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
 public void RemoveDevice(SyncDevice device)
 {
     lock (_locker)
     {
         _devices.Remove(device);
     }
     OnDeviceRemoved(device);
 }
예제 #6
0
		public void NotifyRemovedDevice(SyncDevice device)
		{
		}
예제 #7
0
 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);
 }
예제 #8
0
 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);
     });
 }
예제 #9
0
 public void RemoteRepeat(SyncDevice device)
 {
     RemoteCommand(device, "repeat");
 }
예제 #10
0
 public void RemotePrevious(SyncDevice device)
 {
     RemoteCommand(device, "previous");
 }
예제 #11
0
 public void RemotePause(SyncDevice device)
 {
     RemoteCommand(device, "pause");
 }
예제 #12
0
 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;
 }
예제 #13
0
 public override ISyncMenuView CreateSyncMenuView(SyncDevice device)
 {
     ISyncMenuView view = null;
     using (var pool = new NSAutoreleasePool())
     {
         pool.InvokeOnMainThread(delegate {
             view = base.CreateSyncMenuView(device);
         });
     }
     return view;
 }
예제 #14
0
 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);
 }
예제 #15
0
        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);
        }
예제 #16
0
        public void SyncDevice(SyncDevice device)
        {
            InvokeOnMainThread(() => {

            });
        }
예제 #17
0
		public void NotifyUpdatedDevice(SyncDevice device)
		{
		}
예제 #18
0
        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));
        }
예제 #19
0
 public void RemotePlay(SyncDevice device)
 {
     RemoteCommand(device, "play");
 }
예제 #20
0
        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);
                }
            });
        }
예제 #21
0
 public void RemoteStop(SyncDevice device)
 {
     RemoteCommand(device, "stop");
 }
예제 #22
0
 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);
         }
     });
 }
예제 #23
0
 public void RemoteNext(SyncDevice device)
 {
     RemoteCommand(device, "next");
 }
예제 #24
0
 public void SyncDevice(SyncDevice device)
 {
 }
예제 #25
0
 public void RemoteShuffle(SyncDevice device)
 {
     RemoteCommand(device, "shuffle");
 }
예제 #26
0
 public void RefreshDevice(SyncDevice device)
 {
 }
예제 #27
0
 public void RefreshDevice(SyncDevice device)
 {
     InvokeOnMainThread(delegate {
         lblTitle.StringValue = "Syncing Library With " + device.Name;
         Window.Title = "Syncing Library With " + device.Name;
     });
 }
예제 #28
0
        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);
        }
예제 #29
0
 public void RefreshDevice(SyncDevice device)
 {
     RunOnUiThread(() =>
     {
         ActionBar.Title = "Syncing Library With " + device.Name;
     });
 }
예제 #30
0
		public void NotifyAddedDevice(SyncDevice device)
		{
		}