コード例 #1
0
ファイル: Page1View.cs プロジェクト: andres-gimenez/MvvmCross
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Page 1";

            _tableView = new UITableView
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _tableView.TableFooterView = new UIView();

            _tableView.RegisterClassForCellReuse(typeof(HeaderCell), HeaderCell.Identifier);
            _tableView.RegisterClassForCellReuse(typeof(ItemCell), ItemCell.Identifier);

            _source           = new TableSource(_tableView);
            _tableView.Source = _source;

            Add(_tableView);

            _tableView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active                   = true;
            _tableView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active                 = true;
            _tableView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active       = true;
            _tableView.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor).Active = true;

            var set = CreateBindingSet();

            set.Bind(_source).To(vm => vm.Sections);
            set.Bind(_source).For(v => v.HeaderTappedCommand).To(vm => vm.HeaderTappedCommand);
            set.Apply();
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();



            var source = new TableSource(TableView)
            {
                UseAnimations   = true,
                AddAnimation    = UITableViewRowAnimation.Left,
                RemoveAnimation = UITableViewRowAnimation.Right
            };

            this.AddBindings(new Dictionary <object, string>
            {
                { source, "ItemsSource Kittens" }
            });

            TableView.Source = source;


            var set = this.CreateBindingSet <FirstView, Core.ViewModels.FirstViewModel>();

            set.Bind(Label).To(vm => vm.Hello);
            set.Bind(TextField).To(vm => vm.Hello);

            set.Bind(source).To(vm => vm.Kittens);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.ShowDetailedCommand);
            set.Apply();
            TableView.ReloadData();
        }
コード例 #3
0
        protected void Initialize()
        {
            this.Title = "SQLite .NET";

            // performance timing
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();

            string dbName = "db_sqlite-net.db3";

            // check the database, if it doesn't exist, create it
            CheckAndCreateDatabase(dbName);

            // performance timing
            Console.WriteLine("database creation: " + stopwatch.ElapsedMilliseconds.ToString());

            // create a connection to the database
            using (SQLiteConnection db = new SQLiteConnection(GetDBPath(dbName))) {
                // query a list of people from the db
                people = new List <Person> (from p in db.Table <Person> () select p);

                // performance timing
                Console.WriteLine("database query: " + stopwatch.ElapsedMilliseconds.ToString());

                // create a new table source from our people collection
                tableSource = new BasicOperations.TableSource(people);

                // initialize the table view and set the source
                TableView = new UITableView()
                {
                    Source = tableSource
                };
            }
        }
コード例 #4
0
        protected void PopulateTable()
        {
            if (!this.IsViewLoaded)
            {
                return;
            }
            if (store.Empty())
            {
                new UIAlertView("Nothing to learn", "Please load from sources", null, "OK", null).Show();

                Update();
                return;
            }

            var tableSource = new TableSource(store.Items);

            table.Source = tableSource;
            table.ReloadData();

            this.NavigationItem.Title = store.GetTableName();

            if (!trainer.IsQuestionsAvalible())
            {
                new UIAlertView("Well Done!", "You are done with all your questions", null, "OK", null).Show();

                btnTrain.Enabled = false;
            }
            else
            {
                btnTrain.Enabled = true;
            }
        }
コード例 #5
0
 public SampleViewController(IntPtr handle)
     : base(handle)
 {
     _tableSource = new TableSource(this);
     _nameSelectorSource = new NameSelectorSource(this);
     _nameSelectorDelegate = new NameSelectorDelegate(this);
 }
コード例 #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            refreshControl = new UIRefreshControl();

            tableView.RowHeight      = 60;
            tableView.SeparatorColor = UIColor.Blue;
            tableView.RefreshControl = refreshControl;

            tableView.RegisterClassForCellReuse(typeof(TableViewCell), TableViewCell.Key);
            tableView.RegisterNibForCellReuse(TableViewCell.Nib, TableViewCell.Key);

            var source = new TableSource(tableView);

            tableView.Source = source;

            refreshControl.ValueChanged += RefreshTable;

            var set = this.CreateBindingSet <TableViewController, TableViewModel>();

            set.Bind(source).For(v => v.ItemsSource).To(vm => vm.Items);
            set.Bind(addButton).To(vm => vm.CreateNewItemCommand);
            set.Bind(source).For(v => v.SelectionChangedCommand).To(vm => vm.ItemSelectedCommand);
            set.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SingleCellTableSource <TimetableCell> source;

            if (!this.ViewModel.Date.HasValue)
            {
                source = new SingleCellTableSource <TimetableCell>(this.TableView)
                {
                    ItemsSource = this.ViewModel.Entries[0]
                }; // Div
            }
            else
            {
                source = new TableSource(this.TableView); // Mo-Fr

                this.CreateBinding(source)
                .To <TimetableEntriesViewModel>(vm => vm.Entries)
                .Apply();
            }

            this.TableView.TrimEmptyCells();
            this.TableView.Source = source;
            this.TableView.ReloadData();
        }
コード例 #8
0
ファイル: TransactionTable.cs プロジェクト: meikeric/deveeldb
        public RowId AddRow(Row row)
        {
            AssertNotDisposed();

            if (Transaction.ReadOnly())
            {
                throw new Exception("Transaction is Read only.");
            }

            if (TableSource.IsReadOnly)
            {
                throw new InvalidOperationException("Can not add row - table is read-only.");
            }

            int rowNum;

            try {
                rowNum = TableSource.AddRow(row);
            } catch (Exception ex) {
                throw new InvalidOperationException(
                          String.Format("Unknown error when adding a row to the table '{0}'.", TableInfo.TableName), ex);
            }

            row.SetRowNumber(rowNum);

            // Note this doesn't need to be synchronized because we are exclusive on
            // this table.

            EventRegistry.Register(new TableRowEvent(TableId, rowNum, TableRowEventType.Add));

            return(new RowId(TableId, rowNum));
        }
コード例 #9
0
        public async Task <JsonResult> KindEditorUpload(TableSource src)
        {
            var postedFile = Request.Files["imgFile"];
            var table      = new Hashtable();

            if (null != postedFile && postedFile.ContentLength > 0)
            {
                var oAtt = new Attachment
                {
                    Descript       = "",
                    Source         = src,
                    SourceId       = 0,
                    CreateTime     = DateTime.Now,
                    CreateUserId   = User.UserInfo.UserId,
                    CreateUserName = User.UserInfo.UserName,
                    CreateIP       = Request.UserHostAddress,
                    FilePath       = "",
                    CommonStatus   = CommonStatus.Enabled
                };
                if (await AttachmentSvc.Save(postedFile, oAtt))
                {
                    await LogRepository.Insert(TableSource.Attachments, OperationType.Insert, "", oAtt.Id);
                }
                table.Add("url", Url.FileUrl(oAtt.FilePath));
                table.Add("error", 0);
            }
            else
            {
                table.Add("error", 1);
                table.Add("message", "上传失败");
            }
            return(Json(table, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
 protected override void FetchDataToControl()
 {
     try
     {
         _vacationsViewModel = FactorySingleton.Factory.Get <VacationsViewModel>();
         Task <List <VTSModel> > task = Task.Run(async() => await _vacationsViewModel.GetVTSList());
         task.Wait();
         _listVTSModel = task.Result;
         if (_listVTSModel == null && _vacationsViewModel.State == UserState.Unauthorized)
         {
             GoToLoginScreen();
             return;
         }
         tableSource  = new TableSource(_listVTSModel, this);
         table.Source = tableSource;
         _butnAdd     = new UIBarButtonItem(UIBarButtonSystemItem.Add, ButnAddClicked);
         NavigationItem.RightBarButtonItem = _butnAdd;
         _butnMenu       = new  UIBarButtonItem();
         _butnMenu.Title = Localize("Menu");
         NavigationItem.LeftBarButtonItem = _butnMenu;
         NavigationItem.Title             = Localize("Requests");
     }
     catch (Exception)
     {
     }
 }
コード例 #11
0
		protected void Initialize ()
		{
			this.Title = "SQLite .NET";
			
			// performance timing
			System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch ();
			stopwatch.Start ();
			
			string dbName = "db_sqlite-net.db3";
			
			// check the database, if it doesn't exist, create it
			CheckAndCreateDatabase (dbName);
			
			// performance timing
			Console.WriteLine ("database creation: " + stopwatch.ElapsedMilliseconds.ToString ());
			
			// create a connection to the database
			using (SQLiteConnection db = new SQLiteConnection (GetDBPath (dbName))) {
				// query a list of people from the db
				people = new List<Person> (from p in db.Table<Person> () select p);
				
				// performance timing
				Console.WriteLine ("database query: " + stopwatch.ElapsedMilliseconds.ToString ());
			
				// create a new table source from our people collection
				tableSource = new BasicOperations.TableSource (people);
				
				// initialize the table view and set the source
				TableView = new UITableView () {
					Source = tableSource
				};
			}
		}
コード例 #12
0
        public static void Make()
        {
            string      source = Clipboard.GetText();
            TableSource ts     = new TableSource(source);

            if (ts.Heigth == 0 || ts.Width == 0)
            {
                return;
            }

            var pt = Input.Point("Укажите левый верхний угол для вставки таблицы",
                                 new [] { "WIdth", "Ширина" },
                                 s =>
            {
                if (s == "WIdth")
                {
                    InputWidth();
                    if (widthData.Length == 0)
                    {
                        widthData = defaultWidth;
                    }
                }
            }
                                 ); if (Input.StatusBad)
            {
                return;
            }


            Table tbl = new Table();

            tbl.SetSize(ts.Heigth, ts.Width);
            tbl.Position = pt;

            int widthDataCounter = 0;

            for (int j = 0; j < tbl.Columns.Count; j++)
            {
                tbl.Columns[j].Width = widthData[widthDataCounter];
                widthDataCounter++; if (widthDataCounter == widthData.Length)
                {
                    widthDataCounter = 0;
                }
            }

            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                tbl.Rows[i].Height = heigth;
                for (int j = 0; j < tbl.Columns.Count; j++)
                {
                    tbl.Cells[i, j].Value = ts[i, j];
                }
            }


            using (var th = new TransactionHelper())
            {
                th.WriteObject(tbl);
            }
        }
コード例 #13
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new CGRect (0f, 0f, 80f, 36f)) { 
				Text = "Labor",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18f),
			};
			labor = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				laborViewModel
					.SaveLaborAsync (assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
					.ContinueWith (_ => BeginInvokeOnMainThread (() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			space1 = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);

			tableView.Source = 
				tableSource = new TableSource ();
		}
コード例 #14
0
        // Creates a set of table items.
        protected void CreateTableItems()
        {
            List<TableItemGroup> tableItems = new List<TableItemGroup> ();

            // declare vars
            TableItemGroup tGroup;

            // Section 1
            tGroup = new TableItemGroup() { Name = "Section 0 Header", Footer = "Section 0 Footer" };
            tGroup.Items.Add ("Row 0");
            tGroup.Items.Add ("Row 1");
            tGroup.Items.Add ("Row 2");
            tableItems.Add (tGroup);

            // Section 2
            tGroup = new TableItemGroup() { Name = "Section 1 Header", Footer = "Section 1 Footer" };
            tGroup.Items.Add ("Row 0");
            tGroup.Items.Add ("Row 1");
            tGroup.Items.Add ("Row 2");
            tableItems.Add (tGroup);

            // Section 3
            tGroup = new TableItemGroup() { Name = "Section 2 Header", Footer = "Section 2 Footer" };
            tGroup.Items.Add ("Row 0");
            tGroup.Items.Add ("Row 1");
            tGroup.Items.Add ("Row 2");
            tableItems.Add (tGroup);

            tableSource = new TableSource(tableItems);
        }
コード例 #15
0
        public IEnumerable <Attachment> GetList(TableSource src)
        {
            long userId = User.UserModel.UserId;
            var  sql    = Query() + " and CreateUserId = @userId and Source = @src";

            return(DbConn.Query <Attachment>(sql, new { userId, src }));
        }
コード例 #16
0
        protected void Initialize()
        {
            this.Title = "Vici Cool Storage";

            // performance timing
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();

            string dbName = "db_viciCoolStorage.db3";

            // check the database, if it doesn't exist, create it
            this.CheckAndCreateDatabase(dbName);

            // performance timing
            Console.WriteLine("database creation: " + stopwatch.ElapsedMilliseconds.ToString());

            // query a list of people from the db
            people = Person.List();

            // performance timing
            Console.WriteLine("database query: " + stopwatch.ElapsedMilliseconds.ToString());

            // create a new table source from our people collection
            tableSource = new BasicOperations.TableSource(people);

            // initialize the table view and set the source
            this.TableView = new UITableView()
            {
                Source = tableSource
            };
        }
コード例 #17
0
        private static void Parse(string query)
        {
            Console.WriteLine(@"------------------------------------------");
            Console.WriteLine(@"Parsing statement ""{0}""", query);

            var parser = new TSql100Parser(false);

            IList <ParseError> errors;
            IScriptFragment    result = parser.Parse(new StringReader(query), out errors);

            if (errors.Count > 0)
            {
                Console.WriteLine(@"Errors encountered: ""{0}""", errors[0].Message);
                return;
            }


            TSqlStatement statement = ((TSqlScript)result).Batches[0].Statements[0];

            if (statement is SelectStatement)
            {
                TableSource tableSource = (((QuerySpecification)((SelectStatement)statement).QueryExpression).FromClauses[0]);

                Console.WriteLine(@"Top level FROM clause at Line {0}, Column {1} (Character Offset {2})",
                                  tableSource.StartLine, tableSource.StartColumn, tableSource.StartOffset);
                Console.WriteLine();
                Console.WriteLine();
            }
        }
コード例 #18
0
ファイル: TableAppObject.cs プロジェクト: janproch/datadmin
        public void OpenData()
        {
            string winid = TableKey + "#table_data";

            if (MainWindow.Instance.HasContent(winid))
            {
                var sett = TableSource.Database.Settings.Tree();
                if (sett.OpenTableDuplicateMode.ShouldReuse())
                {
                    MainWindow.Instance.ActivateContent(winid);
                    return;
                }
            }
            var tabdata = TableSource.GetTabularData();

            tabdata.CloneConnection();
            if (tabdata.TableSource != null)
            {
                tabdata.TableSource.Connection = tabdata.Connection;
            }
            if (tabdata.DatabaseSource != null)
            {
                tabdata.DatabaseSource.Connection = tabdata.Connection;
            }
            var content = new TableDataFrame(tabdata);

            content.WinId = winid;
            MainWindow.Instance.OpenContent(content);
        }
コード例 #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //this.View.BackgroundColor = UIColor.Black;

            _activityView = new UIActivityIndicatorView(this.View.Frame);
            //Add(_activityView);
            //View.BringSubviewToFront(_activityView);

            _tableView = new FoldingTableViewController(new System.Drawing.RectangleF(0, 0, 320, 367), UITableViewStyle.Plain);
            var source = new TableSource(_tableView.TableView);

            this.AddBindings(new Dictionary <object, string>()
            {
                { source, "ItemsSource TweetsPlus" },
                //{_activityView, "{'Hidden':{'Path':'IsSearching','Converter':'InvertedVisibility'}}"},
                { _tableView, "Refreshing IsSearching;RefreshHeadCommand RefreshCommand;LastUpdatedText WhenLastUpdatedUtc,Converter=SimpleDate" },
            });

            _tableView.TableView.RowHeight = 100;
            _tableView.TableView.Source    = source;
            _tableView.TableView.ReloadData();
            this.Add(_tableView.View);


            NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Tweet", UIBarButtonItemStyle.Bordered, (sender, e) => ViewModel.DoShareGeneral()), false);
        }
コード例 #20
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new CGRect(0, 0, 80, 36)) { 
				Text = "Labor",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			labor = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				laborViewModel
					.SaveLaborAsync (assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
					.ContinueWith (_ => BeginInvokeOnMainThread (() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

			tableView.Source = 
				tableSource = new TableSource();
		}
コード例 #21
0
        public override void FetchTableDataFromDatabase()
        {
            base.FetchTableDataFromDatabase();

            TableSource.SetItems(TableView, RealmServices.GetMyOutlets());
            IfEmpty(true);
        }
コード例 #22
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("MERGE");

            if (!string.IsNullOrEmpty(IntoToken))
            {
                stream.Write($" {IntoToken}");
            }

            stream.Write(" ");
            TargetTable.WriteToStream(stream);

            if (WithOptions != null && WithOptions.Count > 0)
            {
                stream.Write(" WITH(");
                WithOptions.WriteToStreamWithComma(stream);
                stream.Write(")");
            }

            if (TargetTableAliasName != null)
            {
                stream.Write(" AS ");
                TargetTableAliasName.WriteToStream(stream);
            }

            stream.WriteLine();
            stream.Write("USING ");
            TableSource.WriteToStream(stream);

            if (TableSourceAliasName != null)
            {
                stream.Write(" AS ");
                TableSourceAliasName.WriteToStream(stream);
            }

            if (SourceColumnList != null && SourceColumnList.Count > 0)
            {
                stream.Write("(");
                SourceColumnList.WriteToStreamWithComma(stream);
                stream.Write(")");
            }

            stream.Write(" ON ");
            OnMergeSearchCondition.WriteToStream(stream);

            if (WhenList != null && WhenList.Count > 0)
            {
                stream.WriteLine();
                WhenList.WriteToStream(stream);
            }

            if (OutputList != null && OutputList.Count > 0)
            {
                stream.WriteLine();
                stream.Write("OUTPUT ");
                OutputList.WriteToStreamWithComma(stream);
            }

            stream.Write(" ;");
        }
コード例 #23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //this.View.BackgroundColor = UIColor.Black;

            _activityView = new UIActivityIndicatorView(this.View.Frame);
            //Add(_activityView);
            //View.BringSubviewToFront(_activityView);

            _tableView = new FoldingTableViewController(new System.Drawing.RectangleF(0, 0, 320, 367), UITableViewStyle.Plain);
            var source = new TableSource(_tableView.TableView);

            this.AddBindings(new Dictionary<object, string>()
                                 {
                                     {source, "ItemsSource TweetsPlus"},
                                     //{_activityView, "{'Hidden':{'Path':'IsSearching','Converter':'InvertedVisibility'}}"},
				{_tableView, "Refreshing IsSearching;RefreshHeadCommand RefreshCommand;LastUpdatedText WhenLastUpdatedUtc,Converter=SimpleDate"},
                                 });

            _tableView.TableView.RowHeight = 100;
            _tableView.TableView.Source = source;
            _tableView.TableView.ReloadData();
            this.Add(_tableView.View);

            NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Tweet", UIBarButtonItemStyle.Bordered, (sender, e) => ViewModel.DoShareGeneral()), false);
        }
コード例 #24
0
		protected void Initialize ()
		{
			this.Title = "Vici Cool Storage";
			
			// performance timing
			System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch ();
			stopwatch.Start ();
			
			string dbName = "db_viciCoolStorage.db3";
			
			// check the database, if it doesn't exist, create it
			this.CheckAndCreateDatabase (dbName);
			
			// performance timing
			Console.WriteLine ("database creation: " + stopwatch.ElapsedMilliseconds.ToString ());
			
			// query a list of people from the db			
			people = Person.List();
				
			// performance timing
			Console.WriteLine ("database query: " + stopwatch.ElapsedMilliseconds.ToString ());
		
			// create a new table source from our people collection
			tableSource = new BasicOperations.TableSource (people);
			
			// initialize the table view and set the source
			this.TableView = new UITableView (){
				Source = tableSource
			};
			
		}
コード例 #25
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Tableview large header";

            _tableView = new UITableView();
            _contentView.AddSubview(_tableView);

            AutoLayoutToolBox.AlignToFullConstraints(_tableView, _contentView);


            var items = new string[]
            {
                "item 1",
                "item 2",
                "item 3",
                "item 4",
                "item 5",
            };

            var tableSource = new TableSource(items);

            _tableView.Source = tableSource;
        }
コード例 #26
0
        private ITable[] FindChangedTables(ITransaction checkTransaction, CommitTableInfo[] normalizedChangedTables)
        {
            var changedTableSource = new ITable[normalizedChangedTables.Length];

            // Set up the above arrays
            for (int i = 0; i < normalizedChangedTables.Length; ++i)
            {
                // Get the information for this changed table
                CommitTableInfo tableInfo = normalizedChangedTables[i];

                // Get the master table that changed from the normalized list.
                TableSource master = tableInfo.Master;
                // Did this table change since the transaction started?
                TableEventRegistry[] allTableChanges = tableInfo.ChangesSinceCommit;

                if (allTableChanges == null || allTableChanges.Length == 0)
                {
                    // No changes so we can pick the correct IIndexSet from the current
                    // transaction.

                    // Get the state of the changed tables from the Transaction
                    var mtable = Transaction.GetMutableTable(master.TableName);
                    // Get the current index set of the changed table
                    tableInfo.IndexSet = Transaction.GetIndexSetForTable(master);
                    // Flush all index changes in the table
                    mtable.FlushIndexes();

                    // Set the 'check_transaction' object with the latest version of the
                    // table.
                    checkTransaction.UpdateVisibleTable(tableInfo.Master, tableInfo.IndexSet);
                }
                else
                {
                    // There were changes so we need to merge the changes with the
                    // current view of the table.

                    // It's not immediately obvious how this merge update works, but
                    // basically what happens is we WriteByte the table journal with all the
                    // changes into a new IMutableTableDataSource of the current
                    // committed state, and then we flush all the changes into the
                    // index and then update the 'check_transaction' with this change.

                    // Create the IMutableTableDataSource with the changes from this
                    // journal.
                    var mtable = master.CreateTableAtCommit(checkTransaction, tableInfo.Journal);
                    // Get the current index set of the changed table
                    tableInfo.IndexSet = checkTransaction.GetIndexSetForTable(master);
                    // Flush all index changes in the table
                    mtable.FlushIndexes();

                    // Dispose the table
                    mtable.Dispose();
                }

                // And now refresh the 'changedTableSource' entry
                changedTableSource[i] = checkTransaction.GetTable(master.TableName);
            }

            return(changedTableSource);
        }
コード例 #27
0
        public Task <WfProcess> GetBySource(TableSource src)
        {
            var obj = AdminQueryEnable()
                      .FirstOrDefaultAsync(m => m.TableSource == src);

            return(obj);
        }
コード例 #28
0
        public async Task <ActionResult> Index(TableSource src, long proInsId = 0, long currActInsId = 0, long id = 0)
        {
            var result = new JsonModel();

            result.statusCode = 300;
            var process = await WorkflowSvc.GetProcessBySource(src);

            if (process == null)
            {
                result.message = $"请假流程还未创建,请先创建{src}流程!";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            var model = await GetModel(src, id, result);

            if (model == null)
            {
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            model.Id                = id;
            model.ProcessId         = process.Id;
            model.ProcessInstanceId = proInsId;
            model.CurrActInsId      = currActInsId;
            model.DealActivityList  = new List <WfActivityInstance>();
            model.TableSource       = src;

            if (proInsId != 0)
            {
                model.DealActivityList = await WorkflowSvc.GetDealActivityListAsync(proInsId);
            }
            return(View(model));
        }
コード例 #29
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI to setup from code
            title = new UILabel(new CGRect(0f, 0f, 160f, 36f))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16f),
            };
            var titleButton = new UIBarButtonItem(title);

            toolbar.Items = new UIBarButtonItem[] { titleButton };

            tableView.Source =
                tableSource  = new TableSource(this);

            if (Theme.IsiOS7)
            {
                tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
            }
            else
            {
                View.BackgroundColor = Theme.BackgroundColor;
            }
        }
コード例 #30
0
ファイル: QueryFactory.cs プロジェクト: yungtau/oea
        /// <summary>
        /// 构造一个实体的数据源节点。
        /// </summary>
        /// <param name="repository">本实体数据源来自于这个实体仓库。</param>
        /// <param name="alias">同一个实体仓库可以表示多个不同的数据源。这时,需要这些不同的数据源指定不同的别名。</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">entityRepository</exception>
        public ITableSource Table(IRepository repository, string alias = null)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("entityRepository");
            }

            var dbTable = (repository as IRepositoryInternal).RdbDataProvider.DbTable;

            if (dbTable == null)
            {
                ORMHelper.ThrowBasePropertyNotMappedException(repository.EntityType);
            }

            //构造一个 EntitySource 对象。
            //在构造 TableSource 时,不必立刻为所有属性生成相应的列。必须使用懒加载。
            var table = new TableSource();

            table._dbTable = dbTable;

            var res = table as ITableSource;

            res.EntityRepository = repository;
            table.TableName      = dbTable.Name;
            table.Alias          = alias;

            return(table);
        }
コード例 #31
0
        internal TableSource CopySourceTable(TableSource tableSource, IIndexSet indexSet)
        {
            lock (commitLock) {
                try {
                    // The unique id that identifies this table,
                    int tableId    = NextTableId();
                    var sourceName = tableSource.SourceName;

                    // Create the object.
                    var masterTable = new TableSource(this, StoreSystem, LargeObjectStore, tableId, sourceName);

                    masterTable.CopyFrom(tableId, tableSource, indexSet);

                    // Add to the list of all tables.
                    tableSources.Add(tableId, masterTable);

                    // Add this to the list of deleted tables,
                    MarkUncommitted(tableId);

                    // Commit this
                    StateStore.Flush();

                    // And return it.
                    return(masterTable);
                } catch (IOException e) {
                    throw new Exception(String.Format("Unable to copy source table '{0}' because of an error.", tableSource.TableInfo.TableName), e);
                }
            }
        }
コード例 #32
0
ファイル: FromClause.cs プロジェクト: ArmandoAPS/SqlBuilder
        public void GetSql(DbTarget db_target, ref StringBuilder sql)
        {
            sql.Append(" FROM ");
            if (!TableSource.IsLiteral)
            {
                sql.Append("(");
            }
            TableSource.GetSql(db_target, ref sql);
            if (!TableSource.IsLiteral)
            {
                sql.Append(")");
            }
            sql.Append(" ");
            if (Alias != null && Alias.Trim() != "")
            {
                sql.Append(Utils.FormatName(Alias, db_target));
            }

            sql.Append(" ");
            foreach (JoinClause join in Joins)
            {
                join.GetSql(db_target, ref sql);
                sql.Append(" ");
            }
        }
コード例 #33
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            var votes = new VoteManager().ReadVotesFromRemote();

            var source = new TableSource(votes);

            voteTable.Source = source;

            source.VoteSelected += (object sender, VoteSelectedEventArgs e) => {
                SelectedVote = e.SelectedVote;

                if (DateTime.Now > e.SelectedVote.EndTime)
                {
                    InvokeOnMainThread(() => {
                        PerformSegue("moveToVoteResultViewSegue", this);
                    });
                }
                else
                {
                    InvokeOnMainThread(() => {
                        PerformSegue("moveToVoteFlowSegue", this);
                    });
                }
            };
        }
コード例 #34
0
        private TableSource CreateTableSource(TableInfo tableInfo, bool temporary)
        {
            lock (commitLock) {
                try {
                    int tableId = NextTableId();

                    // Create the object.
                    var storeSystem = StoreSystem;
                    if (temporary)
                    {
                        storeSystem = tempStoreSystem;
                    }

                    var source = new TableSource(this, storeSystem, LargeObjectStore, tableId, tableInfo.TableName.FullName);
                    source.Create(tableInfo);

                    tableSources.Add(tableId, source);

                    if (!temporary)
                    {
                        MarkUncommitted(tableId);

                        StateStore.Flush();
                    }

                    // And return it.
                    return(source);
                } catch (IOException e) {
                    throw new InvalidOperationException(String.Format("Unable to create source for table '{0}'.", tableInfo.TableName), e);
                }
            }
        }
コード例 #35
0
        private async void ToTextField_EditingChanged(object sender, EventArgs e)
        {
            try
            {
                var searchText = _toTextField.Text;
                if (!string.IsNullOrEmpty(searchText))
                {
                    var suggestions = await GeocodeHelper.SuggestAsync(searchText);

                    var suggestionTableSource = new TableSource <string>(suggestions, (s) => s);
                    suggestionTableSource.TableRowSelected += ToSuggestionTableSource_TableRowSelected;
                    _toAutoCompleteTableView.Source         = suggestionTableSource;
                    _toAutoCompleteTableView.ReloadData();
                    var oldFrame = _toAutoCompleteTableView.Frame;
                    _toAutoCompleteTableView.Frame  = new CGRect(oldFrame.Left, oldFrame.Top, oldFrame.Width, suggestions.Count() * 30f);
                    _toAutoCompleteTableView.Hidden = false;
                }
                else
                {
                    _toAutoCompleteTableView.Hidden = true;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"{ex.Message}\n{ex.StackTrace}");
            }
        }
コード例 #36
0
        public override void FetchTableDataFromDatabase()
        {
            base.FetchTableDataFromDatabase();

            TableSource.SetItems(TableView, Shared.GetTableItems());
            IfEmpty(true);
        }
コード例 #37
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // Perform any additional setup after loading the view, typically from a nib.
            var votes = new VoteManager ().ReadVotesFromRemote ();

            var source = new TableSource (votes);

            voteTable.Source = source;

            source.VoteSelected += (object sender, VoteSelectedEventArgs e) => {

                SelectedVote = e.SelectedVote;

                if (DateTime.Now > e.SelectedVote.EndTime) {
                    InvokeOnMainThread (() => {
                        PerformSegue ("moveToVoteResultViewSegue", this);
                    });
                }
                else {

                    InvokeOnMainThread (() => {
                        PerformSegue ("moveToVoteFlowSegue", this);
                    });
                }
            };
        }
コード例 #38
0
ファイル: TableSourceGC.cs プロジェクト: deveel/deveeldb
        public TableSourceGC(TableSource tableSource)
        {
            this.tableSource = tableSource;
            deletedRows = new BlockIndex<int>();

            // lastSuccess = DateTime.UtcNow;
            // lastTry = null;
        }
コード例 #39
0
        public override void LayoutChanged( )
        {
            base.LayoutChanged( );

            // if the layout is changed, the simplest way to fix the UI is to recreate the table source
            TableSource source = new TableSource( this, Messages, Series );
            SeriesTable.Source = source;
            SeriesTable.Delegate = new TableViewDelegate( source, Task.NavToolbar );
            SeriesTable.ReloadData( );
        }
コード例 #40
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            var source = new TableSource(TableView);

            this.CreateBinding(source).To((PetShopViewModel vm) => vm.Stock).Apply();

            TableView.Source = source;
            TableView.ReloadData();
        }
コード例 #41
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // setup our data source
            List<string> items = new List<string>();
            for (int i = 1; i <= 10; i++)
                items.Add (i.ToString ());
            tableSource = new TableSource (items, this);

            // add the data source to the table
            this.TableView.Source = tableSource;
        }
コード例 #42
0
ファイル: MainView.cs プロジェクト: tekconf/TekCross
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var source = new TableSource(TableView);

			var bindings = this.CreateBindingSet<MainView, MainViewModel>();
			bindings.Bind(source).To(vm => vm.Conferences);
			bindings.Apply ();

			TableView.Source = source;
			TableView.ReloadData();
		}
コード例 #43
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new TableSource(TableView);
            this.AddBindings(new Dictionary<object, string>
                {
                    {source, "ItemsSource Animals"}
                });

            TableView.Source = source;
            TableView.ReloadData();
        }
コード例 #44
0
ファイル: HomeScreen.cs プロジェクト: yongwang/TableDemos
 public override void ViewDidLoad()
 {
     base.ViewDidLoad ();
     table = new UITableView(View.Bounds); // defaults to Plain style
     table.AutoresizingMask = UIViewAutoresizing.All;
     var tableSource = new TableSource<string>(new List<string>{"Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers"});
     tableSource.OnRowSelected += (object sender, TableSource<string>.RowSelectedEventArgs e) => {
         new UIAlertView("Row Selected",
                         tableSource.Data[e.indexPath.Row].ToString(), null, "OK", null).Show();
         e.tableView.DeselectRow (e.indexPath, true);
     };
     table.Source = tableSource;
     Add (table);
 }
    public override void ViewDidLoad ()
    {
      base.ViewDidLoad ();			

      // configure the UITableView
      _tableSource = new TableSource();
      _tableSource.PropertySelected += (s,e) => PropertySelected(this, e);
      _tableSource.LoadMore += (s, e) => LoadMoreClicked(this, e);
      searchResultsTable.Source = _tableSource;

      _presenter.SetView(this);

      // set the back button text
      NavigationItem.BackBarButtonItem = new UIBarButtonItem("Results",
                           UIBarButtonItemStyle.Bordered, BackButtonEventHandler);
    }
コード例 #46
0
ファイル: HomeScreen.cs プロジェクト: yongwang/TableDemos
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            table = new UITableView(View.Bounds); // defaults to Plain style
            table.AutoresizingMask = UIViewAutoresizing.All;
            var tableSource = new TableSource<Question>();
            tableSource.OnRowSelected += (object sender, TableSource<Question>.RowSelectedEventArgs e) => {
                new UIAlertView("Row Selected",
                                tableSource.Data[e.indexPath.Row].ToString(), null, "OK", null).Show();
                e.tableView.DeselectRow (e.indexPath, true);
            };
            table.Source = tableSource;
            Add (table);

            LoadData();
        }
コード例 #47
0
ファイル: HomeScreen.cs プロジェクト: Excoriate/XamarinWebAPI
        void BuildTable()
        {
            table 				   = new UITableView (View.Bounds);
            table.AutoresizingMask = UIViewAutoresizing.All;  // defaults to Plain style. Other option is Grouped

            var tableSource = new TableSource<Person> ();

                // Event handler for what happens when we click on the item in a row
                tableSource.OnRowSelected += (object sender, TableSource<Person>.RowSelectedEventArgs e) =>  {
                                              new UIAlertView ("Row Selected", tableSource.Data [e.indexPath.Row].ToString (), null, "OK", null).Show ();
                                              e.tableView.DeselectRow (e.indexPath, true);
                                              };
            table.Source = tableSource;

            // Adds subviews to the table
            Add (table);
        }
コード例 #48
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI to setup from code
			View.BackgroundColor = Theme.BackgroundColor;
			title = new UILabel (new RectangleF (0, 0, 160, 36)) { 
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
			};
			var titleButton = new UIBarButtonItem (title);
			
			toolbar.Items = new UIBarButtonItem[] { titleButton };

			tableView.Source = 
				tableSource = new TableSource (this);
		}
コード例 #49
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new TableSource(TableView)
            {
                UseAnimations = true,
                AddAnimation = UITableViewRowAnimation.Left,
                RemoveAnimation = UITableViewRowAnimation.Right
            };

            this.AddBindings(new Dictionary<object, string>
                {
                    {source, "ItemsSource Kittens"}
                });

            TableView.Source = source;
            TableView.ReloadData();
        }
コード例 #50
0
		protected void Initialize ()
		{
			this.Title = "ADO.NET";

			// performance timing
			System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
			stopwatch.Start ();

			// create a connection to the database, if the db doesn't exist, it'll get created
	        var connection = GetConnection ("db_adonet.db3");

			// performance timing
			Console.WriteLine("database creation: " + stopwatch.ElapsedMilliseconds.ToString());

			// create a command
			using (var cmd = connection.CreateCommand ())
			{
				// open the connection
				connection.Open ();
				// create a select statement
				cmd.CommandText = "SELECT * FROM People";
				using (var reader = cmd.ExecuteReader ()) {
					// loop through each record and add the name to our collection
					while (reader.Read ()) {
						people.Add (reader[1] + " " + reader[2]);
					}
				}

				// performance timing
				Console.WriteLine("database query: " + stopwatch.ElapsedMilliseconds.ToString ());

				// close the connection
				connection.Close ();
			}

			// create a new table source from our people collection
			tableSource = new BasicOperations.TableSource (people);

			// initialize the table view and set the source
			TableView = new UITableView ();
			TableView.Source = tableSource;
		}
コード例 #51
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI to setup from code
			title = new UILabel (new RectangleF (0, 0, 160, 36)) { 
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
			};
			var titleButton = new UIBarButtonItem (title);
			
			toolbar.Items = new UIBarButtonItem[] { titleButton };

			tableView.Source = 
				tableSource = new TableSource (this);

			if (Theme.IsiOS7) {
				tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
			} else {
				View.BackgroundColor = Theme.BackgroundColor;
			}
		}
コード例 #52
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new RectangleF(0, 0, 80, 36)) { 
				Text = "Expense",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			expense = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				//Save the expense
				var task = expenseViewModel.SaveExpenseAsync (assignmentViewModel.SelectedAssignment, expenseViewModel.SelectedExpense);
				//Save the photo if we need to
				if (expenseViewModel.Photo != null) {
					task = task
						.ContinueWith (_ => expenseViewModel.Photo.ExpenseId = expenseViewModel.SelectedExpense.Id)
						.ContinueWith (expenseViewModel.SavePhotoAsync ());
				}
				//Dismiss the controller after the other tasks
				task.ContinueWith (_ => BeginInvokeOnMainThread(() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			
			tableView.Source = 
				tableSource = new TableSource();
		}
コード例 #53
0
        private static void CollectTablesNames(IDictionary<string, TableAndJoinInfo> tables, TableSource tableSource)
        {
            if (tableSource is SchemaObjectTableSource)
            {
                var schema = (SchemaObjectTableSource) tableSource;
                var tableName = StripFilterViewPrefixFromTableName(schema.SchemaObject.BaseIdentifier.Value.ToLower());
                var aliasName = TableAliasName(tableSource);
                tables.Add(tableName, new TableAndJoinInfo
                                          {
                                              TableName = tableName,
                                              AliasName = aliasName
                                          });
            }

            if (tableSource is QualifiedJoin)
            {
                var join = (QualifiedJoin) tableSource;

                // First table
                if (join.FirstTableSource is QualifiedJoin)
                {
                    CollectTablesNames(tables, join.FirstTableSource);
                }
                else
                {
                    var firstTableName = StripFilterViewPrefixFromTableName(((SchemaObjectTableSource)join.FirstTableSource).SchemaObject.BaseIdentifier.Value.ToLower());
                    var firstTableAliasName = TableAliasName(join.FirstTableSource);
                    ;
                    if (!tables.ContainsKey(firstTableName))
                    {
                        tables.Add(firstTableName, new TableAndJoinInfo
                                                       {
                                                           TableName = firstTableName,
                                                           AliasName = firstTableAliasName
                                                       });
                    }
                }

                // Second table
                if (join.SecondTableSource is QualifiedJoin)
                {
                    CollectTablesNames(tables, join.SecondTableSource);
                }
                else
                {
                    var secondTableName = StripFilterViewPrefixFromTableName(((SchemaObjectTableSource)join.SecondTableSource).SchemaObject.BaseIdentifier.Value.ToLower());
                    var secondTableAliasName = TableAliasName(join.SecondTableSource);
                    if (!tables.ContainsKey(secondTableName))
                    {
                        var joinTypeName = JoinTypeName(join);
                        var from = ColumnFromFullyQualifiedColumnName(ExpressionPartName(((BinaryExpression) join.SearchCondition).SecondExpression));
                        var to = ColumnFromFullyQualifiedColumnName(ExpressionPartName(((BinaryExpression) join.SearchCondition).FirstExpression));
                        tables.Add(secondTableName, new TableAndJoinInfo
                                                        {
                                                            TableName = secondTableName,
                                                            AliasName = secondTableAliasName,
                                                            JoinType = joinTypeName,
                                                            From = from,
                                                            To = to
                                                        });
                    }
                }
            }
        }
コード例 #54
0
        internal TableSource CreateTableSource(TableInfo tableInfo, bool temporary)
        {
            lock (commitLock) {
                try {
                    int tableId = NextTableId();

                    // Create the object.
                    var storeSystem = StoreSystem;
                    if (temporary)
                        storeSystem = tempStoreSystem;

                    var source = new TableSource(this, storeSystem, LargeObjectStore, tableId, tableInfo.TableName.FullName);
                    source.Create(tableInfo);

                    tableSources.Add(tableId, source);

                    if (!temporary) {
                        MarkUncommitted(tableId);

                        StateStore.Flush();
                    }

                    // And return it.
                    return source;
                } catch (IOException e) {
                    throw new InvalidOperationException(String.Format("Unable to create source for table '{0}'.", tableInfo.TableName), e);
                }
            }
        }
コード例 #55
0
        internal TableSource CopySourceTable(TableSource tableSource, IIndexSet indexSet)
        {
            lock (commitLock) {
                try {
                    // The unique id that identifies this table,
                    int tableId = NextTableId();
                    var sourceName = tableSource.SourceName;

                    // Create the object.
                    var masterTable = new TableSource(this, StoreSystem, LargeObjectStore, tableId, sourceName);

                    masterTable.CopyFrom(tableId, tableSource, indexSet);

                    // Add to the list of all tables.
                    tableSources.Add(tableId, masterTable);

                    // Add this to the list of deleted tables,
                    MarkUncommitted(tableId);

                    // Commit this
                    StateStore.Flush();

                    // And return it.
                    return masterTable;
                } catch (IOException e) {
                    throw new Exception(String.Format("Unable to copy source table '{0}' because of an error.", tableSource.TableInfo.TableName), e);
                }
            }
        }
コード例 #56
0
 internal static void UpdateVisibleTable(this ITransaction transaction, TableSource tableSource, IIndexSet indexSet)
 {
     transaction.GetTableManager().UpdateVisibleTable(tableSource, indexSet);
 }
コード例 #57
0
 internal static void RemoveVisibleTable(this ITransaction transaction, TableSource table)
 {
     transaction.GetTableManager().RemoveVisibleTable(table);
 }
コード例 #58
0
 internal static IIndexSet GetIndexSetForTable(this ITransaction transaction, TableSource tableSource)
 {
     return transaction.GetTableManager().GetIndexSetForTable(tableSource);
 }
コード例 #59
0
        private TableSource LoadTableSource(int tableId, string tableName)
        {
            var source = new TableSource(this, StoreSystem, LargeObjectStore, tableId, tableName);
            if (!source.Exists())
                return null;

            return source;
        }
コード例 #60
0
        private static string TableAliasName(TableSource tableSource)
        {
            string aliasTableName = null;

            if (tableSource is TableSourceWithAlias)
            {
                if (((TableSourceWithAlias) tableSource).Alias != null)
                    aliasTableName = ((TableSourceWithAlias) tableSource).Alias.Value.ToLower();
            }

            return aliasTableName;
        }