protected override void OnCreate(Bundle bundle) { AndroidEnvironment.UnhandledExceptionRaiser += OnUnhandledEception; TaskScheduler.UnobservedTaskException += OnUnhandledTaskException; base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); Hub.Navigator = new AndroidNavigator(this); var vm = new TimesheetsViewModel(Hub.ApiClient, Hub.Navigator); ListView.Bind(this, vm.Timesheets, t => t.Name); ListView.BindItemSelected(vm.Timesheets, vm.TimesheetSelectedCommand); FindViewById <Button>(Resource.Id.refreshItems).Bind(vm.Timesheets.RefreshCommand); //Initiate the OAuth2 authentication process: var authenticator = new Xamarin.Auth.WindowsAzureOAuth2Authenticator( "https://login.windows.net/<your tenant id>", "<client app id>", "<api / resource uri>", new Uri("<client redirect uri>")); authenticator.Completed += AuthenticatorOnCompleted; var activity = authenticator.GetUI(this); StartActivity(activity); }
public ListView CreateListViewBinding(SerializedObject serializedObject) { var listView = new ListView(); listView.Bind(serializedObject); return(listView); }
private void UpdateLobbies(bool focus = true) { list.Bind(items); if (items.Count == 0) { selectedMenuItem = null; noLobbiesMessage.gameObject.SetActive(value: true); if (lobbySelectMenuOptions != null && selectedMenuItem != null) { showJoinText = selectedMenuItem.IsActive(); } else { showJoinText = false; } hostButton.Select(); LevelInformationBoxEnabled(enabled: false); } else { noLobbiesMessage.gameObject.SetActive(value: false); if (focus) { list.FocusItem(0); } } }
public void InitUI() { //Bind Project List SerializedObject so = new SerializedObject(sceneContainer); projectList = rootVisualElement.Q <ListView>("ProjectList"); projectList.makeItem = this.MakeProjectEle; projectList.bindingPath = "projects"; projectList.bindItem = this.BindProjectList; projectList.itemHeight = 50; projectList.Bind(so); projectList.onSelectionChanged += this.OnProjectListItemSelectionChange; projectList.Refresh(); addProjectButton = rootVisualElement.Q <Button>("addProjectButton"); addProjectButton.clicked += this.OnAddProjectButtonClick; //deleteProjectButton = rootVisualElement.Q<Button>("DeleteProjectButton"); //deleteProjectButton.clicked += this.OnDeleteProjectButtonClick; playButton = rootVisualElement.Q <Button>("PlayButton"); playButton.clicked += () => { this.StartVideo(false); }; recordButton = rootVisualElement.Q <Button>("RecordButton"); recordButton.clicked += () => { this.StartVideo(true); };// this.OnRecordButtonClicked; openFolderButton = rootVisualElement.Q <Button>("openFolderButton"); openFolderButton.clicked += this.OnOpenFolderButtonClicked; setLayoutButton = rootVisualElement.Q <Button>("setLayoutButton"); setLayoutButton.clicked += this.OnSetLayoutButtonClicked; var VideoClipScrollView = rootVisualElement.Q <ScrollView>("VideoClipScrollView"); var rightScroller = rootVisualElement.Q <VisualElement>("ScrollScrollerRight"); rightScroller.RegisterCallback <MouseMoveEvent>((MouseMoveEvent evt) => { VideoClipScrollView.scrollOffset = new Vector2(VideoClipScrollView.scrollOffset.x + 10f, VideoClipScrollView.scrollOffset.y); }); var leftScroller = rootVisualElement.Q <VisualElement>("ScrollScrollerLeft"); leftScroller.RegisterCallback <MouseMoveEvent>((MouseMoveEvent evt) => { VideoClipScrollView.scrollOffset = new Vector2(VideoClipScrollView.scrollOffset.x - 10f, VideoClipScrollView.scrollOffset.y); }); }
VisualElement ConfigureListView(ListView listView, SerializedProperty property) { var propertyCopy = property.Copy(); listView.reorderMode = ListViewReorderMode.Animated; listView.showBorder = true; listView.showAddRemoveFooter = true; listView.showBoundCollectionSize = true; listView.showFoldoutHeader = true; listView.headerTitle = string.IsNullOrEmpty(label) ? propertyCopy.localizedDisplayName : label; listView.virtualizationMethod = CollectionVirtualizationMethod.DynamicHeight; listView.userData = propertyCopy; listView.showAlternatingRowBackgrounds = AlternatingRowBackground.None; listView.bindingPath = property.propertyPath; listView.viewDataKey = property.propertyPath; listView.name = "unity-list-" + property.propertyPath; listView.Bind(property.serializedObject); return(listView); }
public override void OnGotFocus() { base.OnGotFocus(); CustomizationController.instance.cameraController.FocusPart(part); characterTitle.SetActive(part == WorkshopItemType.ModelFull); headTitle.SetActive(part == WorkshopItemType.ModelHead); upperBodyTitle.SetActive(part == WorkshopItemType.ModelUpperBody); lowerBodyTitle.SetActive(part == WorkshopItemType.ModelLowerBody); list.onSelect = OnSelect; list.onPointerClick = OnPointerClick; list.onSubmit = OnSubmit; selectedItem = null; partBackup = CustomizationController.instance.GetPart(part); RagdollModelMetadata ragdollModelMetadata = null; List <RagdollModelMetadata> partRepository = WorkshopRepository.instance.GetPartRepository(part); for (int i = 0; i < partRepository.Count; i++) { if (MatchesPart(partBackup, partRepository[i])) { selectedItem = partRepository[i]; } if (RagdollPresetPartMetadata.IsEmpty(partRepository[i].folder)) { ragdollModelMetadata = partRepository[i]; } } if (selectedItem == null) { selectedItem = ragdollModelMetadata; } int num = partRepository.IndexOf(selectedItem); list.Bind(partRepository); if (num >= 0) { list.FocusItem(num); } PageLeftButton.SetActive(list.isCarousel); PageRightButton.SetActive(list.isCarousel); }
public override void OnGotFocus() { base.OnGotFocus(); if (deleteSelectedOnLoad) { deleteSelectedOnLoad = false; CustomizationController.instance.DeletePreset(selectedItem); dontReload = true; int num = items.IndexOf(selectedItem); items.Remove(selectedItem); if (num >= items.Count) { num = items.Count - 1; } if (items.Count > 0) { selectedItem = items[num]; } else { selectedItem = null; } if (mode == CustomizationPresetMenuMode.Save && items.Count < 128 && (items.Count < 1 || items[items.Count - 1] != null)) { items.Add(null); } } bool flag = true; if (!flag && showSubscribed) { showSubscribed = false; } showSubscribedButton.SetActive(mode == CustomizationPresetMenuMode.Load && !showSubscribed && flag); loadMyTitle.SetActive(mode == CustomizationPresetMenuMode.Load && !showSubscribed); bool flag2 = mode == CustomizationPresetMenuMode.Load && showSubscribed; showMyButton.SetActive(flag2); loadSubscribedTitle.SetActive(flag2); openWorkshopButton.SetActive(flag2); InCustomizationPresetMenu = flag2; saveTitle.SetActive(mode != CustomizationPresetMenuMode.Load); noSubscriptionsMessage.SetActive(value: false); offlineMessage.SetActive(value: false); noPresetsMessage.SetActive(value: false); list.onSelect = OnSelect; list.onPointerClick = OnPointerClick; list.onSubmit = OnSubmit; bool flag3 = false; flag3 = SteamUser.BLoggedOn(); if (!dontReload) { if (mode == CustomizationPresetMenuMode.Load) { WorkshopRepository.instance.ReloadLocalPresets(); if (!WorkshopRepository.instance.ReloadSubscriptions()) { } items = new List <RagdollPresetMetadata>(); if (showSubscribed) { if (flag3) { items.AddRange(WorkshopRepository.instance.presetRepo.BySource(WorkshopItemSource.Subscription)); } } else { items.AddRange(WorkshopRepository.instance.presetRepo.BySource(WorkshopItemSource.LocalWorkshop)); } } else { WorkshopRepository.instance.ReloadLocalPresets(); WorkshopRepository.instance.ReloadSubscriptions(); items = new List <RagdollPresetMetadata>(); items.AddRange(WorkshopRepository.instance.presetRepo.BySource(WorkshopItemSource.LocalWorkshop)); if (items.Count < 128) { items.Add(null); } } selectedItem = null; string skinPresetReference = CustomizationController.instance.GetSkinPresetReference(); for (int i = 0; i < items.Count; i++) { if (items[i] != null && items[i].folder.Equals(skinPresetReference)) { selectedItem = items[i]; } } } CustomizationController.instance.cameraController.FocusCharacterModel(); dontReload = false; if (items.Count == 0) { list.Bind(items); if (!flag3) { offlineMessage.SetActive(value: true); } else if (showSubscribed) { noSubscriptionsMessage.SetActive(value: true); } else { noPresetsMessage.SetActive(value: true); } BindButtons(); EventSystem.current.SetSelectedGameObject(GetComponentInChildren <Selectable>().gameObject); } else { list.Bind(items); int num2 = items.IndexOf(selectedItem); if (num2 < 0) { num2 = 0; } list.FocusItem(num2); } PageLeftButton.SetActive(list.isCarousel); PageRightButton.SetActive(list.isCarousel); }