public void OnDeviceMoved(DeviceModel movedDev) { if (GetSpaceStatus() != SpaceStatus.Sorting) { return; } List <DeviceModel> dms = DeviceModelCollection.FindAll(d => d.Plugged == true && d.Sync == true); foreach (var dm in dms) { if (movedDev.Equals(dm)) { continue; } if (ControlHelper.IsPiling(movedDev.PixelLeft, movedDev.PixelWidth, dm.PixelLeft, dm.PixelWidth) && ControlHelper.IsPiling(movedDev.PixelTop, movedDev.PixelHeight, dm.PixelTop, dm.PixelHeight)) { dm.VisualState = "Hover"; } else { dm.VisualState = "Normal"; } } }
protected override void LoadFileContent() { DeviceModel deviceModel = FileBusiness.CreateInstance().LoadDeviceModel(filePath); GeneralOtherViewBusiness.SetLaunchpadStyle(mLaunchpad, deviceModel); if (deviceModel.Equals("Launchpad Pro")) { cbDeviceType.SelectedIndex = 0; } tbBackGround.Text = deviceModel.DeviceBackGroundStr; tbBackGround.Background = deviceModel.DeviceBackGround; tbDeviceSize.Text = deviceModel.DeviceSize.ToString(); if (deviceModel.IsMembrane) { cbMembrane.IsChecked = true; } }
public bool IsPiling(DeviceModel testDev) { List <DeviceModel> dms = DeviceModelCollection.FindAll(d => d.Plugged == true && d.Sync == true); foreach (var dm in dms) { if (testDev.Equals(dm)) { continue; } if (ControlHelper.IsPiling(testDev.PixelLeft, testDev.PixelWidth, dm.PixelLeft, dm.PixelWidth) && ControlHelper.IsPiling(testDev.PixelTop, testDev.PixelHeight, dm.PixelTop, dm.PixelHeight)) { return(true); } } return(false); }
public void DeleteOverlappingTempDevice(DeviceModel testDev) { List <DeviceModel> tempDevices = DeviceModelCollection.FindAll(d => d.Plugged == false); foreach (var dm in tempDevices) { if (testDev.Equals(dm)) { continue; } if (ControlHelper.IsPiling(testDev.PixelLeft, testDev.PixelWidth, dm.PixelLeft, dm.PixelWidth) && ControlHelper.IsPiling(testDev.PixelTop, testDev.PixelHeight, dm.PixelTop, dm.PixelHeight)) { DeviceModelCollection.Remove(dm); LayerPage.Self.ClearDeviceData(dm.Type); } } }