コード例 #1
0
ファイル: DataAccess.cs プロジェクト: weavver/data
 //-------------------------------------------------------------------------------------------
 public DataAccess(TableView view, int _width, int _height, string DisplayName = null, params String[] roles)
 {
     this.TableViews = view;
        this.AllowedRoles = roles;
        this.Width = _width;
        this.Height = _height;
 }
コード例 #2
0
ファイル: Bugzilla36955.cs プロジェクト: Costo/Xamarin.Forms
		protected override void Init()
		{
			var ts = new TableSection();
			var tr = new TableRoot { ts };
			var tv = new TableView(tr);

			var sc = new SwitchCell
			{
				Text = "Toggle switch; nothing should crash"
			};

			var button = new Button();
			button.SetBinding(Button.TextProperty, new Binding("On", source: sc));

			var vc = new ViewCell
			{
				View = button
			};
			vc.SetBinding(IsEnabledProperty, new Binding("On", source: sc));

			ts.Add(sc);
			ts.Add(vc);

			Content = tv;
		}
コード例 #3
0
ファイル: IndexDynamicTest.cs プロジェクト: agmarchuk/Polar
        public IndexDynamicTest()
        {
            var uniqPath = Path+DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace(":"," ")+ DateTime.Now.Second.ToString()+ @"/";

            Directory.CreateDirectory(uniqPath);
            tableView = new TableView(uniqPath+ "table", TpTableElement);

            tableView.Fill(Enumerable.Range(0, NumberOfRecords).Select(i =>
                (object) (new object[] {i.ToString(), i })));
            // Делаем индекс
            var ha = new IndexHalfkeyImmutable<string>(uniqPath + "dyna_index_str_half")
            {
                Table = tableView,
                KeyProducer = va => (string) ((object[]) (((object[]) va)[1]))[0],
                HalfProducer = k => k.GetHashModifiedBernstein()
            };
            ha.Scale = new ScaleCell(uniqPath + "dyna_index_str_half") {IndexCell = ha.IndexCell};
            ha.Build();
            sIndex = new IndexDynamic<string, IndexHalfkeyImmutable<string>>(true)
            {
                Table = tableView,
                KeyProducer = va => (string) ((object[]) (((object[]) va)[1]))[0],
                IndexArray = ha
            };
            iIndex = new IndexDynamic<int, IIndexImmutable<int>>(true,
                new IndexKeyImmutable<int>(uniqPath + "int", tableView,
                    va => (int) ((object[]) (((object[]) va)[1]))[1],
                    new ScaleCell(uniqPath + "iisndexScale")));

            iIndex.Build();
        }
コード例 #4
0
 //Will be called by the TableView to know what is the height of each row
 public float GetHeightForRowInTableView(TableView tableView, int row)
 {
     //        cellHeight = (tableView.transform as RectTransform).rect.height * 0.13f;
     //        Debug.Log("CellHeight: " + cellHeight);
     //        return cellHeight;
     return (cellPrefab.transform as RectTransform).rect.height;
 }
コード例 #5
0
ファイル: Bugzilla36559.cs プロジェクト: Costo/Xamarin.Forms
        protected override void Init()
        {
            var label = new Label { Text = "Label" };
            var entry = new Entry { AutomationId = "entry" };
            var grid = new Grid();

            grid.Children.Add(label, 0, 0);
            grid.Children.Add(entry, 1, 0);
            var tableView = new TableView
            {
                Root = new TableRoot
                {
                    new TableSection
                    {
                        new ViewCell
                        {
                            View = grid
                        }
                    }
                }
            };

            Content = new StackLayout
            {
                Children = { tableView }
            };
        }
コード例 #6
0
ファイル: Bugzilla38112.cs プロジェクト: Costo/Xamarin.Forms
		protected override void Init ()
		{
			var layout = new StackLayout ();
			var button = new Button { Text = "Click" };
			var tablesection = new TableSection { Title = "Switches" };
			var tableview = new TableView { Intent = TableIntent.Form, Root = new TableRoot { tablesection } };
			var viewcell1 = new ViewCell {
				View = new StackLayout {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Orientation = StackOrientation.Horizontal,
					Children = {
						new Label { Text = "Switch 1", HorizontalOptions = LayoutOptions.StartAndExpand },
						new Switch { AutomationId = "switch1", HorizontalOptions = LayoutOptions.End, IsToggled = true }
					}
				}
			};
			var viewcell2 = new ViewCell {
				View = new StackLayout {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Orientation = StackOrientation.Horizontal,
					Children = {
						new Label { Text = "Switch 2", HorizontalOptions = LayoutOptions.StartAndExpand },
						new Switch { AutomationId = "switch2", HorizontalOptions = LayoutOptions.End, IsToggled = true }
					}
				}
			};
			Label label = new Label { Text = "Switch 3", HorizontalOptions = LayoutOptions.StartAndExpand };
			Switch switchie = new Switch { AutomationId = "switch3", HorizontalOptions = LayoutOptions.End, IsToggled = true, IsEnabled = false };
			switchie.Toggled += (sender, e) => {
				label.Text = "FAIL";
			};
			var viewcell3 = new ViewCell {
				View = new StackLayout {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Orientation = StackOrientation.Horizontal,
					Children = {
						label,
						switchie,
					}
				}
			};

			tablesection.Add (viewcell1);
			tablesection.Add (viewcell2);
			tablesection.Add (viewcell3);

			button.Clicked += (sender, e) => {
				if (_removed)
					tablesection.Insert (1, viewcell2);
				else
					tablesection.Remove (viewcell2);

				_removed = !_removed;
			};

			layout.Children.Add (button);
			layout.Children.Add (tableview);

			Content = layout;
		}
コード例 #7
0
		public MatrixMainPageView ()
		{
			MasterBehavior = Device.OnPlatform(MasterBehavior.Popover,MasterBehavior.Default, MasterBehavior.Default);

			var tabbedPage = new MatrixTabbedPage ();

			var view = new MatrixView (this);
			var settingsPage = new MatrixSettingsPage ();
			var tableView = new TableView (this);

			_viewVm = new MatrixViewModel (view, settingsPage, tableView);
			view.BindingContext = _viewVm;
			view.InitViewModels ();

			settingsPage.BindingContext = _viewVm;


			tableView.BindingContext = _viewVm;

			tabbedPage.Children.Add (view);
			tabbedPage.Children.Add (tableView);

			Master = settingsPage;
			Detail = tabbedPage;

			MessagingCenter.Subscribe<TableView, TableDataItem> (this, MessagingCenterKeys.TableGoToChartKey, OnTableGoToChart);
		}
コード例 #8
0
		private async void OnTableGoToChart (TableView sender, TableDataItem args)
		{
			if (args == null)
				return;

			await NavigateToChart (args.ItemCode, _viewVm.EndDate, args.MsName + " - " + args.WellName);
		}
コード例 #9
0
		public void TestConstructor ()
		{
			var table = new TableView ();

			Assert.False (table.Root.Any ());
			Assert.AreEqual (LayoutOptions.FillAndExpand, table.HorizontalOptions);
			Assert.AreEqual (LayoutOptions.FillAndExpand, table.VerticalOptions);
		}
コード例 #10
0
ファイル: Bugzilla33578.cs プロジェクト: Costo/Xamarin.Forms
		protected override void Init ()
		{
			Content = new TableView {
				Root = new TableRoot {
					new TableSection {
						new EntryCell {
							Placeholder = "Enter text here 1",
							AutomationId = "entryNormal"
						},
						new EntryCell {
							Placeholder = "Enter text here 2"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here"
						},
						new EntryCell {
							Placeholder = "Enter text here",
							AutomationId = "entryPreviousNumeric"
						},
						new EntryCell {
							Keyboard = Keyboard.Numeric,
							Placeholder = "0",
							AutomationId = "entryNumeric"
						}
					}
				}
			};
		}
コード例 #11
0
 //Will be called by the TableView when a cell needs to be created for display
 public TableViewCell GetCellForRowInTableView(TableView tableView, int row) {
     VisibleCounterCell cell = tableView.GetReusableCell(m_cellPrefab.reuseIdentifier) as VisibleCounterCell;
     if (cell == null) {
         cell = (VisibleCounterCell)GameObject.Instantiate(m_cellPrefab);
         cell.name = "VisibleCounterCellInstance_" + (++m_numInstancesCreated).ToString();
     }
     cell.SetRowNumber(row);
     return cell;
 }
コード例 #12
0
ファイル: Bugzilla39486.cs プロジェクト: ytn3rd/Xamarin.Forms
		protected override void Init()
		{
			TextCell cell1 = new TextCell
			{
				Text = "ListView: TextCell"
			};
			cell1.Tapped += async delegate (object sender, EventArgs e)
			{
				await Navigation.PushAsync(new ListViewTextCellPage());
			};
			TextCell cell2 = new TextCell
			{
				Text = "ListView: CustomCell"
			};
			cell2.Tapped += async delegate (object sender, EventArgs e)
			{
				await Navigation.PushAsync(new ListViewCustomCellPage(ListViewCachingStrategy.RetainElement));
			};
			TextCell cell3 = new TextCell
			{
				Text = "TableView: TextCell"
			};
			cell3.Tapped += async delegate (object sender, EventArgs e)
			{
				await Navigation.PushAsync(new TableViewTextCellPage());
			};
			TextCell cell4 = new TextCell
			{
				Text = "TableView: CustomCell"
			};
			cell4.Tapped += async delegate (object sender, EventArgs e)
			{
				await Navigation.PushAsync(new TableViewCustomCellPage());
			};

			TextCell cell5 = new TextCell
			{
				Text = "ListView: CustomCell RecycleElement"
			};
			cell5.Tapped += async delegate (object sender, EventArgs e)
			{
				await Navigation.PushAsync(new ListViewCustomCellPage(ListViewCachingStrategy.RecycleElement));
			};
			TableView tableV = new TableView
			{
				Root = new TableRoot {
					new TableSection {
						cell1,
						cell2,
						cell3,
						cell4,
						cell5
					}
				}
			};
			Content = tableV;
		}
コード例 #13
0
ファイル: AddCapacities.xaml.cs プロジェクト: ddksaku/loreal
        public AddCapacities()
        {
            InitializeComponent();
            view = (grdCustomers.View as TableView);

            if (DesignerProperties.GetIsInDesignMode(this) == false)
            {
                Loaded += new RoutedEventHandler(AddCapacities_Loaded);
            }
        }
コード例 #14
0
		public TableViewModelRenderer(Context context, AListView listView, TableView view) : base(context)
		{
			_view = view;
			Context = context;

			view.ModelChanged += (sender, args) => NotifyDataSetChanged();

			listView.OnItemClickListener = this;
			listView.OnItemLongClickListener = this;
		}
コード例 #15
0
 //Will be called by the TableView when a cell needs to be created for display
 public TableViewCell GetCellForRowInTableView(TableView tableView, int row) {
     DynamicHeightCell cell = tableView.GetReusableCell(m_cellPrefab.reuseIdentifier) as DynamicHeightCell;
     if (cell == null) {
         cell = (DynamicHeightCell)GameObject.Instantiate(m_cellPrefab);
         cell.name = "DynamicHeightCellInstance_" + (++m_numInstancesCreated).ToString();
         cell.onCellHeightChanged.AddListener(OnCellHeightChanged);
     }
     cell.rowNumber = row;
     cell.height = GetHeightOfRow(row);
     return cell;
 }
コード例 #16
0
ファイル: WorkspaceView.cs プロジェクト: hahoyer/HWsqlass.cs
 void AddTable(TableView.IItem item, Rectangle itemRectangle)
 {
     var control = new TableView(item, this)
     {
         Location = new Point(itemRectangle.X, (int) (itemRectangle.Bottom + itemRectangle.Height * 0.5)),
         Size = new Size(itemRectangle.Width * 3, itemRectangle.Height * 10)
     };
     control.LoadData();
     AddItem(control);
     control.OnAdded();
 }
コード例 #17
0
		public void BindingsContextChainsToModel ()
		{
			const string context = "Context";
			var table = new TableView { BindingContext = context, Root = new TableRoot() };

			Assert.AreEqual (context, table.Root.BindingContext);

			// reverse assignment order
			table = new TableView { Root = new TableRoot(), BindingContext = context};
			Assert.AreEqual (context, table.Root.BindingContext);
		}
コード例 #18
0
            public override TableViewCell TableCellForRow(TableView table, int rowIndex)
            {
                TableViewCell cell = table.DequeueReusableCell(m_cellsEntries[rowIndex].type);
                if (cell == null)
                {
                    float width = table.Width;
                    float height = m_cellsEntries[rowIndex].height;
                    return (TableViewCell) Activator.CreateInstance(m_cellsEntries[rowIndex].type, width, height);
                }

                return cell;
            }
コード例 #19
0
		public void TestModelChanged ()
		{
			var table = new TableView ();

			bool changed = false;

			table.ModelChanged += (sender, e) => changed = true;

			table.Root = new TableRoot ("NewRoot");

			Assert.True (changed);
		}
コード例 #20
0
    //Will be called by the TableView when a cell needs to be created for display
    public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
    {
        MyCell cell = tableView.GetReusableCell(cellPrefab.reuseIdentifier) as MyCell;

        if (cell == null)
        {
            cell = (MyCell)GameObject.Instantiate(cellPrefab);
            cell.name = "VisibleCounterCellInstance_" + (++numInstancesCreated).ToString();
        }
        cell.SetIndex(row);
        cell.textLabel.text = "item #" + row;
        return cell;
    }
コード例 #21
0
 public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
 {
     InventoryCell cell = tableView.GetReusableCell(_cellPrefab.reuseIdentifier) as InventoryCell;
     if (cell == null) {
         cell = (InventoryCell)GameObject.Instantiate (_cellPrefab);
     }
     InventoryItem data = _items [row];
     cell.Name.text = data.name;
     cell.Amount.text = data.amount.ToString();
     cell.Icon.sprite = LoadImage (data.name);
     cell.Btn.name = row.ToString(); // save index to button name
     return cell;
 }
コード例 #22
0
		public TextCellTablePage ()
		{
			Title = "TextCell Table Gallery - Legacy";

			Device.OnPlatform (iOS: () => {
				if (Device.Idiom == TargetIdiom.Tablet) {
					Padding = new Thickness (0, 0, 0, 60);
				}
			});

			var tableSection = new TableSection ("Section One") {
				new TextCell { Text = "Text 1" },
				new TextCell { Text = "Text 2", Detail = "Detail 1" },
				new TextCell { Text = "Text 3" },
				new TextCell { Text = "Text 4", Detail = "Detail 2" },
				new TextCell { Text = "Text 5" },
				new TextCell { Text = "Text 6", Detail = "Detail 3" },
				new TextCell { Text = "Text 7" },
				new TextCell { Text = "Text 8", Detail = "Detail 4" },
				new TextCell { Text = "Text 9" },
				new TextCell { Text = "Text 10", Detail = "Detail 5" },
				new TextCell { Text = "Text 11" },
				new TextCell { Text = "Text 12", Detail = "Detail 6" }
			};

			var tableSectionTwo = new TableSection ("Section Two") {
				new TextCell { Text = "Text 13" },
				new TextCell { Text = "Text 14", Detail = "Detail 7" },
				new TextCell { Text = "Text 15" },
				new TextCell { Text = "Text 16", Detail = "Detail 8" },
				new TextCell { Text = "Text 17" },
				new TextCell { Text = "Text 18", Detail = "Detail 9" },
				new TextCell { Text = "Text 19" },
				new TextCell { Text = "Text 20", Detail = "Detail 10" },
				new TextCell { Text = "Text 21" },
				new TextCell { Text = "Text 22", Detail = "Detail 11" },
				new TextCell { Text = "Text 23" },
				new TextCell { Text = "Text 24", Detail = "Detail 12" }
			};

			var root = new TableRoot ("Text Cell table") {
				tableSection,
				tableSectionTwo
			};

			var table = new TableView {
				Root = root,
			};

			Content = table;
		}
コード例 #23
0
 private void AssertVisibleRows(TableView table, params TableViewCell[] cells)
 {
     Assert.AreEqual(cells.Length, table.VisibleCellsCount);
     int index = 0;
     TableViewCell cell = table.FirstVisibleCell;
     TableViewCell lastCell = null;
     while (cell != null)
     {
         Assert.AreSame(cells[index++], cell);
         lastCell = cell;
         cell = cell.NextCell;
     }
     Assert.AreEqual(cells.Length, index);
     Assert.AreSame(lastCell, table.LastVisibleCell);
 }
コード例 #24
0
        //Will be called by the TableView when a cell needs to be created for display
        public TableViewCell GetCellForRowInTableView(TableView tableView, int row) {
            VisibleCounterCell cell = tableView.GetReusableCell(m_cellPrefab.reuseIdentifier) as VisibleCounterCell;
            if (cell == null) {
                cell = (VisibleCounterCell)GameObject.Instantiate(m_cellPrefab);
                cell.name = "VisibleCounterCellInstance_" + (++m_numInstancesCreated).ToString();
            			
            }
            cellCheck = cell;
            rowCheck = row;
			//cell.SetRowNumber(row);
            Invoke("Display",0.1f);
          //	controlManagerMod3.rowValue.Add(row); ,	
           
            return cell;
        }
コード例 #25
0
		public void ParentsViewCells ()
		{
			ViewCell viewCell = new ViewCell { View = new Label () };
			var table = new TableView {
				Platform = new UnitPlatform (),
				Root = new TableRoot {
					new TableSection {
						viewCell
					}
				}
			};

			Assert.AreEqual (table, viewCell.Parent);
			Assert.AreEqual (viewCell, viewCell.View.Parent);
			Assert.AreEqual (table.Platform, viewCell.View.Platform);
		}
コード例 #26
0
		public void ParentsAddedViewCells ()
		{
			var viewCell = new ViewCell { View = new Label () };
			var section = new TableSection (); 
			var table = new TableView {
				Platform = new UnitPlatform (),
				Root = new TableRoot {
					section
				}
			};

			section.Add (viewCell);

			Assert.AreEqual (table, viewCell.Parent);
			Assert.AreEqual (viewCell, viewCell.View.Parent);
			Assert.AreEqual (table.Platform, viewCell.View.Platform);
		}
コード例 #27
0
ファイル: Speed.cs プロジェクト: agmarchuk/Polar
        public static void Main2()
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            string path = "../../../Databases/";
            int NumberOfRecords = 1000000;
            Random rnd = new Random();
            Console.WriteLine("Start Universal Index. Main2()");

            PType tp_table_element = new PTypeRecord(
                new NamedType("name", new PType(PTypeEnumeration.sstring)),
                new NamedType("age", new PType(PTypeEnumeration.integer)));
            IBearingTable table = new TableView(path + "table", tp_table_element);
            sw.Restart();
            bool tobuild = true;
            if (tobuild)
            {
                table.Fill(Enumerable.Range(0, NumberOfRecords).Select(i =>
                    (object)(new object[] { i.ToString(), i == NumberOfRecords / 2 ? -1 : i })));
                sw.Stop();
                Console.WriteLine("Load Table of {0} elements ok. Duration {1}", NumberOfRecords, sw.ElapsedMilliseconds);
            }
            IIndexImmutable<string> s_index = new IndexViewImmutable<string>(path + "s_index")
            {
                Table = table,
                KeyProducer = va => (string)((object[])(((object[])va)[1]))[0]
            };
            if (tobuild)
            {
                sw.Restart();
                s_index.Build();
                sw.Stop();
                Console.WriteLine("s_index Build ok. Duration {0}", sw.ElapsedMilliseconds);
            }
            sw.Restart();
            int cnt = 0;
            for (int i = 0; i < 1000; i++)
            {
                int c = s_index.GetAllByKey(rnd.Next(NumberOfRecords * 3 / 2 - 1).ToString()).Count();
                if (c > 1) Console.WriteLine("Unexpected Error: {0}", c);
                cnt += c;
            }
            sw.Stop();
            Console.WriteLine("1000 GetAllByKey ok. Duration={0} cnt={1}", sw.ElapsedMilliseconds, cnt);
        }
コード例 #28
0
		public TableViewGallery () {

			var section = new TableSection ("Section One") {
				new ViewCell { View = new Label { Text = "View Cell 1" } },
				new ViewCell { View = new Label { Text = "View Cell 2" } }
			};

			var root = new TableRoot ("Table") {
				section
			};

			var tableLayout = new TableView {
				Root = root,
				RowHeight = 100
			};

			Content = tableLayout;
		}
コード例 #29
0
ファイル: FrmMain.cs プロジェクト: raydtang/scada
        private bool groupByObj;            // признак группировки каналов по объектам


        /// <summary>
        /// Конструктор
        /// </summary>
        public FrmMain()
        {
            InitializeComponent();

            // инициализация полей
            tableView = null;
            items = null;
            fileName = "";
            modified = false;
            exeDir = "";
            baseDATDir = "";
            baseLoaded = false;
            tblInCnl = new DataTable();
            tblCtrlCnl = new DataTable();
            tblObj = new DataTable();
            tblKP = new DataTable();
            groupByObj = false;
        }
コード例 #30
0
        private string VisibleCellsToString(TableView table)
        {
            StringBuilder buffer = new StringBuilder("[");
            int index = 0;
            for (TableViewCell cell = table.FirstVisibleCell; cell != null; cell = cell.NextCell)
            {
                ConsoleTextEntryView textCell = cell as ConsoleTextEntryView;
                Assert.IsNotNull(textCell);

                buffer.Append(textCell.Value);
                if (++index < table.VisibleCellsCount)
                {
                    buffer.Append(", ");
                }
            }

            buffer.Append("]");
            return buffer.ToString();
        }
コード例 #31
0
 public float SizeForRowInTableView(TableView tableView, int row)
 {
     return(600f);
 }
コード例 #32
0
 public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
 {
     TableView.DeselectRow(indexPath, true);
 }
コード例 #33
0
ファイル: MenuPage.cs プロジェクト: ShivamS1234/DVidyaERP
        public MenuPage(RootPage rootPage, int _hostMenu = 0)
        {
            Icon  = "menu.png";
            Title = "menu";             // The Title property must be set.

            this.rootPage = rootPage;

            var logoutButton = new Button {
                Text = "Logout", TextColor = Color.White, BackgroundColor = App.BrandColor
            };

            logoutButton.Clicked += (sender, e) =>
            {
                Application.Current.MainPage = new NavigationPage(new LogInPage())
                {
                    BarBackgroundColor = Color.FromHex("#F8A51B"), BarTextColor = Color.White
                };
                //set menulogout
                Constants.MenuLogout = true;
            };

            var layout = new StackLayout
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                //BackgroundColor = Color.FromHex("#8DB640"),
                BackgroundColor = App.BrandColor
            };
            var section = new TableSection();

            section.Clear();
            section = new TableSection();
            if (UserType.currentUserType == UserType.enumUserType.Faculty)
            {
                section.Add(new MenuCell {
                    Text = "Take Attendance", Host = this, ImageSrc = "takeAttendanceIcon.png"
                });
            }


            section.Add(new MenuCell {
                Text = "Show Attendance", Host = this, ImageSrc = "showAttendanceIcon.png"
            });
            section.Add(new MenuCell {
                Text = "Time Table", Host = this, ImageSrc = "timetableicon.png"
            });
            section.Add(new MenuCell {
                Text = "Notice Board", Host = this, ImageSrc = "noticeicon.png"
            });
            section.Add(new MenuCell {
                Text = "Fees", Host = this, ImageSrc = "feesicon.png"
            });
            section.Add(new MenuCell {
                Text = "Gallery", Host = this, ImageSrc = "galleryIcon.png"
            });
            section.Add(new MenuCell {
                Text = "Sync Data", Host = this, ImageSrc = "synIcon.png"
            });

            var root = new TableRoot()
            {
                section
            };

            tableView = new MenuTableView()
            {
                Root   = root,
                Intent = TableIntent.Data,
                Margin = new Thickness(0, 0, 0, 0),
            };



            var settingView = new SettingsUserView();

            layout.Children.Add(settingView);

            layout.Children.Add(tableView);
            layout.Children.Add(logoutButton);

            Content = layout;

            //set settingView click event
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped +=
                (sender, e) =>
            {
                setProfile_Click();
            };
            settingView.GestureRecognizers.Add(tapGestureRecognizer);
            //set profile button delegate
            settingView.btnProfile.Clicked +=
                delegate {
                setProfile_Click();
            };
            if (_hostMenu > 0)
            {
                if (_hostMenu == 1)
                {
                    Selected("Take Attendance");
                }
                else if (_hostMenu == 2)
                {
                    Selected("Show Attendance");
                }
                else if (_hostMenu == 3)
                {
                    Selected("Time Table");
                }
            }
        }
コード例 #34
0
        private Database InternalLoad()
        {
            string    sql = @"select sch.schema_id, sch.name as schema_name, tv.object_id as tableview_id, tv.name as tableview_name,
        tv.type as tableview_type, col.column_id, col.name as column_name, typ.name as type_name, col.max_length as type_length,
		col.is_nullable, convert(bit,(case when pk.column_id is not null then 1 else 0 end)) as pk
from sys.schemas sch
inner join sys.objects tv on sch.schema_id=tv.schema_id
inner join sys.columns col on tv.object_id=col.object_id
inner join sys.types typ on col.user_type_id=typ.user_type_id
left join (select o.object_id, ic.column_id
            from sys.objects o inner join sys.indexes i on o.object_id=i.object_id and i.is_primary_key=1
            inner join sys.index_columns ic on o.object_id=ic.object_id and i.index_id=ic.index_id
          ) pk on tv.object_id=pk.object_id and col.column_id=pk.column_id
where tv.type in ('U','V')
order by sch.name, tv.name, col.name, typ.name
"; //All user tables/views with column data in all schemas in the database
            DataTable dt  = AdHocSql(sql);

            Database  db             = new Database(DatabaseName, string.Empty); //MSSQL databases don't really have IDs
            Schema    schema         = null;                                     //Schema being built from metadata -- schemas may span rows
            TableView tv             = null;                                     //Table/view being built from metadata -- tables/views may span rows
            string    prevSchemaName = string.Empty;                             //Keeps track of schema of previous row
            string    prevTVName     = string.Empty;                             //Keeps track of table/view of previous row

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row = dt.Rows[i]; //Row contains schema, table/view, and column data

                //Determine database objects described by this row of metadata
                string schemaName               = row["schema_name"].ToString();
                string schemaId                 = row["schema_id"].ToString();
                string tvName                   = row["tableview_name"].ToString();
                string tvId                     = row["tableview_id"].ToString();
                string tvTypeString             = row["tableview_type"].ToString().ToLower().Trim();
                TableView.TableViewTypes tvType = (TableView.TableViewTypes)(-1); //Set initially to invalid value
                if (tvTypeString == "u")
                {
                    tvType = TableView.TableViewTypes.Table;
                }
                else if (tvTypeString == "v")
                {
                    tvType = TableView.TableViewTypes.View;
                }

                if (!schemaName.Equals(prevSchemaName))
                {
                    //Start new schema if the current row isn't a continuation of the same schema referenced by previous row
                    schema = new Schema(schemaName, schemaId, db);
                }
                if (!tvName.Equals(prevTVName))
                {
                    //Start new table/view if the current row isn't a continuation of the same table/view referenced by previous row
                    tv = new TableView(tvName, tvId, schema, tvType);
                }

                //Get column metadata for current row
                string columnName = row["column_name"].ToString();
                string columnId   = row["column_id"].ToString();
                string typeName   = row["type_name"].ToString();
                string typeLength = row["type_length"].ToString();
                bool   isDate     = false;
                bool   nullable   = (row["is_nullable"] == DBNull.Value) ? false : bool.Parse(row["is_nullable"].ToString());
                bool   pk         = (row["pk"] == DBNull.Value) ? false : bool.Parse(row["pk"].ToString());

                if (typeLength == "-1")
                {
                    //Length -1 means unlimited (max) length
                    typeName = typeName + "(max)";
                }
                else if (dateDataTypes.Contains(typeName))
                {
                    isDate = true;
                }
                else if (intDataTypes.Contains(typeName))
                {
                    //Do nothing
                }
                else
                {
                    //For other random types, add in the column length in parens
                    typeName = typeName + "(" + typeLength + ")";
                }

                Column column = new Column(columnName, columnId, tv, typeName, nullable, pk);

                //Save this row's schema and table names so we can compare them with the next row of data
                prevSchemaName = schemaName;
                prevTVName     = tvName;
            }


            return(db);
        }
コード例 #35
0
 static void SubscribeViewEvents(TableView view)
 {
     view.AddHandler(TableView.MouseLeftButtonUpEvent, new MouseButtonEventHandler(OnMouseLeftButtonUp), true);
     view.Grid.AddHandler(GridControl.GroupRowExpandingEvent, new RowAllowEventHandler(OnGroupRowExpanding));
 }
コード例 #36
0
 public void Constructor4a_NullSchema()
 {
     TableView tv = new TableView("TV NAME", "TV ID", null, TableView.TableViewTypes.Table);
 }
コード例 #37
0
        private void Populate()
        {
            Vector2 stageSize = NUIApplication.GetDefaultWindow().WindowSize;

            mTotalPages = (uint)((mExampleList.Count() + EXAMPLES_PER_PAGE - 1) / EXAMPLES_PER_PAGE);

            // Populate ScrollView.
            if (mExampleList.Count() > 0)
            {
                if (mSortAlphabetically)
                {
                    mExampleList.Sort(Example.CompareByTitle);
                }

                int pageCount = mExampleList.Count / (ROWS_PER_PAGE * EXAMPLES_PER_ROW) + ((0 == mExampleList.Count % (ROWS_PER_PAGE * EXAMPLES_PER_ROW)) ? 0 : 1);
                mPages = new View[pageCount];

                int pageIndex = 0;

                uint exampleCount = 0;

                for (int t = 0; t < mTotalPages; t++)
                {
                    // Create Table
                    TableView page = new TableView(ROWS_PER_PAGE, EXAMPLES_PER_ROW);
                    page.PositionUsesPivotPoint = true;
                    page.PivotPoint             = PivotPoint.Center;
                    page.ParentOrigin           = ParentOrigin.Center;
                    page.WidthResizePolicy      = page.HeightResizePolicy = ResizePolicyType.FillToParent;
                    mScrollView.Add(page);

                    // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
                    const float margin = 2.0f;
                    const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;

                    for (uint row = 0; row < ROWS_PER_PAGE; row++)
                    {
                        for (uint column = 0; column < EXAMPLES_PER_ROW; column++)
                        {
                            Example example = mExampleList.ElementAt((int)exampleCount++);

                            // Calculate the tiles relative position on the page (between 0 & 1 in each dimension).
                            Vector2 position = new Vector2((float)(column) / (EXAMPLES_PER_ROW - 1.0f), (float)(row) / (EXAMPLES_PER_ROW - 1.0f));
                            View    tile     = CreateTile(example.Name, example.Title, new Vector3(tileParentMultiplier, tileParentMultiplier, 1.0f), position);

                            tile.SetPadding(new PaddingType((int)margin, (int)margin, (int)margin, (int)margin));
                            page.AddChild(tile, new TableView.CellPosition(row, column));

                            tiles.Add(tile);

                            if (exampleCount == mExampleList.Count)
                            {
                                break;
                            }
                        }

                        if (exampleCount == mExampleList.Count)
                        {
                            break;
                        }
                    }

                    mPages[pageIndex++] = page;

                    if (exampleCount == mExampleList.Count)
                    {
                        break;
                    }
                }
            }

            // Update Ruler info.
            mScrollRulerX = new RulerPtr(new FixedRuler(mPageWidth));
            mScrollRulerY = new RulerPtr(new DefaultRuler());
            mScrollRulerX.SetDomain(new RulerDomain(0.0f, (mTotalPages + 1) * stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f, true));
            mScrollRulerY.Disable();
            mScrollView.SetRulerX(mScrollRulerX);
            mScrollView.SetRulerY(mScrollRulerY);
        }
コード例 #38
0
        public void TestCanPlotDisclosureIndicators()
        {
            var tableView = new TableView
            {
                Sections = new[]
                {
                    new TableViewSection
                    {
                        Header = new IosTableViewHeaderCell {
                            Text = "Mammals"
                        }, Cells = new[]
                        {
                            new IosTableViewCell("Elephant", TableViewCellAccessory.DisclosureIndicator),
                            new IosTableViewCell("Giraffe", TableViewCellAccessory.DisclosureIndicator),
                            new IosTableViewCell("Monkey", TableViewCellAccessory.DisclosureIndicator),
                            new IosTableViewCell("Cat", TableViewCellAccessory.DisclosureIndicator)
                        }
                    },
                    new TableViewSection
                    {
                        Header = new IosTableViewHeaderCell {
                            Text = "Reptiles"
                        }, Cells = new[]
                        {
                            new IosTableViewCell("Lizard", TableViewCellAccessory.DisclosureIndicator),
                            new IosTableViewCell("Snake", TableViewCellAccessory.DisclosureIndicator),
                            new IosTableViewCell("Crocodile", TableViewCellAccessory.DisclosureIndicator)
                        }
                    }
                }
            };

            tableView.AssertOutputEquals(
                "     _____________\r\n" +
                "    |Mammals      |\r\n" +
                "    |_____________|\r\n" +
                "    | Elephant  > |\r\n" +
                "    | Giraffe   > |\r\n" +
                "    | Monkey    > |\r\n" +
                "    | Cat       > |\r\n" +
                "    |_____________|\r\n" +
                "    |Reptiles     |\r\n" +
                "    |_____________|\r\n" +
                "    | Lizard    > |\r\n" +
                "    | Snake     > |\r\n" +
                "    | Crocodile > |\r\n" +
                "    |_____________|\r\n",
                "<pre><code> _____________\n" +
                "|Mammals      |\n" +
                "|_____________|\n" +
                "| Elephant  &gt; |\n" +
                "| Giraffe   &gt; |\n" +
                "| Monkey    &gt; |\n" +
                "| Cat       &gt; |\n" +
                "|_____________|\n" +
                "|Reptiles     |\n" +
                "|_____________|\n" +
                "| Lizard    &gt; |\n" +
                "| Snake     &gt; |\n" +
                "| Crocodile &gt; |\n" +
                "|_____________|\n" +
                "</code></pre>\n\n");
        }
        void SetContent(FlowDirection direction)
        {
            var hOptions = LayoutOptions.Start;

            var imageCell = new DataTemplate(typeof(ImageCell));

            imageCell.SetBinding(ImageCell.ImageSourceProperty, ".");
            imageCell.SetBinding(ImageCell.TextProperty, ".");

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

            textCell.SetBinding(TextCell.DetailProperty, ".");

            var entryCell = new DataTemplate(typeof(EntryCell));

            entryCell.SetBinding(EntryCell.TextProperty, ".");

            var switchCell = new DataTemplate(typeof(SwitchCell));

            switchCell.SetBinding(SwitchCell.OnProperty, ".");
            switchCell.SetValue(SwitchCell.TextProperty, "Switch Cell!");

            var vc = new ViewCell
            {
                View = new StackLayout
                {
                    Children = { new Label {
                                     HorizontalOptions = hOptions, Text = "View Cell! I have context actions."
                                 } }
                }
            };

            var a1 = new MenuItem {
                Text = "First"
            };

            vc.ContextActions.Add(a1);
            var a2 = new MenuItem {
                Text = "Second"
            };

            vc.ContextActions.Add(a2);

            var viewCell = new DataTemplate(() => vc);

            var relayout = new Switch
            {
                IsToggled         = true,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center
            };

            var flipButton = new Button
            {
                Text = direction == FlowDirection.RightToLeft ? "Switch to Left To Right" : "Switch to Right To Left",
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };

            flipButton.Clicked += (s, e) =>
            {
                FlowDirection newDirection;
                if (direction == FlowDirection.LeftToRight || direction == FlowDirection.MatchParent)
                {
                    newDirection = FlowDirection.RightToLeft;
                }
                else
                {
                    newDirection = FlowDirection.LeftToRight;
                }

                if (relayout.IsToggled)
                {
                    ParentPage.FlowDirection = newDirection;

                    direction = newDirection;

                    flipButton.Text = direction == FlowDirection.RightToLeft ? "Switch to Left To Right" : "Switch to Right To Left";

                    return;
                }

                if (ParentPage == this)
                {
                    FlowDirectionGalleryLandingPage.PushContentPage(newDirection);
                    return;
                }
                string parentType = ParentPage.GetType().ToString();
                switch (parentType)
                {
                case "Xamarin.Forms.Controls.FlowDirectionGalleryMDP":
                    FlowDirectionGalleryLandingPage.PushMasterDetailPage(newDirection);
                    break;

                case "Xamarin.Forms.Controls.FlowDirectionGalleryCarP":
                    FlowDirectionGalleryLandingPage.PushCarouselPage(newDirection);
                    break;

                case "Xamarin.Forms.Controls.FlowDirectionGalleryNP":
                    FlowDirectionGalleryLandingPage.PushNavigationPage(newDirection);
                    break;

                case "Xamarin.Forms.Controls.FlowDirectionGalleryTP":
                    FlowDirectionGalleryLandingPage.PushTabbedPage(newDirection);
                    break;
                }
            };

            var horStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    = { flipButton, new Label {
                                    Text = "Relayout", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center
                                },             relayout }
            };

            var grid = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                }
            };

            int col = 0;
            int row = 0;

            var ai = AddView <ActivityIndicator>(grid, ref col, ref row);

            ai.IsRunning = true;

            var box = AddView <BoxView>(grid, ref col, ref row);

            box.WidthRequest    = box.HeightRequest = 20;
            box.BackgroundColor = Color.Purple;

            var btn = AddView <Button>(grid, ref col, ref row);

            btn.Text = "Some text";

            var date = AddView <DatePicker>(grid, ref col, ref row, 2);

            var edit = AddView <Editor>(grid, ref col, ref row);

            edit.WidthRequest  = 100;
            edit.HeightRequest = 100;
            edit.Text          = "Some longer text for wrapping";

            var entry = AddView <Entry>(grid, ref col, ref row);

            entry.WidthRequest = 100;
            entry.Text         = "Some text";

            var image = AddView <Image>(grid, ref col, ref row);

            image.Source = "oasis.jpg";

            var lbl1 = AddView <Label>(grid, ref col, ref row);

            lbl1.WidthRequest            = 100;
            lbl1.HorizontalTextAlignment = TextAlignment.Start;
            lbl1.Text = "Start text";

            var lblLong = AddView <Label>(grid, ref col, ref row);

            lblLong.WidthRequest            = 100;
            lblLong.HorizontalTextAlignment = TextAlignment.Start;
            lblLong.Text = "Start text that should wrap and wrap and wrap";

            var lbl2 = AddView <Label>(grid, ref col, ref row);

            lbl2.WidthRequest            = 100;
            lbl2.HorizontalTextAlignment = TextAlignment.End;
            lbl2.Text = "End text";

            var lbl3 = AddView <Label>(grid, ref col, ref row);

            lbl3.WidthRequest            = 100;
            lbl3.HorizontalTextAlignment = TextAlignment.Center;
            lbl3.Text = "Center text";

            //var ogv = AddView<OpenGLView>(grid, ref col, ref row, hOptions, vOptions, margin);

            var pkr = AddView <Picker>(grid, ref col, ref row);

            pkr.ItemsSource = Enumerable.Range(0, 10).ToList();

            var sld = AddView <Slider>(grid, ref col, ref row);

            sld.WidthRequest = 100;
            sld.Maximum      = 10;
            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                sld.Value += 1;
                if (sld.Value == 10d)
                {
                    sld.Value = 0;
                }
                return(true);
            });

            var stp = AddView <Stepper>(grid, ref col, ref row);

            var swt = AddView <Switch>(grid, ref col, ref row);

            var time = AddView <TimePicker>(grid, ref col, ref row, 2);

            var prog = AddView <ProgressBar>(grid, ref col, ref row, 2);

            prog.WidthRequest    = 200;
            prog.BackgroundColor = Color.DarkGray;
            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                prog.Progress += .1;
                if (prog.Progress == 1d)
                {
                    prog.Progress = 0;
                }
                return(true);
            });

            var srch = AddView <SearchBar>(grid, ref col, ref row, 2);

            srch.WidthRequest = 200;
            srch.Text         = "Some text";

            TableView tbl = new TableView
            {
                Intent = TableIntent.Menu,
                Root   = new TableRoot
                {
                    new TableSection("TableView")
                    {
                        new TextCell
                        {
                            Text = "A",
                        },

                        new TextCell
                        {
                            Text = "B",
                        },

                        new TextCell
                        {
                            Text = "C",
                        },

                        new TextCell
                        {
                            Text = "D",
                        },
                    }
                }
            };

            var stack = new StackLayout
            {
                Children = { new Button   {
                                 Text = "Go back to Gallery home", Command = new Command(() =>{ ((App)Application.Current).SetMainPage(((App)Application.Current).CreateDefaultMainPage());                                                        })
                             },
                             new Label    {
                                 Text = $"Device Direction: {DeviceDirection}"
                             },
                             horStack,
                             grid,
                             new Label    {
                                 Text = "TableView", FontSize = 10, TextColor = Color.DarkGray
                             },
                             tbl,
                             new Label    {
                                 Text = "ListView w/ TextCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "Text Cell!"), ItemTemplate = textCell
                             },
                             new Label    {
                                 Text = "ListView w/ SwitchCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => true), ItemTemplate = switchCell
                             },
                             new Label    {
                                 Text = "ListView w/ EntryCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "Entry Cell!"), ItemTemplate = entryCell
                             },
                             new Label    {
                                 Text = "ListView w/ ImageCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "coffee.png"), ItemTemplate = imageCell
                             },
                             new Label    {
                                 Text = "ListView w/ ViewCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3), ItemTemplate = viewCell
                             }, },

                HorizontalOptions = hOptions
            };

            Content = new ScrollView
            {
                Content = stack
            };
        }
コード例 #40
0
        public TextCellTablePage()
        {
            Title = "TextCell Table Gallery - Legacy";

            Device.OnPlatform(iOS: () => {
                if (Device.Idiom == TargetIdiom.Tablet)
                {
                    Padding = new Thickness(0, 0, 0, 60);
                }
            });

            var tableSection = new TableSection("Section One")
            {
                new TextCell {
                    Text = "Text 1"
                },
                new TextCell {
                    Text = "Text 2", Detail = "Detail 1"
                },
                new TextCell {
                    Text = "Text 3"
                },
                new TextCell {
                    Text = "Text 4", Detail = "Detail 2"
                },
                new TextCell {
                    Text = "Text 5"
                },
                new TextCell {
                    Text = "Text 6", Detail = "Detail 3"
                },
                new TextCell {
                    Text = "Text 7"
                },
                new TextCell {
                    Text = "Text 8", Detail = "Detail 4"
                },
                new TextCell {
                    Text = "Text 9"
                },
                new TextCell {
                    Text = "Text 10", Detail = "Detail 5"
                },
                new TextCell {
                    Text = "Text 11"
                },
                new TextCell {
                    Text = "Text 12", Detail = "Detail 6"
                }
            };

            var tableSectionTwo = new TableSection("Section Two")
            {
                new TextCell {
                    Text = "Text 13"
                },
                new TextCell {
                    Text = "Text 14", Detail = "Detail 7"
                },
                new TextCell {
                    Text = "Text 15"
                },
                new TextCell {
                    Text = "Text 16", Detail = "Detail 8"
                },
                new TextCell {
                    Text = "Text 17"
                },
                new TextCell {
                    Text = "Text 18", Detail = "Detail 9"
                },
                new TextCell {
                    Text = "Text 19"
                },
                new TextCell {
                    Text = "Text 20", Detail = "Detail 10"
                },
                new TextCell {
                    Text = "Text 21"
                },
                new TextCell {
                    Text = "Text 22", Detail = "Detail 11"
                },
                new TextCell {
                    Text = "Text 23"
                },
                new TextCell {
                    Text = "Text 24", Detail = "Detail 12"
                }
            };

            var root = new TableRoot("Text Cell table")
            {
                tableSection,
                tableSectionTwo
            };

            var table = new TableView {
                Root = root,
            };

            Content = table;
        }
コード例 #41
0
 public CallHistoryController(IntPtr handle) : base(handle)
 {
     TableView.RegisterClassForCellReuse(typeof(UITableViewCell), callHistoryCellId);
     TableView.Source = new CallHistoryDataSource(this);
     PhoneNumbers     = new List <string>();
 }
コード例 #42
0
        public LampadasView()
        {
            BindingContext = new ViewModels.LampadasViewModel();
            Title          = "Lampadas";

            var table = new TableView();


            var quarto = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            quarto.Children.Add(new Image()
            {
                //Source = "icon.png"
                //Aspect = Aspect.AspectFit,
                Source = "lamp.png"
            });

            Switch quartoSw = new Switch();

            //quartoSw.Toggled += QuartoToggled;

            quartoSw.SetBinding(Switch.IsToggledProperty, new Binding("QuartoSw"));
            //a.SetBinding(Switch.IsToggledProperty , new Binding("swcommand"));
            quarto.Children.Add(quartoSw);

            quarto.Children.Add(new Label()
            {
                Text              = "Quarto",
                TextColor         = Color.Gray,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });


            var sala = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            sala.Children.Add(new Image()
            {
                Source = "lamp.png"
            });
            Switch salaSw = new Switch();

            //salaSw.Toggled += SalaToggled;

            salaSw.SetBinding(Switch.IsToggledProperty, new Binding("SalaDeEstarSw"));
            sala.Children.Add(salaSw);
            sala.Children.Add(new Label()
            {
                Text              = "Sala de Estar",
                TextColor         = Color.Gray,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });

            var cozinha = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            cozinha.Children.Add(new Image()
            {
                Source = "lamp.png"
            });
            Switch cozinhaSw = new Switch();

            //cozinhaSw.Toggled += CozinhaToggled;
            cozinhaSw.SetBinding(Switch.IsToggledProperty, new Binding("CozinhaSw"));
            cozinha.Children.Add(cozinhaSw);
            cozinha.Children.Add(new Label()
            {
                Text              = "Cozinha",
                TextColor         = Color.Gray,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });

            var garagem = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            garagem.Children.Add(new Image()
            {
                Source = "lamp.png"
            });
            Switch garagemSw = new Switch();

            //garagemSw.Toggled += GaragemToggled;

            garagemSw.SetBinding(Switch.IsToggledProperty, new Binding("GaragemSw"));
            garagem.Children.Add(garagemSw);
            garagem.Children.Add(new Label()
            {
                Text              = "Garagem",
                TextColor         = Color.Gray,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });

            var quartoSuite = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            quartoSuite.Children.Add(new Image()
            {
                Source = "lamp.png"
            });
            Switch quartoSuiteSw = new Switch();

            //quartoSuiteSw.Toggled += QuartoSuiteToggled;
            quartoSuiteSw.SetBinding(Switch.IsToggledProperty, new Binding("QuartoSuiteSw"));
            quartoSuite.Children.Add(quartoSuiteSw);
            quartoSuite.Children.Add(new Label()
            {
                Text              = "Quarto Suite",
                TextColor         = Color.Gray,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });

            var corredor = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            corredor.Children.Add(new Image()
            {
                Source = "lamp.png"
            });
            Switch corredorSw = new Switch();

            corredorSw.SetBinding(Switch.IsToggledProperty, new Binding("CorredorSw"));
            corredor.Children.Add(corredorSw);

            corredor.Children.Add(new Label()
            {
                Text              = "Corredor",
                TextColor         = Color.Gray,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });


            table.Root = new TableRoot()
            {
                //titulo da view
                //new TableSection("Automação Residencial") {
                new TableSection()
                {
                    new ViewCell()
                    {
                        View = quarto
                    },
                    new ViewCell()
                    {
                        View = sala
                    },
                    new ViewCell()
                    {
                        View = cozinha
                    },
                    new ViewCell()
                    {
                        View = garagem
                    },
                    new ViewCell()
                    {
                        View = quartoSuite
                    },
                    new ViewCell()
                    {
                        View = corredor
                    }
                }
            };

            Content = table;
        }
コード例 #43
0
        public ConsoleGuiSqlEditor(IBasicActivateItems activator, IViewSQLAndResultsCollection collection)
        {
            this.Activator   = activator;
            this._collection = collection;
            Modal            = true;
            ColorScheme      = ConsoleMainWindow.ColorScheme;

            // Tabs (query and results)
            TabView = new TabView()
            {
                Width = Dim.Fill(), Height = Dim.Fill(), Y = 1
            };

            textView = new SqlTextView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
                Text   = _orignalSql = collection.GetSql().Replace("\r\n", "\n").Replace("\t", "    ")
            };

            textView.AllowsTab = false;

            TabView.AddTab(queryTab = new Tab("Query", textView), true);

            tableView = new TableView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            tableView.Style.AlwaysShowHeaders = true;
            tableView.CellActivated          += TableView_CellActivated;

            TabView.AddTab(resultTab = new Tab("Results", tableView), false);

            Add(TabView);

            // Buttons on top of control

            _btnRunOrCancel = new Button("Run")
            {
                X = 0,
                Y = 0,
            };

            _btnRunOrCancel.Clicked += () => RunOrCancel();
            Add(_btnRunOrCancel);

            var resetSql = new Button("Reset Sq_l")
            {
                X = Pos.Right(_btnRunOrCancel) + 1
            };

            resetSql.Clicked += () => ResetSql();
            Add(resetSql);

            var clearSql = new Button("Clear S_ql")
            {
                X = Pos.Right(resetSql) + 1,
            };

            clearSql.Clicked += () => ClearSql();
            Add(clearSql);

            var lblTimeout = new Label("Timeout:")
            {
                X = Pos.Right(clearSql) + 1,
            };

            Add(lblTimeout);

            var tbTimeout = new TextField(_timeout.ToString())
            {
                X     = Pos.Right(lblTimeout),
                Width = 5
            };

            tbTimeout.TextChanged += TbTimeout_TextChanged;

            Add(tbTimeout);

            var btnSave = new Button("Save")
            {
                X = Pos.Right(tbTimeout) + 1,
            };

            btnSave.Clicked += () => Save();
            Add(btnSave);

            var btnClose = new Button("Clos_e")
            {
                X = Pos.Right(btnSave) + 1,
            };


            btnClose.Clicked += () => {
                Application.RequestStop();
            };

            Add(btnClose);

            var auto = new AutoCompleteProvider(collection.GetQuerySyntaxHelper());

            collection.AdjustAutocomplete(auto);
            var bits = auto.Items.SelectMany(auto.GetBits).OrderBy(a => a).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();

            textView.Autocomplete.AllSuggestions = bits;
            textView.Autocomplete.MaxWidth       = 40;
        }
コード例 #44
0
ファイル: Issue2883.cs プロジェクト: zhamppx97/maui
        protected override void Init()
        {
            var btnCustom1 = new Button()
            {
                AutomationId      = "btnCustomCellTable",
                Text              = "Custom Table Cell",
                HorizontalOptions = LayoutOptions.Start
            };
            var btnCustom1Enabled = new Button()
            {
                AutomationId      = "btnCustomCellTableEnabled",
                Text              = "Custom Table Cell Enabled",
                HorizontalOptions = LayoutOptions.Start
            };

            var btnCustom = new Button()
            {
                AutomationId      = "btnCustomCellListView",
                Text              = "Custom Cell",
                HorizontalOptions = LayoutOptions.Start
            };

            var btnCustomEnabled = new Button()
            {
                AutomationId      = "btnCustomCellListViewEnabled",
                Text              = "Custom Cell Enabled",
                HorizontalOptions = LayoutOptions.Start
            };

            btnCustom.Clicked += (object sender, EventArgs e) =>
            {
                DisplayAlert("Clicked", "I was clicked even disabled", "ok");
            };
            btnCustom1.Clicked += (object sender, EventArgs e) =>
            {
                DisplayAlert("Clicked", "I was clicked even disabled", "ok");
            };

            btnCustom1Enabled.Clicked += (object sender, EventArgs e) =>
            {
                DisplayAlert("Clicked", "I was clicked", "ok");
            };
            btnCustomEnabled.Clicked += (object sender, EventArgs e) =>
            {
                DisplayAlert("Clicked", "I was clicked", "ok");
            };

            var customCell = new ViewCell()
            {
                IsEnabled = false,
                View      = new StackLayout {
                    Children = { btnCustom }
                }
            };

            var customCellEnabled = new ViewCell()
            {
                View = new StackLayout {
                    Children = { btnCustomEnabled }
                }
            };

            var customTableCell = new ViewCell()
            {
                IsEnabled = false,
                View      = new StackLayout {
                    Children = { btnCustom1 }
                }
            };

            var customTableCellEnabled = new ViewCell()
            {
                View = new StackLayout {
                    Children = { btnCustom1Enabled }
                }
            };

            var tableview = new TableView()
            {
                Intent          = TableIntent.Form,
                Root            = new TableRoot(),
                VerticalOptions = LayoutOptions.Start
            };

            tableview.Root.Add(new TableSection()
            {
                customTableCell, customTableCellEnabled
            });

            var listview = new ListView {
                VerticalOptions = LayoutOptions.Start
            };
            var listview2 = new ListView {
                VerticalOptions = LayoutOptions.Start
            };

            listview.ItemTemplate  = new DataTemplate(() => customCell);
            listview2.ItemTemplate = new DataTemplate(() => customCellEnabled);
            listview2.ItemsSource  = listview.ItemsSource = new List <string>()
            {
                "1"
            };

            Content = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.Start,
                Children        = { tableview, listview, listview2 }
            };
        }
コード例 #45
0
        public EntryCellTablePage()
        {
            Title = "EntryCell Table Gallery - Legacy";

            if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet)
            {
                Padding = new Thickness(0, 0, 0, 60);
            }

            int timesEntered = 1;

            var entryCell = new EntryCell {
                Label = "Enter text", Placeholder = "I am a placeholder"
            };

            entryCell.Completed += (sender, args) =>
            {
                ((EntryCell)sender).Label = "Entered: " + timesEntered;
                timesEntered++;
            };

            var tableSection = new TableSection("Section One")
            {
                new EntryCell {
                    Label = "disabled", Placeholder = "disabled", IsEnabled = false
                },
                new EntryCell {
                    Label = "Text 2"
                },
                new EntryCell {
                    Label = "Text 3", Placeholder = "Placeholder 2"
                },
                new EntryCell {
                    Label = "Text 4"
                },
                new EntryCell {
                    Label = "Text 5", Placeholder = "Placeholder 3"
                },
                new EntryCell {
                    Label = "Text 6"
                },
                new EntryCell {
                    Label = "Text 7", Placeholder = "Placeholder 4"
                },
                new EntryCell {
                    Label = "Text 8"
                },
                new EntryCell {
                    Label = "Text 9", Placeholder = "Placeholder 5"
                },
                new EntryCell {
                    Label = "Text 10"
                },
                new EntryCell {
                    Label = "Text 11", Placeholder = "Placeholder 6"
                },
                new EntryCell {
                    Label = "Text 12"
                },
                new EntryCell {
                    Label = "Text 13", Placeholder = "Placeholder 7"
                },
                new EntryCell {
                    Label = "Text 14"
                },
                new EntryCell {
                    Label = "Text 15", Placeholder = "Placeholder 8"
                },
                new EntryCell {
                    Label = "Text 16"
                },
                entryCell
            };

            var tableSectionTwo = new TableSection("Section Two")
            {
                new EntryCell {
                    Label = "Text 17", Placeholder = "Placeholder 9"
                },
                new EntryCell {
                    Label = "Text 18"
                },
                new EntryCell {
                    Label = "Text 19", Placeholder = "Placeholder 10"
                },
                new EntryCell {
                    Label = "Text 20"
                },
                new EntryCell {
                    Label = "Text 21", Placeholder = "Placeholder 11"
                },
                new EntryCell {
                    Label = "Text 22"
                },
                new EntryCell {
                    Label = "Text 23", Placeholder = "Placeholder 12"
                },
                new EntryCell {
                    Label = "Text 24"
                },
                new EntryCell {
                    Label = "Text 25", Placeholder = "Placeholder 13"
                },
                new EntryCell {
                    Label = "Text 26"
                },
                new EntryCell {
                    Label = "Text 27", Placeholder = "Placeholder 14"
                },
                new EntryCell {
                    Label = "Text 28"
                },
                new EntryCell {
                    Label = "Text 29", Placeholder = "Placeholder 15"
                },
                new EntryCell {
                    Label = "Text 30"
                },
                new EntryCell {
                    Label = "Text 31", Placeholder = "Placeholder 16"
                },
                new EntryCell {
                    Label = "Text 32"
                },
            };

            var keyboards = new TableSection("Keyboards")
            {
                new EntryCell {
                    Label = "Chat", Keyboard = Keyboard.Chat
                },
                new EntryCell {
                    Label = "Default", Keyboard = Keyboard.Default
                },
                new EntryCell {
                    Label = "Email", Keyboard = Keyboard.Email
                },
                new EntryCell {
                    Label = "Numeric", Keyboard = Keyboard.Numeric
                },
                new EntryCell {
                    Label = "Telephone", Keyboard = Keyboard.Telephone
                },
                new EntryCell {
                    Label = "Text", Keyboard = Keyboard.Text
                },
                new EntryCell {
                    Label = "Url", Keyboard = Keyboard.Url
                }
            };

            var root = new TableRoot("Text Cell table")
            {
                tableSection,
                tableSectionTwo,
                keyboards
            };

            var table = new TableView
            {
                AutomationId = CellTypeList.CellTestContainerId,
                Root         = root
            };

            Content = table;
        }
コード例 #46
0
 public StationListTableViewController() : base()
 {
     TableView.RegisterClassForCellReuse(typeof(StationListTableViewCell), StationListTableViewCell.TableCellKey);
 }
コード例 #47
0
 public CustomTableViewModelRenderer(Context context, ListView listView, TableView view) : base(context, listView, view)
 {
 }
コード例 #48
0
 private void OnAvatarClicked(TableView table, int row)
 {
     AvatarManager.instance.SwitchToAvatar(_avatars[row]);
 }
 public CustomTableViewModelRenderer(TableView model) : base(model)
 {
 }
コード例 #50
0
        static void OnViewLoaded(object sender, RoutedEventArgs e)
        {
            TableView view = (sender as TableView);

            SubscribeViewEvents(view);
        }
コード例 #51
0
 private void OnAvatarClicked(TableView table, int row)
 {
     _avatarManager.SwitchToAvatarAsync(_avatars[row].fileName);
     avatarList.tableView.ScrollToCellWithIdx(row, TableViewScroller.ScrollPositionType.Center, true);
 }
コード例 #52
0
 public CustomTableViewModelRenderer(Context Context, global::Android.Widget.ListView ListView, TableView View)
     : base(Context, ListView, View)
 {
 }
コード例 #53
0
 public void TableViewDidHighlightCellForRow(TableView tableView, int row)
 {
     // NOT USED
 }
コード例 #54
0
 void HandleAuthorizationManagerAuthorizationDidUpdateNotification(NSNotification notification) =>
 TableView.ReloadData();
コード例 #55
0
        public override void Build()
        {
            base.Build();
            Debug.WriteLine("AlphaDetailPage.Rebuild();");

            Theme = AlphaTheme.Get();
            var MainTable = new TableView
            {
                Root = new TableRoot
                {
                    new TableSection(L["Github Account"])
                    {
                        UserLabel,
                    },
                    new TableSection(L["Last Activity Stamp"])
                    {
                        LastActivityStampLabel,
                    },
                    new TableSection(L["Left Time"])
                    {
                        LeftTimeLabel,
                    },
                },
            };

            MainTable.ApplyTheme(Theme);
            if (Width <= Height)
            {
                //CircleGraph.WidthRequest = Width;
                CircleGraph.HeightRequest     = Height * 0.55;
                CircleGraph.HorizontalOptions = LayoutOptions.FillAndExpand;
                CircleGraph.VerticalOptions   = LayoutOptions.Start;

                Content = new StackLayout
                {
                    Spacing         = 1.0,
                    BackgroundColor = Color.Gray,
                    Children        =
                    {
                        CircleGraph,
                        MainTable,
                    },
                };
            }
            else
            {
                CircleGraph.WidthRequest = Width * 0.55;
                //CircleGraph.HeightRequest = Height;
                CircleGraph.HorizontalOptions = LayoutOptions.Start;
                CircleGraph.VerticalOptions   = LayoutOptions.FillAndExpand;

                Content = new StackLayout
                {
                    Spacing         = 1.0,
                    BackgroundColor = Color.Gray,
                    Children        =
                    {
                        new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            Spacing     = 1.0,
                            Children    =
                            {
                                CircleGraph,
                                MainTable,
                            },
                        },
                    },
                };
            }

            //	Indicator を表示中にレイアウトを変えてしまうと簡潔かつ正常に Indicator を再表示できないようなので、問答無用でテキストを表示してしまう。
            //LastActivityStampLabel.ShowText();
            LeftTimeLabel.ShowText();

            CircleGraph.IsInvalidCanvas = true;
            OnUpdateLastPublicActivity();
            ApplyTheme(Theme);
        }