Пример #1
0
 public eval_p(eval_y A_0)
 {
     this.eval_h = A_0;
     this.eval_a();
     this.eval_u.Visible = false;
     this.eval_t.TextChanged += new EventHandler(this.eval_g);
     this.eval_i = new ListView();
     this.eval_i.View = View.Details;
     this.eval_i.Columns.Add("part", 80, HorizontalAlignment.Left);
     this.eval_i.Columns.Add("current", 89, HorizontalAlignment.Left);
     this.eval_i.Columns.Add("latest", 89, HorizontalAlignment.Left);
     this.eval_i.Columns.Add("expires", 70, HorizontalAlignment.Left);
     this.eval_i.Columns.Add("license", 58, HorizontalAlignment.Left);
     this.eval_i.SetBounds(5, 15, this.eval_n.Width - 16 - this.eval_o.Width, this.eval_n.ClientSize.Height - 20);
     this.eval_i.FullRowSelect = true;
     this.eval_i.MultiSelect = true;
     this.eval_i.HideSelection = false;
     this.eval_n.Controls.Add(this.eval_i);
     this.eval_j = new ListView();
     this.eval_j.View = View.Details;
     this.eval_j.FullRowSelect = true;
     this.eval_j.Columns.Add("part", 80, HorizontalAlignment.Left);
     this.eval_j.Columns.Add("price", 52, HorizontalAlignment.Left);
     this.eval_j.Columns.Add("info", 200, HorizontalAlignment.Left);
     this.eval_j.Columns.Add("current", 88, HorizontalAlignment.Left);
     this.eval_j.SetBounds(5, 15, this.eval_l.Width - 16 - this.eval_o.Width, this.eval_l.ClientSize.Height - 50);
     this.eval_l.Controls.Add(this.eval_j);
     this.eval_a(true);
     this.eval_j.SelectedIndexChanged += new EventHandler(this.eval_e);
     this.eval_q.Enabled = false;
     this.eval_s.TextChanged += new EventHandler(this.eval_g);
     this.eval_s.Enabled = false;
 }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            // Create your application here
            SetTitle (Resource.String.title_so);
            SetContentView (Resource.Layout.ListView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights = Utility.GetAccessRights (pathToDatabase);

            populate (listData);
            apara =  DataHelper.GetAdPara (pathToDatabase);
            listView = FindViewById<ListView> (Resource.Id.feedList);
            Button butNew= FindViewById<Button> (Resource.Id.butnewInv);
            butNew.Click += butCreateNewInv;
            Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack);
            butInvBack.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(MainActivity));
            };

            listView.ItemClick += OnListItemClick;
            listView.ItemLongClick += OnListItemLongClick;
            //listView.Adapter = new CusotmListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;
            listView.Adapter = new GenericListAdapter<SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #3
0
        private StackLayout BuildContent()
        {
            var layout = new StackLayout ();

            _list = new ListView {
                //VerticalOptions = LayoutOptions.FillAndExpand,
                ItemTemplate = new DataTemplate(typeof(ListItemView)),
                RowHeight = 90,
            };

            _list.ItemTapped +=	(sender, e) => {
                var todoListPage = new TodoListPage ();
                Navigation.PushAsync (todoListPage);
            };

            _list.ItemSelected += (sender, e) => {
                var todoListPage = new TodoListPage ();
                Navigation.PushAsync (todoListPage);
            };

            _list.SetBinding(ListView.ItemsSourceProperty, "Data");

            layout.Children.Add (_list);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            layout.BackgroundColor = Color.Yellow;

            return layout;
        }
Пример #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.Main);

            setupParent(FindViewById<LinearLayout>(Resource.Id.mainLayout));
            listViewGoodsMain = FindViewById<ListView>(Resource.Id.listViewGoodsMain);

            goodsItemsList = new List<GoodsItem>();
            goodsItemsList.Add(new GoodsItem() { Id = 1, Quantity = 1, Name = "Пельмешки"});
            goodsItemsList.Add(new GoodsItem() { Id = 2, Quantity = 2, Name = "Сосисоны" });

            myGoodsItemsAdapter = new GoodsItemsAdapter(this, goodsItemsList);
            listViewGoodsMain.Adapter = myGoodsItemsAdapter;

            var emptyText = FindViewById<TextView>(Resource.Id.textViewGoodsListEmpty);
            listViewGoodsMain.EmptyView = emptyText;

            editTextNewProduct = FindViewById<EditText>(Resource.Id.EditTextNewProduct);
            editTextNewProduct.EditorAction += editTextNewProduct_EditorAction;
            editTextNewProduct.Click += editTextNewProduct_Click;

            checkBoxRed = FindViewById<CheckBox>(Resource.Id.checkBoxRed);
            checkBoxRed.Click += checkBoxRed_Click;
        }
Пример #5
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			// Use this to return your custom view for this Fragment
			// return inflater.Inflate(Resource.Layout.YourFragment, container, false);

			//	  Lich hoc theo HK
			var rootView = inflater.Inflate (Resource.Layout.LichHoc_HK, container, false);
			isfirst = true;
			listView_HK = rootView.FindViewById<ListView> (Resource.Id.listLH);
			lbl_HK = rootView.FindViewById<TextView> (Resource.Id.lbl_HK_LH);
			lbl_NH = rootView.FindViewById<TextView> (Resource.Id.lbl_NH_LH);
			progress = rootView.FindViewById<ProgressBar> (Resource.Id.progressLH);
			linear = rootView.FindViewById<LinearLayout>(Resource.Id.linear_HK_LH);
			linearLH = rootView.FindViewById<LinearLayout>(Resource.Id.linearLH);
			txtNotify = rootView.FindViewById<TextView>(Resource.Id.txtNotify_LT_HK);
		//	radioGroup = rootView.FindViewById<RadioGroup>(Resource.Id.radioGroup1);
		    bundle=this.Arguments;
			check = bundle.GetBoolean ("Remind");
			autoupdate = bundle.GetBoolean ("AutoUpdateData");

			//load data

			LoadData_HK ();
		
			// row click
			listView_HK.ItemLongClick += listView_ItemClick;
						

			return rootView;
		}
Пример #6
0
		private async Task Init ()
		{
			_conferencesListView = new ListView { 
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
			};

			var cell = new DataTemplate (typeof(TextCell));
			cell.SetBinding (TextCell.TextProperty, "Name");
			cell.SetBinding (TextCell.DetailProperty, new Binding (path: "Start", stringFormat: "{0:MM/dd/yyyy}"));

			_conferencesListView.ItemTemplate = cell;

			var viewModel = new ConferencesViewModel ();
			await viewModel.GetConferences ();
			_conferencesListView.ItemsSource = viewModel.Conferences;

			this.Content = new StackLayout {
				VerticalOptions = LayoutOptions.FillAndExpand,
				Padding = new Thickness (
					left: 0, 
					right: 0, 
					bottom: 0, 
					top: Device.OnPlatform (iOS: 20, Android: 0, WinPhone: 0)),
				Children = { 
					_conferencesListView 
				}
			};
		}
Пример #7
0
        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            var url = _adapter.GetMapUrl (position);
            var intent = new Intent (Intent.ActionView, Uri.Parse(url));

            StartActivity (intent);
        }
Пример #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE;
            SetContentView (Resource.Layout.ItemCodeList);
            populate (listData);
            listView = FindViewById<ListView> (Resource.Id.ICodeList);
            txtSearch= FindViewById<EditText > (Resource.Id.txtSearch);

            Button butInvBack= FindViewById<Button> (Resource.Id.butICodeBack);
            butInvBack.Click += (object sender, EventArgs e) => {
                base.OnBackPressed();
            };
            viewdlg = SetViewDelegate;
            //PerformFilteringDlg filterDlg=PerformFiltering;
            //listView.Adapter = new CusotmMasterItemListAdapter(this, listData);

            adapter = new GenericListAdapter<Item> (this, listData, Resource.Layout.ItemCodeDtlList, viewdlg);
            listView.Adapter = adapter;
            listView.ItemClick+= ListView_Click;
            txtSearch.TextChanged+= TxtSearch_TextChanged;
        }
Пример #9
0
		public Issue1875()
		{
			Button loadData = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand };
			ListView mainList = new ListView {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			mainList.SetBinding (ListView.ItemsSourceProperty, "Items");

			_viewModel = new MainViewModel ();
			BindingContext = _viewModel;
			loadData.Clicked += async (sender, e) => {
				await LoadData ();
			};

			mainList.ItemAppearing += OnItemAppearing;

			Content = new StackLayout {
				Children = {
					loadData,
					mainList
				}
			};
		}
Пример #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            // 画面要素取得
            btnAddMemo = FindViewById<Button>(Resource.Id.add_memo_btn);
            btnDeleteAllMemo = FindViewById<Button>(Resource.Id.delete_all_btn);
            memoList = FindViewById<ListView>(Resource.Id.memo_list);

            memos = new List<Memo>();

            // ボタンクリックイベント
            btnAddMemo.Click += (sender, e) =>
            {
                addMemos();
                memoListAdapter = new MemoListAdapter(this, memos);
                memoList.Adapter = memoListAdapter;
            };

            btnDeleteAllMemo.Click += (sender, e) =>
            {
                memos = new List<Memo>();
                memoListAdapter = new MemoListAdapter(this, memos);
                memoList.Adapter = memoListAdapter;
            };
        }
Пример #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }

            SetTitle (Resource.String.title_cash);

            // Create your application here
            SetContentView (Resource.Layout.ListView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            COMPCODE = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            rights = Utility.GetAccessRights (pathToDatabase);
            populate (listData);
            apara =  DataHelper.GetAdPara (pathToDatabase);
            listView = FindViewById<ListView> (Resource.Id.feedList);
            Button butNew= FindViewById<Button> (Resource.Id.butnewInv);
            butNew.Visibility = ViewStates.Gone;
            //butNew.Click += butCreateNewInv;
            Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack);
            butInvBack.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(POSSalesActivity));
            };

            //if (!rights.InvAllowAdd)
            //	butNew.Enabled = false;

            listView.ItemClick += OnListItemLongClick;//OnListItemClick;
            listView.ItemLongClick += ListView_ItemLongClick;
            //listView.Adapter = new CusotmListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;
            listView.Adapter = new GenericListAdapter<Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #12
0
		protected void CreateMenuPage(string menuPageTitle)
		{
			var _menuPage = new ContentPage ();
			_menuPage.Title = menuPageTitle;
			var listView = new ListView();

			listView.ItemsSource = new string[] { "Contacts", "Quotes", "Modal Demo" };

			listView.ItemSelected += async (sender, args) =>
			{

				switch ((string)args.SelectedItem) {
				case "Contacts":
					_tabbedNavigationPage.CurrentPage = _contactsPage;
					break;
				case "Quotes":
					_tabbedNavigationPage.CurrentPage = _quotesPage;
					break;
				case "Modal Demo":
                    var modalPage = FreshPageModelResolver.ResolvePageModel<ModalPageModel>();
					await PushPage(modalPage, null, true);
					break;
				default:
				break;
				}

				IsPresented = false;
			};

			_menuPage.Content = listView;

			Master = new NavigationPage(_menuPage) { Title = "Menu" };
		}
		public LoadResourceXml ()
		{
			#region How to load an XML file embedded resource
			var assembly = typeof(LoadResourceText).GetTypeInfo().Assembly;
			Stream stream = assembly.GetManifestResourceStream("WorkingWithFiles.PCLXmlResource.xml");

			List<Monkey> monkeys;
			using (var reader = new System.IO.StreamReader (stream)) {
				var serializer = new XmlSerializer(typeof(List<Monkey>));
				monkeys = (List<Monkey>)serializer.Deserialize(reader);
			}
			#endregion

			var listView = new ListView ();
			listView.ItemsSource = monkeys;


			Content = new StackLayout {
				Padding = new Thickness (0, 20, 0, 0),
				VerticalOptions = LayoutOptions.StartAndExpand,
				Children = {
					new Label { Text = "Embedded Resource XML File (PCL)", 
						FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
						FontAttributes = FontAttributes.Bold
					}, listView
				}
			};

			// NOTE: use for debugging, not in released app code!
			//foreach (var res in assembly.GetManifestResourceNames()) 
			//	System.Diagnostics.Debug.WriteLine("found resource: " + res);
		}
Пример #14
0
		public MenuPage ()
		{
			Icon = "settings.png";
			Title = "Gráficos"; // The Title property must be set.
			BackgroundColor = Color.FromHex ("333333");

			Menu = new MenuListView ();

			var menuLabel = new ContentView {
				Padding = new Thickness (10, 36, 0, 5),
				Content = new Label {
					TextColor = Color.FromHex ("AAAAAA"),
					Text = "Gráficos", 
				}
			};

			var layout = new StackLayout { 
				Spacing = 0, 
				VerticalOptions = LayoutOptions.FillAndExpand
			};
			layout.Children.Add (menuLabel);
			layout.Children.Add (Menu);

			Content = layout;
		}
		public WithoutDataTemplatePageCS ()
		{
			Title = "Without a Data Template";
			Icon = "csharp.png";

			var people = new List<Person> {
				new Person ("Steve", 21, "USA"),
				new Person ("John", 37, "USA"),
				new Person ("Tom", 42, "UK"),
				new Person ("Lucas", 29, "Germany"),
				new Person ("Tariq", 39, "UK"),
				new Person ("Jane", 30, "USA")
			};

			var listView = new ListView { ItemsSource = people };

			Content = new StackLayout { 
				Padding = new Thickness (0, 20, 0, 0),
				Children = {
					new Label {
						Text = "ListView without a Data Template",
						FontAttributes = FontAttributes.Bold,
						HorizontalOptions = LayoutOptions.Center
					},
					listView
				}
			};
		}
Пример #16
0
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			/*
			// Set our view from the "main" layout resource
			SetContentView(Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button>(Resource.Id.MyButton);

			button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
			*/

			RootElement re = new MonoMobileDialogUI().CreateDialogUI();

			// mc++: equivalent to MonoTouchDialog.DialogViewController
			DialogAdapter da = new DialogAdapter(this, re);
			// mc++: equivalent to MonoTouch UINavigationController
			ListView lv = new ListView(this) { Adapter = da };

			// mc++: equivalent to MonoTouch Window
			// Activity.SetContentView ~ Window.RootViewController	iOS 5+
			// Activity.SetContentView ~ Window.AddSubview			iOS other
			SetContentView(lv);

		}
		void IOptionsPanel.Initialize (OptionsDialog dialog, object dataObject)
		{
			this.ExpandHorizontal = true;
			this.ExpandVertical = true;
			this.HeightRequest = 400;
			list = new ListView ();
			store = new ListStore (language, completeOnSpace, completeOnChars);

			var languageColumn = list.Columns.Add (GettextCatalog.GetString ("Language"), language);
			languageColumn.CanResize = true;

			var checkBoxCellView = new CheckBoxCellView (completeOnSpace);
			checkBoxCellView.Editable = true;
			var completeOnSpaceColumn = list.Columns.Add (GettextCatalog.GetString ("Complete on space"), checkBoxCellView);
			completeOnSpaceColumn.CanResize = true;

			var textCellView = new TextCellView (completeOnChars);
			textCellView.Editable = true;
			var doNotCompleteOnColumn = list.Columns.Add (GettextCatalog.GetString ("Do complete on"), textCellView);
			doNotCompleteOnColumn.CanResize = true;
			list.DataSource = store;
			PackStart (list, true, true);

			var hbox = new HBox ();
			var button = new Button ("Reset to default");
			button.Clicked += delegate {
				FillStore (CompletionCharacters.GetDefaultCompletionCharacters ());
			};	
			hbox.PackEnd (button, false, false);
			PackEnd (hbox, false, true);
			FillStore (CompletionCharacters.GetCompletionCharacters ());
		}
    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
      var root = inflater.Inflate(Resource.Layout.fragment_contacts, container, false);

      refresher = root.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
      refresher.SetColorScheme(Resource.Color.blue);

      refresher.Refresh += async delegate
      {
        if (viewModel.IsBusy)
          return;

        await viewModel.GetContactsAsync();
        Activity.RunOnUiThread(() => { ((BaseAdapter)listView.Adapter).NotifyDataSetChanged(); });

      };

      viewModel.PropertyChanged += PropertyChanged;

      listView = root.FindViewById<ListView>(Resource.Id.list);

      listView.Adapter = new ContactAdapter(Activity, viewModel);

      listView.ItemLongClick += ListViewItemLongClick;
      listView.ItemClick += ListViewItemClick;
      var fab = root.FindViewById<FloatingActionButton>(Resource.Id.fab);
      fab.AttachToListView(listView);
      fab.Click += (sender, args) =>
      {
        ContactDetailsActivity.ViewModel = null;
        var intent = new Intent(Activity, typeof(ContactDetailsActivity));
        StartActivity(intent);
      };
      return root;
    }
Пример #19
0
        public RssFeedView2()
        {
            this.viewModel = new RssFeedViewModel();
            this.BindingContext = viewModel;
            this.Title = "Rss Feed";

            var refresh = new ToolbarItem(){ Command = viewModel.ReloadCommand, Name = "Reload", Priority = 0 };
            ToolbarItems.Add(refresh);

            var stack = new StackLayout(){ Orientation = StackOrientation.Vertical };
            var activity = new ActivityIndicator(){ Color = Color.Blue, IsEnabled = true };
            activity.SetBinding(ActivityIndicator.IsVisibleProperty, "ShowActivityIndicator");
            activity.SetBinding(ActivityIndicator.IsRunningProperty, "ShowActivityIndicator");

            stack.Children.Add(activity);

            var listview = new ListView();
            listview.ItemsSource = viewModel.Records;
            var cell = new DataTemplate(typeof(ImageCell));
            cell.SetBinding(ImageCell.TextProperty, "Title");
            cell.SetBinding(ImageCell.ImageSourceProperty, "Image");
            listview.ItemTemplate = cell;
            listview.ItemSelected += async (sender, e) => {
                await Navigation.PushAsync(new RssWebView((RssRecordViewModel)e.SelectedItem));
                listview.SelectedItem = null;
            };

            stack.Children.Add(listview);

            Content = stack;
        }
Пример #20
0
        public MyMasterDetail()
        {
            Label header = new Label
            {
                Text = "MasterDetailPage",
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };
            string[] myList = new string[10];
            myList[0] = "Content Demo";
            //myList [1] = "Tabbed Demo";
            //myList[2] = "Carousel Demo";
            ListView listView = new ListView
            {
                ItemsSource = myList
            };
            this.Master = new ContentPage
            {
                Title = header.Text,
                Content = new StackLayout
                {
                    Children =
                    {
                        header,
                        listView

                    }
                    }
            };
            this.Detail = new NavigationPage(new HomePage());
        }
Пример #21
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            // Create your application here
            SetContentView (Resource.Layout.ListView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE;
            Utility.GetDateRange (ref sdate,ref edate);
            populate (listData);
            apara =  DataHelper.GetAdPara (pathToDatabase,compCode,branchCode);
            listView = FindViewById<ListView> (Resource.Id.feedList);
            //			TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1);
            //			tlay.Visibility = ViewStates.Invisible;
            Button butNew= FindViewById<Button> (Resource.Id.butnewInv);
            butNew.Visibility = ViewStates.Invisible;
            Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack);
            butInvBack.Click+= (object sender, EventArgs e) => {
                StartActivity(typeof(TransListActivity));
            };

            listView.ItemClick += OnListItemClick;
            listView.ItemLongClick += OnListItemLongClick;
            //listView.Adapter = new CusotmListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;
            listView.Adapter = new GenericListAdapter<CNNote> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #22
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			mHandler = new Handler ();

			// Inflate our UI from its XML layout description.
			SetContentView (Resource.Layout.voice_recognition);

			// Get display items for later interaction
			Button speakButton = FindViewById <Button> (Resource.Id.btn_speak);

			mList = FindViewById <ListView> (Resource.Id.list);

			mSupportedLanguageView = FindViewById <Spinner> (Resource.Id.supported_languages);

			// Check to see if a recognition activity is present
			PackageManager pm = PackageManager;
			IList<ResolveInfo> activities = pm.QueryIntentActivities (new Intent (RecognizerIntent.ActionRecognizeSpeech), 0);

			if (activities.Count != 0)
				speakButton.Click += speakButton_Click;
			else {
				speakButton.Enabled = false;
				speakButton.Text = "Recognizer not present";
			}

			// Most of the applications do not have to handle the voice settings. If the application
			// does not require a recognition in a specific language (i.e., different from the system
			// locale), the application does not need to read the voice settings.
			RefreshVoiceSettings();
		}
Пример #23
0
        public MenuPrincipalPage()
        {
            List<MenuItem> data = new MenuListData();

            menus = new ListView();
            menus.ItemsSource = data;
            menus.VerticalOptions = LayoutOptions.FillAndExpand;
            menus.BackgroundColor = Color.Transparent;
            menus.SeparatorVisibility = SeparatorVisibility.None;
            menus.ItemTemplate = new DataTemplate(typeof(MenuViewCell));
            menus.ItemTapped += async (sender, e) => NavigateTo(e.Item as MenuItem);

            var mainLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.Transparent,
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness(10, 90, 10, 0),
                Children = { menus }
            };
            
            this.BackgroundColor = Colors._defaultColorFromHex;

            this.Content = mainLayout;
        }
        public override void OnListItemClick(ListView p0, View p1, int position, long p3)
        {
            Fragment newContent = null;
            switch (position)
            {
                case 0:
                    newContent = new ColorFragment(Resource.Color.red);
                    break;
                case 1:
                    newContent = new ColorFragment(Resource.Color.green);
                    break;
                case 2:
                    newContent = new ColorFragment(Resource.Color.blue);
                    break;
                case 3:
                    newContent = new ColorFragment(Resource.Color.white);
                    break;
                case 4:
                    newContent = new ColorFragment(Resource.Color.black);
                    break;
            }

            if (newContent != null)
                SwitchFragment(newContent);
        }
Пример #25
0
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			this.SetContentView(Resource.Layout.Main);

			var playButton = this.FindViewById<Button>(Resource.Id.PlayPauseButton);
			var stopButton = this.FindViewById<Button>(Resource.Id.StopButton);
			var searchView = this.FindViewById<SearchView>(Resource.Id.SearchView);
			this.listView = this.FindViewById<ListView>(Resource.Id.listView1);
			this.timeDisplay = this.FindViewById<TextView>(Resource.Id.TimeDisplay);
			this.adapter = new SongResultsAdapter(this, new Song[0]);
			this.player = new MediaPlayer();
			
			this.switcher = this.FindViewById<ViewSwitcher>(Resource.Id.ViewSwitcher);
			this.loadingMessage = this.FindViewById<TextView>(Resource.Id.LoadingMessage);
			
			playButton.Click += this.PlayButton_Click;
			stopButton.Click += this.StopButton_Click;
			searchView.QueryTextSubmit += this.SearchView_QueryTextSubmit;
			searchView.QueryTextChange += this.SearchView_QueryTextChange;
			this.listView.ItemClick += this.ListView_ItemClick;
			this.player.BufferingUpdate += this.Player_BufferingUpdate;
			this.player.Error += this.Player_Error;

			this.ShowListViewMessage("Write in the search box to start.");
		}
Пример #26
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// set our layout to be the home screen
			SetContentView(Resource.Layout.HomeScreen);

			//Find our controls
			taskListView = FindViewById<ListView> (Resource.Id.TaskList);
			addTaskButton = FindViewById<Button> (Resource.Id.AddButton);

			// wire up add task button handler
			if(addTaskButton != null) {
				addTaskButton.Click += (sender, e) => {
					StartActivity(typeof(TodoItemScreen));
				};
			}
			
			// wire up task click handler
			if(taskListView != null) {
				taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
					var taskDetails = new Intent (this, typeof (TodoItemScreen));
					taskDetails.PutExtra ("TaskID", tasks[e.Position].ID);
					StartActivity (taskDetails);
				};
			}
		}
Пример #27
0
        public IndividualListTest()
        {
            Title = "North Lakes";
            BackgroundColor = Color.White;

            listView = new ListView ();
            listView.ItemTemplate = new DataTemplate
                    (typeof (IndividualListCell));
            listView.ItemSelected += (sender, e) => {
                var itemSelected = (TapandGo.Data.ItemsListData)e.SelectedItem;
                //ListName = itemSelected.ListName;
               // ListName = TapandGo.Views.ShoppingListsTest.SelectedListName;
                var newPage = new TapandGo.Views.ListItemDetailPage();
                newPage.BindingContext = itemSelected;

                //((App)App.Current).ResumeAtTodoId = todoItem.ListName;
                //Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ID);
                Navigation.PushAsync(newPage);
                //((ListView)sender).SelectedItem = null;
            };

            var layout = new StackLayout();
            layout.Children.Add(listView);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            Content = layout;
        }
Пример #28
0
        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            var person = ((PeopleGroupsAdapter)ListAdapter).GetPerson (position);

            if (person != null)
                StartActivity (PersonActivity.CreateIntent (this, person));
        }
Пример #29
0
        public ContactsPage()
        {
            contactsList = new ListView();

            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "FirstName");
            cell.SetBinding(TextCell.DetailProperty, "LastName");

            contactsList.ItemTemplate = cell;

            contactsList.ItemSelected += (sender, args) =>
            {
                if (contactsList.SelectedItem == null)
                    return;

                var contact = contactsList.SelectedItem as Contact;

                Navigation.PushAsync(new ContactPage(contact));

                contactsList.SelectedItem = null;
            };

            Content = contactsList;
        }
Пример #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            comicListView = FindViewById<ListView>(Resource.Id.ComicList);
            comicListView.ChoiceMode = ChoiceMode.Multiple;
            comicListView.FastScrollEnabled = true;

            data = new ComicList (new CSVParser (Assets.Open ("Data/titles.csv")));

            // wire up task click handler
            if(comicListView != null) {
                comicListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    // Starting to think I should just serialize this
                    var comicDetails = new Intent (this, typeof (ComicDetailsActivity));
                    comicDetails.PutExtra("ComicName", data[e.Position].Name);
                    comicDetails.PutExtra("ComicDescription", data[e.Position].Description);
                    comicDetails.PutExtra("ComicPublisher", data[e.Position].Publisher);
                    comicDetails.PutExtra("ComicDate", data[e.Position].Date);
                    comicDetails.PutExtra("ID", data[e.Position].ID);
                    comicDetails.PutExtra("Favourite", data.IsFavourite(e.Position));
                    comicDetails.PutExtra("OtherComics", data.GetPublisherCount(data[e.Position].Publisher) - 1);
                    StartActivity (comicDetails);
                };
            }
        }
Пример #31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AutoCompleteView"/> class.
        /// </summary>
        public AutoCompleteView()
        {
            _availableSuggestions = new ObservableCollection <object>();
            _stkBase = new StackLayout();
            var innerLayout = new StackLayout();

            _entText = new Entry
            {
                HorizontalOptions = TextHorizontalOptions,
                VerticalOptions   = TextVerticalOptions,
                TextColor         = TextColor,
                BackgroundColor   = TextBackgroundColor
            };
            _btnSearch = new Button
            {
                VerticalOptions   = SearchVerticalOptions,
                HorizontalOptions = SearchHorizontalOptions,
                Text = SearchText
            };

            _lstSuggestions = new ListView
            {
                HeightRequest = SuggestionsHeightRequest,
                HasUnevenRows = true
            };

            innerLayout.Children.Add(_entText);
            //innerLayout.Children.Add(_btnSearch);
            _stkBase.Children.Add(innerLayout);
            _stkBase.Children.Add(_lstSuggestions);

            Content = _stkBase;


            _entText.TextChanged += (s, e) =>
            {
                Text = e.NewTextValue;
                OnTextChanged(e);
            };
            _btnSearch.Clicked += (s, e) =>
            {
                if (SearchCommand != null && SearchCommand.CanExecute(Text))
                {
                    SearchCommand.Execute(Text);
                }
            };
            _lstSuggestions.ItemSelected += (s, e) =>
            {
                _entText.Text = e.SelectedItem.ToString();

                _availableSuggestions.Clear();
                ShowHideListbox(false);
                OnSelectedItemChanged(e.SelectedItem);

                if (ExecuteOnSuggestionClick &&
                    SearchCommand != null &&
                    SearchCommand.CanExecute(Text))
                {
                    SearchCommand.Execute(e);
                }
            };
            ShowHideListbox(false);
            _lstSuggestions.ItemsSource = _availableSuggestions;
        }
Пример #32
0
        /// <summary>
        /// Demonstrates how to handle a row click
        /// </summary>
        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            var speakerName = adapter[position].Name;

            Toast.MakeText(this, "You selected the speaker " + speakerName + ".", ToastLength.Short).Show();
        }
Пример #33
0
        public SparkleSetup()
        {
            Controller.ShowWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Show();
                    Activate();
                    BringIntoView();
                });
            };

            Controller.HideWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Hide();
                });
            };

            Controller.ChangePageEvent += delegate(PageType type, string [] warnings) {
                Dispatcher.BeginInvoke((Action) delegate {
                    Reset();

                    switch (type)
                    {
                    case PageType.Setup: {
                        Header      = "Welcome to SparkleShare!";
                        Description = "First off, what's your name and email?\nThis information is only visible to team members.";

                        TextBlock name_label = new TextBlock()
                        {
                            Text          = "Full Name:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right,
                            FontWeight    = FontWeights.Bold
                        };

                        string name = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                        name        = name.Split("\\".ToCharArray()) [1];

                        TextBox name_box = new TextBox()
                        {
                            Text  = name,
                            Width = 175
                        };

                        TextBlock email_label = new TextBlock()
                        {
                            Text          = "Email:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right,
                            FontWeight    = FontWeights.Bold
                        };

                        TextBox email_box = new TextBox()
                        {
                            Width = 175
                        };


                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button continue_button = new Button()
                        {
                            Content   = "Continue",
                            IsEnabled = false
                        };


                        ContentCanvas.Children.Add(name_label);
                        Canvas.SetLeft(name_label, 180);
                        Canvas.SetTop(name_label, 200 + 3);

                        ContentCanvas.Children.Add(name_box);
                        Canvas.SetLeft(name_box, 340);
                        Canvas.SetTop(name_box, 200);

                        ContentCanvas.Children.Add(email_label);
                        Canvas.SetLeft(email_label, 180);
                        Canvas.SetTop(email_label, 230 + 3);

                        ContentCanvas.Children.Add(email_box);
                        Canvas.SetLeft(email_box, 340);
                        Canvas.SetTop(email_box, 230);

                        Buttons.Add(cancel_button);
                        Buttons.Add(continue_button);

                        name_box.Focus();
                        name_box.Select(name_box.Text.Length, 0);

                        Controller.UpdateSetupContinueButtonEvent += delegate(bool enabled) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    continue_button.IsEnabled = enabled;
                                });
                        };

                        name_box.TextChanged += delegate {
                            Controller.CheckSetupPage(name_box.Text, email_box.Text);
                        };

                        email_box.TextChanged += delegate {
                            Controller.CheckSetupPage(name_box.Text, email_box.Text);
                        };

                        cancel_button.Click += delegate {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    Program.UI.StatusIcon.Dispose();
                                    Controller.SetupPageCancelled();
                                });
                        };

                        continue_button.Click += delegate {
                            Controller.SetupPageCompleted(name_box.Text, email_box.Text);
                        };

                        Controller.CheckSetupPage(name_box.Text, email_box.Text);

                        break;
                    }

                    case PageType.Invite: {
                        Header      = "You've received an invite!";
                        Description = "Do you want to add this project to SparkleShare?";


                        TextBlock address_label = new TextBlock()
                        {
                            Text          = "Address:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right
                        };

                        TextBlock address_value = new TextBlock()
                        {
                            Text       = Controller.PendingInvite.Address,
                            Width      = 175,
                            FontWeight = FontWeights.Bold
                        };


                        TextBlock path_label = new TextBlock()
                        {
                            Text          = "Remote Path:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right
                        };

                        TextBlock path_value = new TextBlock()
                        {
                            Width      = 175,
                            Text       = Controller.PendingInvite.RemotePath,
                            FontWeight = FontWeights.Bold
                        };



                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button add_button = new Button()
                        {
                            Content = "Add"
                        };


                        ContentCanvas.Children.Add(address_label);
                        Canvas.SetLeft(address_label, 180);
                        Canvas.SetTop(address_label, 200);

                        ContentCanvas.Children.Add(address_value);
                        Canvas.SetLeft(address_value, 340);
                        Canvas.SetTop(address_value, 200);

                        ContentCanvas.Children.Add(path_label);
                        Canvas.SetLeft(path_label, 180);
                        Canvas.SetTop(path_label, 225);

                        ContentCanvas.Children.Add(path_value);
                        Canvas.SetLeft(path_value, 340);
                        Canvas.SetTop(path_value, 225);

                        Buttons.Add(add_button);
                        Buttons.Add(cancel_button);


                        cancel_button.Click += delegate {
                            Controller.PageCancelled();
                        };

                        add_button.Click += delegate {
                            Controller.InvitePageCompleted();
                        };

                        break;
                    }

                    case PageType.Add: {
                        Header = "Where's your project hosted?";


                        ListView list_view = new ListView()
                        {
                            Width         = 419,
                            Height        = 195,
                            SelectionMode = SelectionMode.Single
                        };

                        GridView grid_view = new GridView()
                        {
                            AllowsColumnReorder = false
                        };

                        grid_view.Columns.Add(new GridViewColumn());

                        string xaml =
                            "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"" +
                            "  xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">" +
                            "  <Grid>" +
                            "    <StackPanel Orientation=\"Horizontal\">" +
                            "      <Image Margin=\"5,0,0,0\" Source=\"{Binding Image}\" Height=\"24\" Width=\"24\"/>" +
                            "      <StackPanel>" +
                            "        <TextBlock Padding=\"10,4,0,0\" FontWeight=\"Bold\" Text=\"{Binding Name}\">" +
                            "        </TextBlock>" +
                            "        <TextBlock Padding=\"10,0,0,4\" Opacity=\"0.5\" Text=\"{Binding Description}\">" +
                            "        </TextBlock>" +
                            "      </StackPanel>" +
                            "    </StackPanel>" +
                            "  </Grid>" +
                            "</DataTemplate>";

                        grid_view.Columns [0].CellTemplate = (DataTemplate)XamlReader.Parse(xaml);

                        Style header_style = new Style(typeof(GridViewColumnHeader));
                        header_style.Setters.Add(new Setter(GridViewColumnHeader.VisibilityProperty, Visibility.Collapsed));
                        grid_view.ColumnHeaderContainerStyle = header_style;

                        foreach (SparklePlugin plugin in Controller.Plugins)
                        {
                            // FIXME: images are blurry
                            BitmapFrame image = BitmapFrame.Create(
                                new Uri(plugin.ImagePath)
                                );

                            list_view.Items.Add(
                                new {
                                    Name        = plugin.Name,
                                    Description = plugin.Description,
                                    Image       = image
                                }
                                );
                        }

                        list_view.View          = grid_view;
                        list_view.SelectedIndex = Controller.SelectedPluginIndex;

                        TextBlock address_label = new TextBlock()
                        {
                            Text       = "Address:",
                            FontWeight = FontWeights.Bold
                        };

                        TextBox address_box = new TextBox()
                        {
                            Width     = 200,
                            Text      = Controller.PreviousAddress,
                            IsEnabled = (Controller.SelectedPlugin.Address == null)
                        };

                        TextBlock address_help_label = new TextBlock()
                        {
                            Text       = Controller.SelectedPlugin.AddressExample,
                            FontSize   = 11,
                            Foreground = new SolidColorBrush(Color.FromRgb(128, 128, 128))
                        };

                        TextBlock path_label = new TextBlock()
                        {
                            Text       = "Remote Path:",
                            FontWeight = FontWeights.Bold,
                            Width      = 200
                        };

                        TextBox path_box = new TextBox()
                        {
                            Width     = 200,
                            Text      = Controller.PreviousPath,
                            IsEnabled = (Controller.SelectedPlugin.Path == null)
                        };

                        TextBlock path_help_label = new TextBlock()
                        {
                            Text       = Controller.SelectedPlugin.PathExample,
                            FontSize   = 11,
                            Width      = 200,
                            Foreground = new SolidColorBrush(Color.FromRgb(128, 128, 128))
                        };

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button add_button = new Button()
                        {
                            Content = "Add"
                        };

                        CheckBox history_check_box = new CheckBox()
                        {
                            Content   = "Fetch prior revisions",
                            IsChecked = Controller.FetchPriorHistory
                        };

                        history_check_box.Click += delegate {
                            Controller.HistoryItemChanged(history_check_box.IsChecked.Value);
                        };

                        ContentCanvas.Children.Add(history_check_box);
                        Canvas.SetLeft(history_check_box, 185);
                        Canvas.SetBottom(history_check_box, 12);

                        ContentCanvas.Children.Add(list_view);
                        Canvas.SetTop(list_view, 70);
                        Canvas.SetLeft(list_view, 185);

                        ContentCanvas.Children.Add(address_label);
                        Canvas.SetTop(address_label, 285);
                        Canvas.SetLeft(address_label, 185);

                        ContentCanvas.Children.Add(address_box);
                        Canvas.SetTop(address_box, 305);
                        Canvas.SetLeft(address_box, 185);

                        ContentCanvas.Children.Add(address_help_label);
                        Canvas.SetTop(address_help_label, 330);
                        Canvas.SetLeft(address_help_label, 185);

                        ContentCanvas.Children.Add(path_label);
                        Canvas.SetTop(path_label, 285);
                        Canvas.SetRight(path_label, 30);

                        ContentCanvas.Children.Add(path_box);
                        Canvas.SetTop(path_box, 305);
                        Canvas.SetRight(path_box, 30);

                        ContentCanvas.Children.Add(path_help_label);
                        Canvas.SetTop(path_help_label, 330);
                        Canvas.SetRight(path_help_label, 30);

                        TaskbarItemInfo.ProgressValue = 0.0;
                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

                        Buttons.Add(add_button);
                        Buttons.Add(cancel_button);

                        address_box.Focus();
                        address_box.Select(address_box.Text.Length, 0);


                        Controller.ChangeAddressFieldEvent += delegate(string text,
                                                                       string example_text, FieldState state) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    address_box.Text        = text;
                                    address_box.IsEnabled   = (state == FieldState.Enabled);
                                    address_help_label.Text = example_text;
                                });
                        };

                        Controller.ChangePathFieldEvent += delegate(string text,
                                                                    string example_text, FieldState state) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    path_box.Text        = text;
                                    path_box.IsEnabled   = (state == FieldState.Enabled);
                                    path_help_label.Text = example_text;
                                });
                        };

                        Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    add_button.IsEnabled = button_enabled;
                                });
                        };

                        list_view.SelectionChanged += delegate {
                            Controller.SelectedPluginChanged(list_view.SelectedIndex);
                        };

                        list_view.KeyDown += delegate {
                            Controller.SelectedPluginChanged(list_view.SelectedIndex);
                        };

                        Controller.CheckAddPage(address_box.Text, path_box.Text, list_view.SelectedIndex);

                        address_box.TextChanged += delegate {
                            Controller.CheckAddPage(address_box.Text, path_box.Text, list_view.SelectedIndex);
                        };

                        path_box.TextChanged += delegate {
                            Controller.CheckAddPage(address_box.Text, path_box.Text, list_view.SelectedIndex);
                        };

                        cancel_button.Click += delegate {
                            Controller.PageCancelled();
                        };

                        add_button.Click += delegate {
                            Controller.AddPageCompleted(address_box.Text, path_box.Text);
                        };

                        break;
                    }


                    case PageType.Syncing: {
                        Header      = "Adding project ‘" + Controller.SyncingFolder + "’…";
                        Description = "This may take a while for large projects.\nIsn't it coffee-o'clock?";

                        Button finish_button = new Button()
                        {
                            Content   = "Finish",
                            IsEnabled = false
                        };

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        ProgressBar progress_bar = new ProgressBar()
                        {
                            Width  = 414,
                            Height = 15,
                            Value  = Controller.ProgressBarPercentage
                        };


                        ContentCanvas.Children.Add(progress_bar);
                        Canvas.SetLeft(progress_bar, 185);
                        Canvas.SetTop(progress_bar, 150);

                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;

                        Buttons.Add(cancel_button);
                        Buttons.Add(finish_button);


                        Controller.UpdateProgressBarEvent += delegate(double percentage) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    progress_bar.Value            = percentage;
                                    TaskbarItemInfo.ProgressValue = percentage / 100;
                                });
                        };

                        cancel_button.Click += delegate {
                            Controller.SyncingCancelled();
                        };

                        break;
                    }


                    case PageType.Error: {
                        Header      = "Oops! Something went wrong…";
                        Description = "Please check the following:";

                        TextBlock help_block = new TextBlock()
                        {
                            TextWrapping = TextWrapping.Wrap,
                            Width        = 310
                        };

                        TextBlock bullets_block = new TextBlock()
                        {
                            Text = "•\n\n\n•"
                        };

                        help_block.Inlines.Add(new Bold(new Run(Controller.PreviousUrl)));
                        help_block.Inlines.Add(" is the address we've compiled. Does this look alright?\n\n");
                        help_block.Inlines.Add("Do you have access rights to this remote project?");

                        if (warnings.Length > 0)
                        {
                            bullets_block.Text += "\n\n•";
                            help_block.Inlines.Add("\n\nHere's the raw error message:");

                            foreach (string warning in warnings)
                            {
                                help_block.Inlines.Add("\n");
                                help_block.Inlines.Add(new Bold(new Run(warning)));
                            }
                        }

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button try_again_button = new Button()
                        {
                            Content = "Try again…"
                        };


                        ContentCanvas.Children.Add(bullets_block);
                        Canvas.SetLeft(bullets_block, 195);
                        Canvas.SetTop(bullets_block, 100);

                        ContentCanvas.Children.Add(help_block);
                        Canvas.SetLeft(help_block, 210);
                        Canvas.SetTop(help_block, 100);

                        TaskbarItemInfo.ProgressValue = 1.0;
                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Error;

                        Buttons.Add(try_again_button);
                        Buttons.Add(cancel_button);


                        cancel_button.Click += delegate {
                            Controller.PageCancelled();
                        };

                        try_again_button.Click += delegate {
                            Controller.ErrorPageCompleted();
                        };

                        break;
                    }

                    case PageType.CryptoSetup: {
                        Header      = "Set up file encryption";
                        Description = "Please a provide a strong password that you don't use elsewhere below:";

                        TextBlock password_label = new TextBlock()
                        {
                            Text       = "Password:"******"Show password",
                            IsChecked = false
                        };

                        TextBlock info_label = new TextBlock()
                        {
                            Text         = "This password can't be changed later, and your files can't be recovered if it's forgotten.",
                            TextWrapping = TextWrapping.Wrap,
                            Width        = 315
                        };

                        Image warning_image = new Image()
                        {
                            Source = Imaging.CreateBitmapSourceFromHIcon(Drawing.SystemIcons.Information.Handle,
                                                                         Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
                        };

                        show_password_checkbox.Checked += delegate {
                            visible_password_box.Text       = password_box.Password;
                            visible_password_box.Visibility = Visibility.Visible;
                            password_box.Visibility         = Visibility.Hidden;
                        };

                        show_password_checkbox.Unchecked += delegate {
                            password_box.Password           = visible_password_box.Text;
                            password_box.Visibility         = Visibility.Visible;
                            visible_password_box.Visibility = Visibility.Hidden;
                        };

                        password_box.PasswordChanged += delegate {
                            Controller.CheckCryptoSetupPage(password_box.Password);
                        };

                        visible_password_box.TextChanged += delegate {
                            Controller.CheckCryptoSetupPage(visible_password_box.Text);
                        };

                        Button continue_button = new Button()
                        {
                            Content   = "Continue",
                            IsEnabled = false
                        };

                        continue_button.Click += delegate {
                            if (show_password_checkbox.IsChecked == true)
                            {
                                Controller.CryptoSetupPageCompleted(visible_password_box.Text);
                            }
                            else
                            {
                                Controller.CryptoSetupPageCompleted(password_box.Password);
                            }
                        };

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        cancel_button.Click += delegate {
                            Controller.CryptoPageCancelled();
                        };

                        Controller.UpdateCryptoSetupContinueButtonEvent += delegate(bool button_enabled) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    continue_button.IsEnabled = button_enabled;
                                });
                        };

                        ContentCanvas.Children.Add(password_label);
                        Canvas.SetLeft(password_label, 270);
                        Canvas.SetTop(password_label, 180);

                        ContentCanvas.Children.Add(password_box);
                        Canvas.SetLeft(password_box, 335);
                        Canvas.SetTop(password_box, 180);

                        ContentCanvas.Children.Add(visible_password_box);
                        Canvas.SetLeft(visible_password_box, 335);
                        Canvas.SetTop(visible_password_box, 180);

                        ContentCanvas.Children.Add(show_password_checkbox);
                        Canvas.SetLeft(show_password_checkbox, 338);
                        Canvas.SetTop(show_password_checkbox, 208);

                        ContentCanvas.Children.Add(info_label);
                        Canvas.SetLeft(info_label, 240);
                        Canvas.SetTop(info_label, 300);

                        ContentCanvas.Children.Add(warning_image);
                        Canvas.SetLeft(warning_image, 193);
                        Canvas.SetTop(warning_image, 300);

                        Buttons.Add(continue_button);
                        Buttons.Add(cancel_button);

                        break;
                    }

                    case PageType.CryptoPassword: {
                        Header      = "This project contains encrypted files";
                        Description = "Please enter the password to see their contents.";

                        TextBlock password_label = new TextBlock()
                        {
                            Text       = "Password:"******"Show password",
                            IsChecked = false
                        };

                        show_password_checkbox.Checked += delegate {
                            visible_password_box.Text       = password_box.Password;
                            visible_password_box.Visibility = Visibility.Visible;
                            password_box.Visibility         = Visibility.Hidden;
                        };

                        show_password_checkbox.Unchecked += delegate {
                            password_box.Password           = visible_password_box.Text;
                            password_box.Visibility         = Visibility.Visible;
                            visible_password_box.Visibility = Visibility.Hidden;
                        };

                        password_box.PasswordChanged += delegate {
                            Controller.CheckCryptoPasswordPage(password_box.Password);
                        };

                        visible_password_box.TextChanged += delegate {
                            Controller.CheckCryptoPasswordPage(visible_password_box.Text);
                        };

                        Button continue_button = new Button()
                        {
                            Content   = "Continue",
                            IsEnabled = false
                        };

                        continue_button.Click += delegate {
                            if (show_password_checkbox.IsChecked == true)
                            {
                                Controller.CryptoPasswordPageCompleted(visible_password_box.Text);
                            }
                            else
                            {
                                Controller.CryptoPasswordPageCompleted(password_box.Password);
                            }
                        };

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        cancel_button.Click += delegate {
                            Controller.CryptoPageCancelled();
                        };

                        Controller.UpdateCryptoPasswordContinueButtonEvent += delegate(bool button_enabled) {
                            Dispatcher.BeginInvoke((Action) delegate {
                                    continue_button.IsEnabled = button_enabled;
                                });
                        };

                        ContentCanvas.Children.Add(password_label);
                        Canvas.SetLeft(password_label, 270);
                        Canvas.SetTop(password_label, 180);

                        ContentCanvas.Children.Add(password_box);
                        Canvas.SetLeft(password_box, 335);
                        Canvas.SetTop(password_box, 180);

                        ContentCanvas.Children.Add(visible_password_box);
                        Canvas.SetLeft(visible_password_box, 335);
                        Canvas.SetTop(visible_password_box, 180);

                        ContentCanvas.Children.Add(show_password_checkbox);
                        Canvas.SetLeft(show_password_checkbox, 338);
                        Canvas.SetTop(show_password_checkbox, 208);

                        Buttons.Add(continue_button);
                        Buttons.Add(cancel_button);

                        break;
                    }

                    case PageType.Finished: {
                        Header      = "Your shared project is ready!";
                        Description = "You can find the files in your SparkleShare folder.";


                        Button finish_button = new Button()
                        {
                            Content = "Finish"
                        };

                        Button show_files_button = new Button()
                        {
                            Content = "Show files…"
                        };

                        if (warnings.Length > 0)
                        {
                            Image warning_image = new Image()
                            {
                                Source = Imaging.CreateBitmapSourceFromHIcon(Drawing.SystemIcons.Information.Handle,
                                                                             Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
                            };

                            TextBlock warning_block = new TextBlock()
                            {
                                Text         = warnings [0],
                                Width        = 310,
                                TextWrapping = TextWrapping.Wrap
                            };

                            ContentCanvas.Children.Add(warning_image);
                            Canvas.SetLeft(warning_image, 193);
                            Canvas.SetTop(warning_image, 100);

                            ContentCanvas.Children.Add(warning_block);
                            Canvas.SetLeft(warning_block, 240);
                            Canvas.SetTop(warning_block, 100);
                        }

                        TaskbarItemInfo.ProgressValue = 0.0;
                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

                        Buttons.Add(show_files_button);
                        Buttons.Add(finish_button);


                        finish_button.Click += delegate {
                            Controller.FinishPageCompleted();
                        };

                        show_files_button.Click += delegate {
                            Controller.ShowFilesClicked();
                        };

                        break;
                    }

                    case PageType.Tutorial: {
                        switch (Controller.TutorialPageNumber)
                        {
                        case 1: {
                            Header      = "What's happening next?";
                            Description = "SparkleShare creates a special folder on your computer " +
                                          "that will keep track of your projects.";


                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 324,
                                Height = 200
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-1");

                            Button skip_tutorial_button = new Button()
                            {
                                Content = "Skip tutorial"
                            };

                            Button continue_button = new Button()
                            {
                                Content = "Continue"
                            };


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 228);
                            Canvas.SetTop(slide_image, 130);

                            Buttons.Add(skip_tutorial_button);
                            Buttons.Add(continue_button);


                            skip_tutorial_button.Click += delegate {
                                Controller.TutorialSkipped();
                            };

                            continue_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }

                        case 2: {
                            Header      = "Sharing files with others";
                            Description = "All files added to your project folders are synced automatically with " +
                                          "the host and your team members.";


                            Button continue_button = new Button()
                            {
                                Content = "Continue"
                            };

                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 324,
                                Height = 200
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-2");


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 228);
                            Canvas.SetTop(slide_image, 130);

                            Buttons.Add(continue_button);


                            continue_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }

                        case 3: {
                            Header      = "The status icon helps you";
                            Description = "It shows the syncing progress, provides easy access to " +
                                          "your projects and lets you view recent changes.";

                            Button continue_button = new Button()
                            {
                                Content = "Continue"
                            };

                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 324,
                                Height = 200
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-3");


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 228);
                            Canvas.SetTop(slide_image, 130);

                            Buttons.Add(continue_button);


                            continue_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }

                        case 4: {
                            Header      = "Here's your unique link code";
                            Description = "You'll need it whenever you want to link this computer to a host" +
                                          " (we keep a copy in your SparkleShare folder).";


                            TextBox link_code_text_box = new TextBox()
                            {
                                Text         = Program.Controller.CurrentUser.PublicKey,
                                Width        = 250,
                                MaxLines     = 1,
                                TextWrapping = TextWrapping.NoWrap,
                                IsEnabled    = false
                            };

                            Button copy_button = new Button()
                            {
                                Content = "Copy",
                                Width   = 60
                            };

                            Button finish_button = new Button()
                            {
                                Content = "Finish"
                            };

                            CheckBox check_box = new CheckBox()
                            {
                                Content   = "Add SparkleShare to startup items",
                                IsChecked = true
                            };


                            ContentCanvas.Children.Add(link_code_text_box);
                            Canvas.SetLeft(link_code_text_box, 235);
                            Canvas.SetTop(link_code_text_box, 190);

                            ContentCanvas.Children.Add(copy_button);
                            Canvas.SetLeft(copy_button, 490);
                            Canvas.SetTop(copy_button, 190);

                            ContentCanvas.Children.Add(check_box);
                            Canvas.SetLeft(check_box, 185);
                            Canvas.SetBottom(check_box, 12);

                            Buttons.Add(finish_button);


                            check_box.Click += delegate {
                                Controller.StartupItemChanged(check_box.IsChecked.Value);
                            };

                            finish_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            copy_button.Click += delegate {
                                Clipboard.SetData(DataFormats.Text, link_code_text_box.Text);
                            };

                            break;
                        }
                        }
                        break;
                    }
                    }

                    ShowAll();
                });
            };
        }
Пример #34
0
 public void AddListView(ListView lv)
 {
     sorters.Add(new ListViewColumnSorterExt(lv));
 }
Пример #35
0
        public override void Initialize()
        {
            if (CurrentVersion < 90020140221)
            {
                //send back a message that we need to update!
                PluginArgs a = new PluginArgs
                {
                    Command = "/echo Channel Monitor Plugin v1.3 requires IceChat 9 RC 8.22 or newer (" + CurrentVersion + ")"
                };
                OnCommand(a);
                this.Enabled = false;
                return;
            }

            settingsFile = CurrentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatChannelMonitor.xml";
            LoadSettings();

            panel = new Panel
            {
                Height = 150,
                Dock   = DockStyle.Bottom
            };

            listMonitor    = new ListView();
            columnTime     = new ColumnHeader();
            columnChannel  = new ColumnHeader();
            columnMessage  = new ColumnHeader();
            columnServerID = new ColumnHeader();

            columnTime.Width = 175;
            columnTime.Text  = "Time";

            columnChannel.Width = 150;
            columnChannel.Text  = "Channel/Nick";

            columnMessage.Width = 1000;
            columnMessage.Text  = "Message";

            columnServerID.Width = 0;   //hidden

            listMonitor.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                columnTime,
                columnChannel,
                columnMessage,
                columnServerID
            });

            listMonitor.View          = System.Windows.Forms.View.Details;
            listMonitor.FullRowSelect = true;
            listMonitor.Font          = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            listMonitor.Dock          = DockStyle.Fill;
            panel.Controls.Add(listMonitor);

            if (CurrentVersion > 90220150213)
            {
                listMonitor.DoubleClick += new EventHandler(ListMonitor_DoubleClick);
            }

            m_EnableMonitor = new ToolStripMenuItem
            {
                Text    = "Toggle Monitor",
                Checked = true
            };
            m_EnableMonitor.Click += new EventHandler(OnEnableMonitor_Click);
        }
        public TodoListPage()
        {
            Title = "Todo";

            NavigationPage.SetHasNavigationBar(this, true);

            listView = new ListView
            {
                RowHeight = 40
            };
            listView.ItemTemplate = new DataTemplate(typeof(TodoItemCell));

            // These commented-out lines were used to test the ListView prior to integrating the database
            //			listView.ItemSource = new string [] { "Buy pears", "Buy oranges", "Buy mangos", "Buy apples", "Buy bananas" };
            //			listView.ItemSource = new TodoItem [] {
            //				new TodoItem {Name = "Buy pears`"},
            //				new TodoItem {Name = "Buy oranges`", Done=true},
            //				new TodoItem {Name = "Buy mangos`"},
            //				new TodoItem {Name = "Buy apples`", Done=true},
            //				new TodoItem {Name = "Buy bananas`", Done=true}
            //			};

            // HACK: workaround issue #894 for now
            if (Device.OS == TargetPlatform.iOS)
            {
                listView.ItemsSource = new string[1] {
                    ""
                }
            }
            ;

            listView.ItemSelected += (sender, e) =>
            {
                var todoItem = (TodoItem)e.SelectedItem;
                var todoPage = new TodoItemPage();
                todoPage.BindingContext = todoItem;
                Navigation.PushAsync(todoPage);
            };

            var layout = new StackLayout();

            if (Device.OS == TargetPlatform.WinPhone)
            { // WinPhone doesn't have the title showing
                layout.Children.Add(new Label {
                    Text = "Todo", Font = Font.BoldSystemFontOfSize(NamedSize.Large)
                });
            }
            layout.Children.Add(listView);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            Content = layout;


            ToolbarItem tbi = null;

            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("+", null, () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPage();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.Android)
            { // BUG: Android doesn't support the icon being null
                tbi = new ToolbarItem("+", "plus", () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPage();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.WinPhone)
            {
                tbi = new ToolbarItem("Add", "add.png", () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPage();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            // WINRT
            if (Device.OS == TargetPlatform.Other)
            {
                tbi = new ToolbarItem("Add", "ms-appx:///add.png", () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPage();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (tbi != null)
            {
                ToolbarItems.Add(tbi);
            }

            if (Device.OS == TargetPlatform.iOS)
            {
                var tbi2 = new ToolbarItem("?", null, () =>
                {
                    var todos   = App.Database.GetItemsNotDone();
                    var tospeak = "";
                    foreach (var t in todos)
                    {
                        tospeak += t.Name + " ";
                    }
                    if (tospeak == "")
                    {
                        tospeak = "there are no tasks to do";
                    }

                    DependencyService.Get <ITextToSpeech>().Speak(tospeak);
                }, 0, 0);
                ToolbarItems.Add(tbi2);
            }
        }
Пример #37
0
        /// <summary>
        /// 地图主程序
        /// </summary>
        public void ditu(object o)
        {
            ListView LV = (ListView)o;

            if (keywords.Count == 0)
            {
                MessageBox.Show("请添加关键字");
                return;
            }


            try
            {
                if (citys.Count == 0)
                {
                    MessageBox.Show("请添加城市");
                    return;
                }

                foreach (string keyword in keywords)
                {
                    foreach (string city in citys)
                    {
                        ArrayList areaLats = getlat(city);

                        foreach (string lat in areaLats)
                        {
                            for (int page = 1; page < 100; page++)
                            {
                                string url  = "https://restapi.amap.com/v3/place/around?appname=1e3bb24ab8f75ba78a7cf8a9cc4734c6&key=1e3bb24ab8f75ba78a7cf8a9cc4734c6&keywords=" + System.Web.HttpUtility.UrlEncode(keyword) + "&location=" + lat + "&logversion=2.0&page=" + page + "&platform=WXJS&s=rsx&sdkversion=1.2.0";
                                string html = VerifyGet(url, "", username);


                                MatchCollection names     = Regex.Matches(html, @"""name"":""([\s\S]*?)""");
                                MatchCollection tels      = Regex.Matches(html, @"""tel"":([\s\S]*?),");
                                MatchCollection address   = Regex.Matches(html, @"""address"":([\s\S]*?),");
                                MatchCollection pros      = Regex.Matches(html, @"""pname"":([\s\S]*?),");
                                MatchCollection citynames = Regex.Matches(html, @"""cityname"":([\s\S]*?),");
                                MatchCollection areas     = Regex.Matches(html, @"""adname"":([\s\S]*?),");
                                MatchCollection types     = Regex.Matches(html, @"""type"":([\s\S]*?),");

                                if (names.Count == 0)
                                {
                                    break;
                                }

                                for (int i = 0; i < names.Count; i++)
                                {
                                    bool telpd = true;

                                    switch (telpanduan)
                                    {
                                    case "全部采集":
                                        break;

                                    case "只采集有联系方式":
                                        if (tels[i].Groups[1].Value.Replace("\"", "") == "[]")
                                        {
                                            telpd = false;
                                        }
                                        else
                                        {
                                            telpd = true;
                                        }
                                        break;
                                    }

                                    if (telpd)
                                    {
                                        ListViewItem lv1 = LV.Items.Add((LV.Items.Count + 1).ToString()); //使用Listview展示数据

                                        lv1.SubItems.Add(names[i].Groups[1].Value);
                                        lv1.SubItems.Add(tels[i].Groups[1].Value.Replace("\"", ""));
                                        lv1.SubItems.Add(address[i].Groups[1].Value.Replace("\"", ""));
                                        lv1.SubItems.Add(pros[i].Groups[1].Value.Replace("\"", ""));
                                        lv1.SubItems.Add(citynames[i].Groups[1].Value.Replace("\"", ""));
                                        lv1.SubItems.Add(areas[i].Groups[1].Value.Replace("\"", ""));
                                        lv1.SubItems.Add(types[i].Groups[1].Value.Replace("\"", ""));
                                        lv1.SubItems.Add(keyword);
                                        while (this.zanting == false)
                                        {
                                            Application.DoEvents();//如果loader是false表明正在加载,,则Application.DoEvents()意思就是处理其他消息。阻止当前的队列继续执行。
                                        }
                                        if (status == false)
                                        {
                                            return;
                                        }
                                    }
                                }
                                Thread.Sleep(1000);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #38
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this._resourceTypes    = new System.Windows.Forms.ListBox();
     this._resourcesView    = new System.Windows.Forms.ListView();
     this.columnHeader2     = new System.Windows.Forms.ColumnHeader();
     this.columnHeader1     = new System.Windows.Forms.ColumnHeader();
     this._btn_Close        = new System.Windows.Forms.Button();
     this._resID            = new System.Windows.Forms.TextBox();
     this._btn_ShowResource = new System.Windows.Forms.Button();
     this.label1            = new System.Windows.Forms.Label();
     this.panel1            = new System.Windows.Forms.Panel();
     this.panel2            = new System.Windows.Forms.Panel();
     this.splitter1         = new System.Windows.Forms.Splitter();
     this.label2            = new System.Windows.Forms.Label();
     this._count            = new System.Windows.Forms.TextBox();
     this._btnQuery         = new System.Windows.Forms.Button();
     this.panel1.SuspendLayout();
     this.panel2.SuspendLayout();
     this.SuspendLayout();
     //
     // _resourceTypes
     //
     this._resourceTypes.Dock                  = System.Windows.Forms.DockStyle.Left;
     this._resourceTypes.Location              = new System.Drawing.Point(0, 0);
     this._resourceTypes.Name                  = "_resourceTypes";
     this._resourceTypes.Size                  = new System.Drawing.Size(128, 147);
     this._resourceTypes.Sorted                = true;
     this._resourceTypes.TabIndex              = 0;
     this._resourceTypes.SelectedIndexChanged += new System.EventHandler(this._resourceTypes_SelectedIndexChanged);
     //
     // _resourcesView
     //
     this._resourcesView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
         this.columnHeader2,
         this.columnHeader1
     });
     this._resourcesView.Dock          = System.Windows.Forms.DockStyle.Fill;
     this._resourcesView.FullRowSelect = true;
     this._resourcesView.Location      = new System.Drawing.Point(0, 0);
     this._resourcesView.MultiSelect   = false;
     this._resourcesView.Name          = "_resourcesView";
     this._resourcesView.Size          = new System.Drawing.Size(449, 148);
     this._resourcesView.TabIndex      = 1;
     this._resourcesView.View          = System.Windows.Forms.View.Details;
     this._resourcesView.DoubleClick  += new System.EventHandler(this._resourcesView_DoubleClick);
     //
     // columnHeader2
     //
     this.columnHeader2.Text  = "ID";
     this.columnHeader2.Width = 71;
     //
     // columnHeader1
     //
     this.columnHeader1.Text  = "DisplayName";
     this.columnHeader1.Width = 409;
     //
     // _btn_Close
     //
     this._btn_Close.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this._btn_Close.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this._btn_Close.FlatStyle    = System.Windows.Forms.FlatStyle.System;
     this._btn_Close.Location     = new System.Drawing.Point(496, 162);
     this._btn_Close.Name         = "_btn_Close";
     this._btn_Close.Size         = new System.Drawing.Size(75, 25);
     this._btn_Close.TabIndex     = 5;
     this._btn_Close.Text         = "Close";
     this._btn_Close.Click       += new System.EventHandler(this.OnClose);
     //
     // _resID
     //
     this._resID.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this._resID.Location     = new System.Drawing.Point(224, 162);
     this._resID.Name         = "_resID";
     this._resID.Size         = new System.Drawing.Size(60, 21);
     this._resID.TabIndex     = 6;
     this._resID.Text         = "";
     this._resID.KeyDown     += new System.Windows.Forms.KeyEventHandler(this._resID_KeyDown);
     this._resID.TextChanged += new System.EventHandler(this.OnResourceIDChanged);
     //
     // _btn_ShowResource
     //
     this._btn_ShowResource.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this._btn_ShowResource.Enabled   = false;
     this._btn_ShowResource.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this._btn_ShowResource.Location  = new System.Drawing.Point(288, 162);
     this._btn_ShowResource.Name      = "_btn_ShowResource";
     this._btn_ShowResource.Size      = new System.Drawing.Size(92, 25);
     this._btn_ShowResource.TabIndex  = 7;
     this._btn_ShowResource.Text      = "Show Resource";
     this._btn_ShowResource.Click    += new System.EventHandler(this.OnShowResource);
     //
     // label1
     //
     this.label1.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label1.Location  = new System.Drawing.Point(148, 167);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(72, 17);
     this.label1.TabIndex  = 8;
     this.label1.Text      = "Resource ID:";
     //
     // panel1
     //
     this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                 | System.Windows.Forms.AnchorStyles.Left)
                                                                | System.Windows.Forms.AnchorStyles.Right)));
     this.panel1.Controls.Add(this.panel2);
     this.panel1.Controls.Add(this.splitter1);
     this.panel1.Controls.Add(this._resourceTypes);
     this.panel1.Location = new System.Drawing.Point(4, 4);
     this.panel1.Name     = "panel1";
     this.panel1.Size     = new System.Drawing.Size(580, 148);
     this.panel1.TabIndex = 10;
     //
     // panel2
     //
     this.panel2.Controls.Add(this._resourcesView);
     this.panel2.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.panel2.Location = new System.Drawing.Point(131, 0);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(449, 148);
     this.panel2.TabIndex = 2;
     //
     // splitter1
     //
     this.splitter1.Location = new System.Drawing.Point(128, 0);
     this.splitter1.Name     = "splitter1";
     this.splitter1.Size     = new System.Drawing.Size(3, 148);
     this.splitter1.TabIndex = 1;
     this.splitter1.TabStop  = false;
     //
     // label2
     //
     this.label2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.label2.Location = new System.Drawing.Point(12, 164);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(40, 16);
     this.label2.TabIndex = 11;
     this.label2.Text     = "Count:";
     //
     // _count
     //
     this._count.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this._count.Location = new System.Drawing.Point(56, 160);
     this._count.Name     = "_count";
     this._count.ReadOnly = true;
     this._count.Size     = new System.Drawing.Size(76, 21);
     this._count.TabIndex = 12;
     this._count.Text     = "";
     //
     // _btnQuery
     //
     this._btnQuery.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this._btnQuery.Location = new System.Drawing.Point(404, 164);
     this._btnQuery.Name     = "_btnQuery";
     this._btnQuery.TabIndex = 13;
     this._btnQuery.Text     = "Query";
     this._btnQuery.Click   += new System.EventHandler(this.OnQuery);
     //
     // ResourceBrowser
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
     this.CancelButton      = this._btn_Close;
     this.ClientSize        = new System.Drawing.Size(580, 194);
     this.Controls.Add(this._btnQuery);
     this.Controls.Add(this._count);
     this.Controls.Add(this._resID);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.panel1);
     this.Controls.Add(this.label1);
     this.Controls.Add(this._btn_ShowResource);
     this.Controls.Add(this._btn_Close);
     this.MinimumSize   = new System.Drawing.Size(588, 228);
     this.Name          = "ResourceBrowser";
     this.ShowInTaskbar = true;
     this.Text          = "ResourceBrowser";
     this.panel1.ResumeLayout(false);
     this.panel2.ResumeLayout(false);
     this.ResumeLayout(false);
 }
Пример #39
0
 public InstructionsListHelper(ListView listView, Window ownerWindow)
     : base(listView)
 {
 }
Пример #40
0
 public ListViewHelper(ListView view) : base(view)
 {
 }
Пример #41
0
 private void AddItemListView(ListView lv, ListViewItem item)
 {
     lv.Items.Add(item);
 }
Пример #42
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Assignment Class Member variable
            nameLbl = new Label {
                Text = "Name"
            };
            nameEntry = new Entry();
            nameEntry.SetBinding(Entry.TextProperty, "name");

            deadlineLbl = new Label {
                Text = "Deadline"
            };
            deadlinePicker = new DatePicker();
            deadlinePicker.SetBinding(DatePicker.DateProperty, "deadline");

            // File List
            fileList = new ListView
            {
                RowHeight    = 40,
                ItemTemplate = new DataTemplate(typeof(Views.FileCell))
            };
            fileList.ItemTemplate.SetBinding(FileCell.idxProperty, "Idx");
            fileList.SetBinding(ListView.ItemsSourceProperty, "fileList");
            fileList.ItemsSource   = dao.GetFileList();
            fileList.ItemSelected += FileList_ItemSelected;
            fileUrlEntry           = new Entry {
                Placeholder = "URL", WidthRequest = 200, HeightRequest = 30
            };
            fileAddBtn = new Button {
                Text = "+", WidthRequest = 30, HeightRequest = 30, Margin = 0
            };
            fileAddBtn.Clicked += FileAddBtn_Clicked;

            fileLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label {
                        Text = "File list"
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            fileUrlEntry,
                            fileAddBtn
                        }
                    },
                    fileList,
                }
            };

            // Comment List
            commentList = new ListView
            {
                RowHeight    = 40,
                ItemTemplate = new DataTemplate(typeof(Views.CommentCell))
            };
            commentList.ItemTemplate.SetBinding(CommentCell.idxProperty, "Idx");
            commentList.SetBinding(ListView.ItemsSourceProperty, "commentList");
            commentList.ItemsSource   = dao.GetCommentList();
            commentList.ItemSelected += CommentList_ItemSelected;
            commentAddBtn             = new Button {
                Text = "+", WidthRequest = 30, HeightRequest = 30
            };
            commentEntry = new Entry {
                WidthRequest = 300
            };
            commentEntry.SetBinding(Entry.TextProperty, "comment");
            commentAddBtn.Clicked += CommentAddBtn_Clicked;

            commentLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label {
                        Text = "Comment list"
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            commentEntry,
                            commentAddBtn
                        }
                    },
                    commentList,
                }
            };

            // Buttons
            saveBtn = new Button {
                Text = "Save"
            };
            saveBtn.Clicked += SaveBtn_Clicked;

            deleteBtn = new Button {
                Text = "Delete"
            };
            deleteBtn.Clicked += DeleteBtn_Clicked;

            cancelBtn = new Button {
                Text = "Cancel"
            };
            cancelBtn.Clicked += CancelBtn_Clicked;

            layout = new StackLayout
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding         = new Thickness(20),
                Children        =
                {
                    nameLbl,     nameEntry,
                    deadlineLbl, deadlinePicker,
                }
            };
            if (idx != -1)
            {
                layout.Children.Add(fileLayout);
                layout.Children.Add(commentLayout);
            }
            layout.Children.Add(saveBtn);
            layout.Children.Add(cancelBtn);
            if (idx != -1)
            {
                layout.Children.Add(deleteBtn);
            }

            var view = new ScrollView()
            {
                Content = layout
            };

            Content = view;
        }
Пример #43
0
 private string generateColumnHash(ListView listView, ColumnHeader header)
 {
     return(string.Format("{0}_{1}", listView.Name, header.Text));
 }
Пример #44
0
        protected override void Init()
        {
            var outputLabel = new Label();
            var testButton  = new Button
            {
                Text         = "Can't Touch This",
                AutomationId = CantTouchButtonId
            };

            testButton.Clicked += (sender, args) => outputLabel.Text = CantTouchFailText;

            var boxView = new BoxView
            {
                AutomationId = "nontransparentBoxView",
                Color        = Color.Pink.MultiplyAlpha(0.5)
            };

            // Bump up the elevation on Android so the Button is covered (FastRenderers)
            boxView.On <Android>().SetElevation(10f);

            var testGrid = new Grid
            {
                AutomationId = "testgrid",
                Children     =
                {
                    testButton,
                    boxView
                }
            };

            // BoxView over Button prevents Button click
            var testButtonOk = new Button
            {
                Text         = "Can Touch This",
                AutomationId = CanTouchButtonId
            };

            testButtonOk.Clicked += (sender, args) =>
            {
                outputLabel.Text = CanTouchSuccessText;
            };

            var testGridOk = new Grid
            {
                AutomationId = "testgridOK",
                Children     =
                {
                    testButtonOk,
                    new BoxView
                    {
                        AutomationId     = "transparentBoxView",
                        Color            = Color.Pink.MultiplyAlpha(0.5),
                        InputTransparent = true
                    }
                }
            };

            var testListView = new ListView();
            var items        = new[] { "Foo" };

            testListView.ItemsSource  = items;
            testListView.ItemTemplate = new DataTemplate(() =>
            {
                var result = new ViewCell
                {
                    View = new Grid
                    {
                        Children =
                        {
                            new BoxView
                            {
                                AutomationId = ListTapTarget,
                                Color        = Color.Pink.MultiplyAlpha(0.5)
                            }
                        }
                    }
                };

                return(result);
            });

            testListView.ItemSelected += (sender, args) => outputLabel.Text = ListTapSuccessText;

            Content = new StackLayout
            {
                AutomationId = "Container Stack Layout",
                Children     = { outputLabel, testGrid, testGridOk, testListView }
            };
        }
Пример #45
0
 public UploadInfoManager(ListView listView)
 {
     lv     = listView;
     parser = new UploadInfoParser();
 }
Пример #46
0
 protected string localizeListViewColumn(ListView listview, string columnName)
 {
     return(Session.getLocalizedString(string.Format("{0}.{1}.{2}.Columns.{3}",
                                                     new object[] { applicationSession.SECTION_NAME_DIALOGS, Name, listview.Name, columnName })));
 }
Пример #47
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MainActivity);

            _backgroundButton = FindViewById <Button>(Resource.Id.backgroundButton);
            _stopButton       = FindViewById <Button>(Resource.Id.stopButton);
            _startButton      = FindViewById <Button>(Resource.Id.startButton);
            _list             = FindViewById <ListView>(Resource.Id.list);

            _adapter = new ListSource((data, position, convertView, parent) =>
            {
                var view   = convertView;
                var beacon = data[position];

                if (view == null)
                {
                    view = LayoutInflater.Inflate(Resource.Layout.ListItem, parent, false);
                }

                view.FindViewById <TextView>(Resource.Id.beaconId).Text       = beacon.Id1.ToString().ToUpper();
                view.FindViewById <TextView>(Resource.Id.beaconDistance).Text = string.Format("{0:N2}m", beacon.Distance);

                if (beacon.Distance <= .5)
                {
//					view.SetBackgroundColor(Color.Red);
                }
                else if (beacon.Distance > .5 && beacon.Distance <= 10)
                {
//					view.SetBackgroundColor(Color.Yellow);
                }
                else if (beacon.Distance > 10)
                {
//					view.SetBackgroundColor(Color.Blue);
                }
                else
                {
//					view.SetBackgroundColor(Color.Transparent);
                }

                return(view);
            });

            _list.Adapter = _adapter;

            VerityBluetooth();

            _beaconManager = BeaconManager.GetInstanceForApplication(this);
//			// By default the AndroidBeaconLibrary will only find AltBeacons.  If you wish to make it
//			// find a different type of beacon, you must specify the byte layout for that beacon's
//			// advertisement with a line like below.  The example shows how to find a beacon with the
//			// same byte layout as AltBeacon but with a beaconTypeCode of 0xaabb
//			//
//			// beaconManager.getBeaconParsers().add(new BeaconParser().
//			//        setBeaconLayout("m:2-3=aabb,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
//			//
//			// In order to find out the proper BeaconLayout definition for other kinds of beacons, do
//			// a Google search for "setBeaconLayout" (including the quotes in your search.)
//
            var iBeaconParser = new BeaconParser();

            //	Estimote > 2013
            iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
            _beaconManager.BeaconParsers.Add(iBeaconParser);

            _beaconManager.Bind(this);
//			_beaconManager.SetBackgroundMode(false);

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
        public void CreateGUI()
        {
            m_SerializedObject = new SerializedObject(this);
            converterEditorAsset.CloneTree(rootVisualElement);

            // This is temp now to get the information filled in
            RenderPipelineConverterContainer converterContainer =
                (RenderPipelineConverterContainer)Activator.CreateInstance(m_ConverterContainers[0]);
            rootVisualElement.Q<Label>("conversionName").text = converterContainer.name;
            rootVisualElement.Q<TextElement>("conversionInfo").text = converterContainer.info;

            rootVisualElement.Q<Image>("converterContainerHelpIcon").image = CoreEditorStyles.iconHelp;

            // Getting the scrollview where the converters should be added
            m_ScrollView = rootVisualElement.Q<ScrollView>("convertersScrollView");
            for (int i = 0; i < m_CoreConvertersList.Count; ++i)
            {
                // Making an item using the converterListAsset as a template.
                // Then adding the information needed for each converter
                VisualElement item = new VisualElement();
                converterListAsset.CloneTree(item);
                var conv = m_CoreConvertersList[i];
                item.SetEnabled(conv.IsEnabled);
                item.Q<Label>("converterName").text = conv.name;
                item.Q<Label>("converterInfo").text = conv.info;
                item.Q<VisualElement>("converterTopVisualElement").tooltip = conv.info;

                // setup the images
                item.Q<Image>("pendingImage").image = CoreEditorStyles.iconPending;
                item.Q<Image>("pendingImage").tooltip = "Pending";
                var pendingLabel = item.Q<Label>("pendingLabel");
                item.Q<Image>("warningImage").image = CoreEditorStyles.iconWarn;
                item.Q<Image>("warningImage").tooltip = "Warnings";
                var warningLabel = item.Q<Label>("warningLabel");
                item.Q<Image>("errorImage").image = CoreEditorStyles.iconFail;
                item.Q<Image>("errorImage").tooltip = "Failed";
                var errorLabel = item.Q<Label>("errorLabel");
                item.Q<Image>("successImage").image = CoreEditorStyles.iconSuccess;
                item.Q<Image>("successImage").tooltip = "Success";
                var successLabel = item.Q<Label>("successLabel");

                var converterEnabledToggle = item.Q<Toggle>("converterEnabled");
                converterEnabledToggle.bindingPath =
                    $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.isActive)}";
                pendingLabel.bindingPath =
                    $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.pending)}";
                warningLabel.bindingPath =
                    $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.warnings)}";
                errorLabel.bindingPath =
                    $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.errors)}";
                successLabel.bindingPath =
                    $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.success)}";

                VisualElement child = item;
                ListView listView = child.Q<ListView>("converterItems");

                listView.showBoundCollectionSize = false;
                listView.bindingPath = $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.items)}";

                int id = i;
                listView.makeItem = () =>
                {
                    var convertItem = converterItem.CloneTree();
                    // Adding the contextual menu for each item
                    convertItem.AddManipulator(new ContextualMenuManipulator(evt => AddToContextMenu(evt, id)));
                    return convertItem;
                };

                listView.bindItem = (element, index) =>
                {
                    m_SerializedObject.Update();
                    var property = m_SerializedObject.FindProperty($"{listView.bindingPath}.Array.data[{index}]");

                    // ListView doesn't bind the child elements for us properly, so we do that for it
                    // In the UXML our root is a BindableElement, as we can't bind otherwise.
                    var bindable = (BindableElement)element;
                    bindable.BindProperty(property);

                    // Adding index here to userData so it can be retrieved later
                    element.userData = index;

                    Status status = (Status)property.FindPropertyRelative("status").enumValueIndex;
                    string info = property.FindPropertyRelative("message").stringValue;

                    // Update the amount of things to convert
                    child.Q<Label>("converterStats").text = $"{m_ItemsToConvert[id].Count} items";

                    ConverterItemDescriptor convItemDesc = m_ItemsToConvert[id][index];

                    element.Q<Label>("converterItemName").text = convItemDesc.name;
                    element.Q<Label>("converterItemPath").text = convItemDesc.info;

                    element.Q<Image>("converterItemHelpIcon").image = CoreEditorStyles.iconHelp;
                    element.Q<Image>("converterItemHelpIcon").tooltip = convItemDesc.helpLink;

                    // Changing the icon here depending on the status.
                    Texture2D icon = null;

                    switch (status)
                    {
                        case Status.Pending:
                            icon = CoreEditorStyles.iconPending;
                            break;
                        case Status.Error:
                            icon = CoreEditorStyles.iconFail;
                            break;
                        case Status.Warning:
                            icon = CoreEditorStyles.iconWarn;
                            break;
                        case Status.Success:
                            icon = CoreEditorStyles.iconSuccess;
                            break;
                    }

                    element.Q<Image>("converterItemStatusIcon").image = icon;
                    element.Q<Image>("converterItemStatusIcon").tooltip = info;
                };
                listView.onSelectionChange += obj => { m_CoreConvertersList[id].OnClicked(listView.selectedIndex); };
                listView.unbindItem = (element, index) =>
                {
                    var bindable = (BindableElement)element;
                    bindable.Unbind();
                };

                m_ScrollView.Add(item);
            }

            rootVisualElement.Bind(m_SerializedObject);
            var button = rootVisualElement.Q<Button>("convertButton");
            button.RegisterCallback<ClickEvent>(Convert);
            button.SetEnabled(false);

            var initButton = rootVisualElement.Q<Button>("initializeButton");
            initButton.RegisterCallback<ClickEvent>(InitializeAllActiveConverters);
        }
Пример #49
0
        private void OnMatchSelected(object sender, SelectedItemChangedEventArgs args)
        {
            ListView listView = (ListView)sender;

            listView.SelectedItem = null;
        }
Пример #50
0
        public EventTypeSearchField()
        {
            m_Choices       = new List <EventTypeChoice>();
            m_State         = new Dictionary <long, bool>();
            m_GroupedEvents = new Dictionary <string, List <long> >();

            AppDomain        currentDomain  = AppDomain.CurrentDomain;
            HashSet <string> userAssemblies = new HashSet <string>(ScriptingRuntime.GetAllUserAssemblies());

            foreach (Assembly assembly in currentDomain.GetAssemblies())
            {
                if (userAssemblies.Contains(assembly.GetName().Name + ".dll"))
                {
                    continue;
                }

                try
                {
                    foreach (var type in assembly.GetTypes().Where(t => typeof(EventBase).IsAssignableFrom(t) && !t.ContainsGenericParameters))
                    {
                        // Only select Pointer events on startup
                        AddType(type, IsGenericTypeOf(type, typeof(PointerEventBase <>)));
                    }

                    // Special case for ChangeEvent<>.
                    var implementingTypes = GetAllTypesImplementingOpenGenericType(typeof(INotifyValueChanged <>), assembly).ToList();
                    foreach (var valueChangedType in implementingTypes)
                    {
                        var baseType = valueChangedType.BaseType;
                        if (baseType == null || baseType.GetGenericArguments().Length <= 0)
                        {
                            continue;
                        }

                        var argumentType = baseType.GetGenericArguments()[0];
                        if (!argumentType.IsGenericParameter)
                        {
                            AddType(typeof(ChangeEvent <>).MakeGenericType(argumentType), false);
                        }
                    }
                }
                catch (TypeLoadException e)
                {
                    Debug.LogWarningFormat("Error while loading types from assembly {0}: {1}", assembly.FullName, e);
                }
                catch (ReflectionTypeLoadException e)
                {
                    for (var i = 0; i < e.LoaderExceptions.Length; i++)
                    {
                        if (e.LoaderExceptions[i] != null)
                        {
                            Debug.LogError(e.Types[i] + ": " + e.LoaderExceptions[i].Message);
                        }
                    }
                }
            }

            m_State.Add(0, false);

            // Add groups, with negative ids.
            var keyIndex = -1;

            foreach (var key in m_GroupedEvents.Keys.OrderBy(k => k))
            {
                m_Choices.Add(new EventTypeChoice()
                {
                    Name = key, Group = key, TypeId = keyIndex
                });
                m_State.Add(keyIndex--, key.Contains("IPointerEvent"));
            }

            m_Choices.Sort();
            m_Choices.Insert(0, new EventTypeChoice()
            {
                Name = "IAll", Group = "IAll", TypeId = 0
            });
            m_FilteredChoices = m_Choices.ToList();

            m_MenuContainer = new VisualElement();
            m_MenuContainer.AddToClassList(ussClassName);

            m_OuterContainer = new VisualElement();
            m_OuterContainer.AddToClassList(ussContainerClassName);
            m_MenuContainer.Add(m_OuterContainer);

            m_ListView = new ListView();
            m_ListView.AddToClassList(ussListViewClassName);
            m_ListView.pickingMode                   = PickingMode.Position;
            m_ListView.showBoundCollectionSize       = false;
            m_ListView.fixedItemHeight               = 20;
            m_ListView.selectionType                 = SelectionType.None;
            m_ListView.showAlternatingRowBackgrounds = AlternatingRowBackground.All;

            m_ListView.makeItem = () =>
            {
                var container = new VisualElement();
                container.AddToClassList(ussItemContainerClassName);

                var toggle = new Toggle();
                toggle.labelElement.AddToClassList(ussItemLabelClassName);
                toggle.visualInput.AddToClassList(ussItemToggleClassName);
                toggle.RegisterValueChangedCallback(OnToggleValueChanged);
                container.Add(toggle);

                var label = new Label();
                label.AddToClassList(ussItemCountClassName);
                label.pickingMode = PickingMode.Ignore;
                container.Add(label);

                return(container);
            };

            m_ListView.bindItem = (element, i) =>
            {
                var toggle     = element[0] as Toggle;
                var countLabel = element[1] as Label;
                var choice     = m_FilteredChoices[i];
                toggle.SetValueWithoutNotify(m_State[choice.TypeId]);
                var isGroup = choice.Name == choice.Group;

                toggle.label = isGroup ? $"{choice.Group.Substring(1).Replace("Event", "")} Events" : choice.Name;
                toggle.labelElement.RemoveFromClassList(isGroup ? ussItemLabelClassName : ussGroupLabelClassName);
                toggle.labelElement.AddToClassList(isGroup ? ussGroupLabelClassName : ussItemLabelClassName);
                toggle.userData = i;

                if (m_EventCountLog != null && m_EventCountLog.ContainsKey(choice.TypeId))
                {
                    countLabel.style.display = DisplayStyle.Flex;
                    countLabel.text          = m_EventCountLog[choice.TypeId].ToString();
                }
                else
                {
                    countLabel.text          = "";
                    countLabel.style.display = DisplayStyle.None;
                }
            };

            m_ListView.itemsSource = m_FilteredChoices;
            m_OuterContainer.Add(m_ListView);

            UpdateTextHint();

            m_MenuContainer.RegisterCallback <AttachToPanelEvent>(OnAttachToPanel);
            m_MenuContainer.RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel);
            textInputField.RegisterValueChangedCallback(OnValueChanged);

            RegisterCallback <FocusInEvent>(OnFocusIn);
            RegisterCallback <FocusEvent>(OnFocus);
            RegisterCallback <FocusOutEvent>(OnFocusOut);
        }
Пример #51
0
 /// <summary>
 /// 更新所选条目
 /// </summary>
 /// <param name="listview"></param>
 /// <param name="index"></param>
 /// <param name="conInfo"></param>
 /// <param name="refInfo"></param>
 public static void EditItem(ListView listview, int index, string conInfo, string refInfo)
 {
     listview.Items[index - 1].SubItems[1].Text = conInfo;
     listview.Items[index - 1].SubItems[2].Text = refInfo;
 }
Пример #52
0
        public ListFoundRides(string jsonFoundRides)
        {
            List <Ride> rides = JsonConvert.DeserializeObject <List <Ride> >(jsonFoundRides);

            Title = "Search Result";
            var ridesList = new ListView
            {
                HasUnevenRows  = true,
                ItemTemplate   = new DataTemplate(typeof(RideCellModel)),
                ItemsSource    = rides,
                SeparatorColor = Color.FromHex("#ddd"),
            };

            var layout = new StackLayout
            {
                Children =
                {
                    ridesList
                }
            };

            var page = new ContentPage
            {
                Content = layout,
                Title   = "Rearch Result",
            };

            Content = layout;

            // Accomodate iPhone status bar.
            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            ridesList.ItemSelected += async(sender, e) => {
                if (e.SelectedItem != null)
                {
                    var selected = e.SelectedItem as Ride;
                    if (App.dbRide.GetItemDynamoID(selected.id) == null)
                    {
                        var resp = await DisplayAlert("Ride Selected", "Do you want to ask for this ride?", "Yes", "No");

                        if (resp == true)
                        {
                            string result = await Web.WebService.DELETE(Settings.WebServiceURL + API.API_ReserveRide + selected.id);

                            if (string.Compare(result, Strings.WS_OK) == 0)
                            {
                                App.dbRide.SaveItem(selected);
                                await DisplayAlert("Success!", "Your ride has been reserved.", "Ok");

                                while (Navigation.NavigationStack.Count > 2)
                                {
                                    await Navigation.PopAsync();
                                }
                            }
                            else
                            {
                                await DisplayAlert("Error!", "Could not reserve your ride.", "Ok");

                                await Navigation.PopAsync();
                            }
                        }
                        else
                        {
                            ridesList.SelectedItem = null;
                        }
                    }
                    else
                    {
                        await DisplayAlert("Ops!", "You already have this ride as My Ride.", "Ok");

                        ridesList.SelectedItem = null;
                    }
                }
            };
        }
Пример #53
0
 public static void Clean(ListView listView, Label labelTotal)
 {
     listView.Items.Clear();
     labelTotal.Text = "0";
 }
        public MainPage()
        {
            Title           = "Fab Sample XF";
            BackgroundColor = Color.White;

            var data = new List <string>();

            for (var i = 1; i <= 100; i++)
            {
                data.Add(i.ToString());
            }

            list = new ListView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                ItemsSource     = data,
            };

            fab = new FloatingActionButtonView()
            {
                ImageName    = "ic_add.png",
                ColorNormal  = Color.FromHex("ff3498db"),
                ColorPressed = Color.Black,
                ColorRipple  = Color.FromHex("ff3498db"),
                Clicked      = async(sender, args) =>
                {
                    var animate = await this.DisplayAlert("Fab", "Hide and show the Fab?", "Sure", "Not now");

                    if (!animate)
                    {
                        return;
                    }

                    fab.Hide();
                    await Task.Delay(1500);

                    fab.Show();
                },
            };

            // Main page layout
            var pageLayout = new StackLayout
            {
                Children =
                {
                    list
                }
            };

            var absolute = new AbsoluteLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            // Position the pageLayout to fill the entire screen.
            // Manage positioning of child elements on the page by editing the pageLayout.
            AbsoluteLayout.SetLayoutFlags(pageLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(pageLayout, new Rectangle(0f, 0f, 1f, 1f));
            absolute.Children.Add(pageLayout);

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absolute.Children.Add(fab);

            Content = absolute;
        }
        private void btnSort_Click(object sender, EventArgs e)
        {
            btnAra.Enabled          = true;
            txtAra.Enabled          = true;
            txtElemanSayisi.Enabled = true;
            txtMax.Enabled          = true;
            txtMin.Enabled          = true;
            txtMod.Enabled          = true;
            rischPerformans         = "";
            eischPerformans         = "";
            lischPerformans         = "";
            beischPerformans        = "";

            if (islem_say >= 0)
            {
                if (txtMin.Text != "" || txtMax.Text != "")
                {
                    try
                    {
                        if (txtMin.Text != "")
                        {
                            min_value = Convert.ToInt32(txtMin.Text.ToString());
                        }
                        if (txtMax.Text != "")
                        {
                            max_value = Convert.ToInt32(txtMax.Text.ToString());
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Lütfen Max ve Min değerlerini sayi olarak giriniz.");
                    }
                }
                if (txtMod.Text != "")
                {
                    try
                    {
                        modValue = Convert.ToInt32(txtMod.Text.ToString());
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Lütfen Mod değerini sayi olarak giriniz.");
                    }
                }
                if (txtElemanSayisi.Text != "")
                {
                    try
                    {
                        randomElemanSayisi = Convert.ToInt32(txtElemanSayisi.Text.ToString());
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Lütfen Eleman Sayisi değerini sayi olarak giriniz.");
                    }
                }
                else if (txtElemanSayisi.Text == "")
                {
                    randomElemanSayisi = temp.Next(15, 20);
                }
                packingFactor      = temp.Next(93, 96);
                secondaryListCount = (randomElemanSayisi * 100) / packingFactor + 1;



                lstView_Unsorted.Items.Clear();
                listViewSirali.Items.Clear();
                lstViewEISCH.Items.Clear();
                lstViewBEISCH.Items.Clear();
                lstViewRISCH.Items.Clear();
                lstViewEich.Items.Clear();
                elemanUretilen = new Eleman[randomElemanSayisi];
                elemanUretilen = item_producer(elemanUretilen, randomElemanSayisi);

                sirasiz   = lstView_Unsorted;
                lstLISCH  = listViewSirali;
                lstEISCH  = lstViewEISCH;
                lstRISCH  = lstViewRISCH;
                lstBEISCH = lstViewBEISCH;
                lstEICH   = lstViewEich;


                addItems_To_ListView_HomeAdres(sirasiz, randomElemanSayisi, elemanUretilen);

                Eleman[] eleman_to_sirali;

                switch (cmbChoose.Text)
                {
                case "LISCH":
                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_lish.Start();
                    eleman_to_sirali = algorithm_LISCH(elemanUretilen, eleman_to_sirali);
                    st_lish.Stop();
                    lischPerformans = st_lish.ElapsedMilliseconds.ToString();
                    addItems_To_ListView(lstLISCH, secondaryListCount, eleman_to_sirali);    //LISCH
                    break;

                case "RLISCH":
                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_rlish.Start();
                    eleman_to_sirali = algorithm_RLISCH(elemanUretilen, eleman_to_sirali);
                    st_rlish.Stop();
                    rischPerformans = st_rlish.ElapsedMilliseconds.ToString();
                    addItems_To_ListView(lstRISCH, secondaryListCount, eleman_to_sirali);    //RISCH
                    break;

                case "EISCH":
                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_eish.Start();
                    eleman_to_sirali = algorithm_EISCH(elemanUretilen, eleman_to_sirali);
                    st_eish.Stop();
                    eischPerformans = st_eish.ElapsedMilliseconds.ToString();
                    addItems_To_ListView(lstEISCH, secondaryListCount, eleman_to_sirali);    //EISCH
                    break;

                case "BEISCH":
                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_beish.Start();
                    eleman_to_sirali = algorithm_BEISCH(elemanUretilen, eleman_to_sirali);
                    st_beish.Stop();
                    beischPerformans = st_beish.ElapsedMilliseconds.ToString();
                    addItems_To_ListView(lstBEISCH, secondaryListCount, eleman_to_sirali);    //BEISCH
                    break;

                case "EICH":
                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_eish.Start();
                    eleman_to_sirali = algorithm_EISCH(elemanUretilen, eleman_to_sirali);
                    st_eish.Stop();
                    eischPerformans = st_eish.ElapsedMilliseconds.ToString();
                    addItems_To_ListView_EICH(lstEICH, secondaryListCount, eleman_to_sirali, modValue, enyakin_Asal(modValue) - modValue);
                    break;

                case "HEPSİ":
                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_lish.Start();
                    eleman_to_sirali = algorithm_LISCH(elemanUretilen, eleman_to_sirali);
                    st_lish.Stop();
                    lischPerformans = st_lish.Elapsed.ToString();
                    addItems_To_ListView(lstLISCH, secondaryListCount, eleman_to_sirali);    //LISCH

                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_eish.Start();
                    eleman_to_sirali = algorithm_EISCH(elemanUretilen, eleman_to_sirali);
                    st_eish.Stop();
                    eischPerformans = st_eish.Elapsed.ToString();
                    addItems_To_ListView(lstEISCH, secondaryListCount, eleman_to_sirali);    //EISCH

                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_beish.Start();
                    eleman_to_sirali = algorithm_BEISCH(elemanUretilen, eleman_to_sirali);
                    st_beish.Stop();
                    beischPerformans = st_beish.Elapsed.ToString();
                    addItems_To_ListView(lstBEISCH, secondaryListCount, eleman_to_sirali);    //BEISCH

                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_rlish.Start();
                    eleman_to_sirali = algorithm_RLISCH(elemanUretilen, eleman_to_sirali);
                    st_rlish.Stop();
                    rischPerformans = st_rlish.Elapsed.ToString();
                    addItems_To_ListView(lstRISCH, secondaryListCount, eleman_to_sirali);    //RISCH

                    eleman_to_sirali = new Eleman[secondaryListCount];
                    st_eish.Start();
                    eleman_to_sirali = algorithm_EISCH(elemanUretilen, eleman_to_sirali);
                    st_eish.Stop();
                    eischPerformans = st_eish.Elapsed.ToString();
                    addItems_To_ListView_EICH(lstEICH, secondaryListCount, eleman_to_sirali, modValue, enyakin_Asal(modValue) - modValue);

                    break;

                default:
                    break;
                }
            }



            lblPackingFactorValue.Text = packingFactor.ToString();


            islem_say++;
        }
Пример #56
0
Файл: Menu.cs Проект: wsabor/AX
        public Menu()
        {
            NavigationPage.SetHasNavigationBar(this, false);

            Title = "Menu";

            ListaCategorias                 = new ListView();
            ListaCategorias.ItemsSource     = CategoriasDados;
            ListaCategorias.BackgroundColor = Color.FromHex("#666666");
            ListaCategorias.SeparatorColor  = Color.Transparent;
            ListaCategorias.ItemTemplate    = new DataTemplate(() =>
            {
                Label NomeLabel = new Label();
                NomeLabel.SetBinding(Label.TextProperty, "title");
                NomeLabel.TextColor = Color.White;

                Label QuantidadeLabel = new Label();
                QuantidadeLabel.SetBinding(Label.TextProperty, "quantidade");
                QuantidadeLabel.TextColor = Color.Lime;

                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(30, 10, 0, 10),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            NomeLabel,
                            QuantidadeLabel
                        }
                    }
                });
            });
            ListaCategorias.ItemTapped += ListaCategorias_ItemTapped;


            BtnTodos = new Button();
            BtnTodos.BackgroundColor   = Color.FromHex("#D56F00");
            BtnTodos.TextColor         = Color.FromHex("#FFFFFF");
            BtnTodos.Text              = "Últimos Posts";
            BtnTodos.WidthRequest      = 200;
            BtnTodos.HorizontalOptions = LayoutOptions.CenterAndExpand;
            BtnTodos.Clicked          += BtnTodos_Clicked;

            BtnFavoritos = new Button();
            BtnFavoritos.BackgroundColor   = Color.FromHex("#E9BD10");
            BtnFavoritos.TextColor         = Color.FromHex("#666666");
            BtnFavoritos.Text              = "Favoritos";
            BtnFavoritos.WidthRequest      = 200;
            BtnFavoritos.HorizontalOptions = LayoutOptions.CenterAndExpand;
            BtnFavoritos.Clicked          += BtnFavoritos_Clicked;

            Content = new StackLayout
            {
                Children =
                {
                    Util.ConteudoComLoading(
                        new StackLayout
                    {
                        Children =
                        {
                            new Image
                            {
                                Source            = ImageSource.FromFile("Logo.png"),
                                WidthRequest      = 50,
                                HeightRequest     = 80,
                                HorizontalOptions = LayoutOptions.Center,
                                VerticalOptions   = LayoutOptions.Start
                            },
                            BtnTodos,
                            BtnFavoritos,
                            ListaCategorias
                        },
                        BackgroundColor = Color.FromHex("#FAFAFA")
                    }, ref LOAD)
                },
                Padding         = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0),
                BackgroundColor = Color.FromHex("#FAFAFA")
            };

            BuscaCategorias();
        }
Пример #57
0
        public ViewResult Posts(int p = 1)
        {
            ListView viewm = new ListView(repo, p);

            return(View("List", viewm));
        }
Пример #58
0
    public void Rebind()
    {
        bool flag = displayMode == LevelSelectMenuMode.SubscribedWorkshop;

        UpdateTitle();
        DisableLevelContinue();
        bool flag2 = false;

        flag2             = SteamUser.BLoggedOn();
        InLevelSelectMenu = (displayMode != 0 && displayMode != LevelSelectMenuMode.LocalWorkshop);
        showCustomButton.SetActive(value: false);
        showSubscribedButton.SetActive(value: false);
        subscribedSubtitle.SetActive(value: false);
        customSubtitle.SetActive(value: false);
        ShowLocalLevelButton.SetActive(value: false);
        InvalidLevelInfoPanel.SetActive(value: false);
        noSubscribedPrompt.SetActive(value: false);
        offlinePanel.SetActive(value: false);
        noLocalPrompt.SetActive(value: false);
        List <WorkshopLevelMetadata> list = null;

        switch (displayMode)
        {
        case LevelSelectMenuMode.Campaign:
            WorkshopRepository.instance.LoadBuiltinLevels(isMultiplayer && IsLobbyMode());
            list = WorkshopRepository.instance.levelRepo.BySource(IsLobbyMode() ? WorkshopItemSource.BuiltInLobbies : WorkshopItemSource.BuiltIn);
            break;

        case LevelSelectMenuMode.EditorPicks:
            WorkshopRepository.instance.LoadEditorPickLevels();
            list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.EditorPick);
            break;

        case LevelSelectMenuMode.SubscribedWorkshop:
            if (flag2)
            {
                WorkshopRepository.instance.ReloadSubscriptions();
                list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.Subscription);
            }
            break;

        case LevelSelectMenuMode.LocalWorkshop:
            WorkshopRepository.instance.ReloadLocalLevels();
            list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.LocalWorkshop);
            break;

        case LevelSelectMenuMode.BuiltInLobbies:
            WorkshopRepository.instance.LoadBuiltinLevels(requestLobbies: true);
            list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.BuiltInLobbies);
            break;

        case LevelSelectMenuMode.WorkshopLobbies:
            if (flag2)
            {
                WorkshopRepository.instance.ReloadSubscriptions(isLobby: true);
                list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.SubscriptionLobbies);
            }
            break;
        }
        if (list == null)
        {
            list = new List <WorkshopLevelMetadata>();
        }
        if (!CouldShowFindMore())
        {
            FindMoreButton.SetActive(value: false);
        }
        customFolder.text = CustomDataPath;
        if (list.Count == 0)
        {
            this.list.Bind(list);
            itemListImage.color = itemListError;
            if (!flag2)
            {
                offlinePanel.SetActive(value: true);
            }
            else if (IsLobbyMode())
            {
                noSubscribedPrompt.SetActive(value: true);
            }
            else if (displayMode == LevelSelectMenuMode.SubscribedWorkshop)
            {
                noSubscribedPrompt.SetActive(value: true);
            }
            else
            {
                noLocalPrompt.SetActive(value: true);
            }
            EventSystem.current.SetSelectedGameObject(BackButton.gameObject);
            levelImage.SetActive(value: false);
            LevelDescriptionPanel.SetActive(value: false);
        }
        else
        {
            itemListImage.color = itemListNormal;
            levelInfoPanel.SetActive(value: true);
            levelImage.SetActive(!flag);
            LevelDescriptionPanel.SetActive(flag);
            this.list.Bind(list);
            int num = 0;
            if (!string.IsNullOrEmpty(selectedPath))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (FolderMatch(list[i].folder, selectedPath))
                    {
                        num = i;
                        break;
                    }
                }
            }
            GameSave.GetLastSave(out int levelNumber, out int _, out int _, out float _);
            WorkshopItemSource lastCheckpointLevelType = GameSave.GetLastCheckpointLevelType();
            bool flag3 = false;
            switch (lastCheckpointLevelType)
            {
            case WorkshopItemSource.BuiltIn:
                flag3 = (displayMode == LevelSelectMenuMode.Campaign);
                break;

            case WorkshopItemSource.EditorPick:
                flag3 = (displayMode == LevelSelectMenuMode.EditorPicks);
                break;

            default:
                flag3 = false;
                break;
            }
            if (flag3)
            {
                if (levelNumber < this.list.GetNumberItems - 1)
                {
                    this.list.FocusItem(levelNumber);
                }
                else
                {
                    this.list.FocusItem(0);
                }
            }
            else
            {
                this.list.FocusItem(0);
            }
        }
        topPanel.Invalidate();
        EnableShowLevelButtons();
        BindLevelIfNeeded(selectedMenuItem);
        if (previousSelectedItem != null)
        {
            StartCoroutine(WaitAndSelect());
        }
    }
Пример #59
0
 public ISearchResultService CreateSearchResultService(ListView listView)
 {
     return(new SearchResultServiceImpl(services, listView));
 }
Пример #60
0
 /// <summary>
 /// 서브젝트 정보를 검색 뷰어에 출력합니다.
 /// </summary>
 private void AppendSubjectToList(ListView lv, Bot.SubjectStruct ss)
 {
     lv.Items.Add(new ListViewItem(new string[] { ss.index.ToString(),
                                                  ss.필드, ss.학수번호, ss.분반, ss.과목명, ss.학년, ss.학점,
                                                  ss.구분, ss.시강, ss.교수, ss.평가, ss.비고 }));
 }