Ejemplo n.º 1
0
        private void MoveAppToDeviceInternal(IAppItemViewModel app, DeviceViewModel dev)
        {
            var searchId = dev?.Id;

            if (dev == null)
            {
                searchId = _deviceManager.Default.Id;
            }

            try
            {
                DeviceViewModel oldDevice = AllDevices.First(d => d.Apps.Contains(app));
                DeviceViewModel newDevice = AllDevices.First(d => searchId == d.Id);

                bool isLogicallyMovingDevices = (oldDevice != newDevice);

                var tempApp = new TemporaryAppItemViewModel(this, _deviceManager, app);

                app.MoveToDevice(dev?.Id, hide: isLogicallyMovingDevices);

                // Update the UI if the device logically changed places.
                if (isLogicallyMovingDevices)
                {
                    oldDevice.AppLeavingFromThisDevice(app);
                    newDevice.AppMovingToThisDevice(tempApp);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"{ex}");
            }
        }
Ejemplo n.º 2
0
        public void AppVirtuallMovingToThisDevice(TemporaryAppItemViewModel app)
        {
            app.Expired += App_Expired;

            foreach (var childApp in app.ChildApps)
            {
                _device.UnhideSessionsForProcessId(childApp.ProcessId);
            }

            bool hasExistingAppGroup = false;

            foreach (var a in Apps)
            {
                if (a.DoesGroupWith(app))
                {
                    hasExistingAppGroup = true;
                    break;
                }
            }

            if (!hasExistingAppGroup)
            {
                // Add a fake app entry.
                Apps.AddSorted(app, AppItemViewModel.CompareByExeName);
            }
        }
Ejemplo n.º 3
0
        private void MoveAppToDeviceInternal(IAppItemViewModel app, DeviceViewModel dev)
        {
            var searchId = dev?.Id;

            if (dev == null)
            {
                searchId = _deviceManager.DefaultPlaybackDevice.Id;
            }
            DeviceViewModel oldDevice = AllDevices.First(d => d.Apps.Contains(app));
            DeviceViewModel newDevice = AllDevices.First(d => searchId == d.Id);

            try
            {
                bool isLogicallyMovingDevices = (oldDevice != newDevice);

                var tempApp = new TemporaryAppItemViewModel(app);

                app.MoveToDevice(dev?.Id, hide: isLogicallyMovingDevices);

                // Update the UI if the device logically changed places.
                if (isLogicallyMovingDevices)
                {
                    oldDevice.AppVirtuallyLeavingFromThisDevice(app);
                    newDevice.AppVirtuallMovingToThisDevice(tempApp);
                }
            }
            catch (Exception ex)
            {
                AppTrace.LogWarning(ex);
            }
        }