Пример #1
0
        public void ShowBooKForLoan()
        {
            Window window = (Window)windows[WindowsPosition.BOOK_LOAN];
            DataGrid dataGrid = null;
            if (window == null)
            {
                window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.book_loan_window));
                windows.Add(WindowsPosition.BOOK_LOAN, window);

                Button borrowButton = (Button)window.GetChildByName("actionButton");
                Button cancelButton = (Button)window.GetChildByName("cancelButton");
                borrowButton.TapEvent += (o) => Controller.BorrowBook();
                cancelButton.TapEvent += (o) => Controller.CancelLoanTransaction();

                dataGrid = (DataGrid)window.GetChildByName("dataGrid");
                DataGridColumn colLabels = new DataGridColumn("", 80);
                DataGridColumn colValue = new DataGridColumn("", 320 - colLabels.Width);
                DataGridItem titleItem = new DataGridItem(new string[] { "Title", null });
                DataGridItem authorsItem = new DataGridItem(new string[] { "Authors", null });
                DataGridItem publisherItem = new DataGridItem(new string[] { "Publisher", null });
                DataGridItem ISBNItem = new DataGridItem(new string[] { "ISBN", null });
                DataGridItem publicationDateItem = new DataGridItem(new string[] { "Published", null });
                dataGrid.RowCount = 5;
                dataGrid.AddColumn(colLabels);
                dataGrid.AddColumn(colValue);
                dataGrid.AddItem(titleItem);
                dataGrid.AddItem(authorsItem);
                dataGrid.AddItem(publisherItem);
                dataGrid.AddItem(ISBNItem);
                dataGrid.AddItem(publicationDateItem);
            }
            BookCompositeType book = LibraryModelSingleton.Instance.Book;
            if (dataGrid == null) dataGrid = (DataGrid)window.GetChildByName("dataGrid");
            dataGrid.SetCellData(1, 0, book.Title);
            dataGrid.SetCellData(1, 1, ConcatString(book.Authors.STRING));
            dataGrid.SetCellData(1, 2, book.Publisher);
            dataGrid.SetCellData(1, 3, book.ISBN);
            dataGrid.SetCellData(1, 4, book.PublicationDate.ToString("yyyy"));

            Glide.MainWindow = window;
        }
Пример #2
0
 /// <summary>
 /// Removes a column.
 /// </summary>
 /// <param name="dataGridColumn">dataGridColumn</param>
 public void RemoveColumn(DataGridColumn dataGridColumn)
 {
     int index = _columns.IndexOf(dataGridColumn);
     if (index > -1)
         RemoveColumnAt(index);
 }
Пример #3
0
        /// <summary>
        /// Adds a column at a specified index.
        /// </summary>
        /// <param name="index">index</param>
        /// <param name="dataGridColumn">dataGridColumn</param>
        public void AddColumnAt(int index, DataGridColumn dataGridColumn)
        {
            if (_columns.Count == 0 || index == -1 || index > _columns.Count - 1)
                _columns.Add(dataGridColumn);
            else
                _columns.Insert(index, dataGridColumn);

            // A new column was added so we must re-render the headers.
            _renderHeaders = true;
        }
Пример #4
0
 /// <summary>
 /// Adds a column.
 /// </summary>
 /// <param name="dataGridColumn">dataGridColumn</param>
 public void AddColumn(DataGridColumn dataGridColumn)
 {
     AddColumnAt(-1, dataGridColumn);
 }
Пример #5
0
 /// <summary>
 /// Adds a column.
 /// </summary>
 /// <param name="dataGridColumn">dataGridColumn</param>
 public void AddColumn(DataGridColumn dataGridColumn)
 {
     AddColumnAt(-1, dataGridColumn);
 }
Пример #6
0
        public void ShowBooKForReturning()
        {
            Window window = (Window)windows[WindowsPosition.BOOK_RET];
            DataGrid dataGrid = null;
            if (window == null)
            {
                window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.book_loan_window));
                windows.Add(WindowsPosition.BOOK_RET, window);

                Button returnButton = (Button)window.GetChildByName("actionButton");
                Button cancelButton = (Button)window.GetChildByName("cancelButton");
                returnButton.Text = "Return";
                returnButton.TapEvent += (o) => Controller.ReturnBook();
                cancelButton.TapEvent += (o) => Controller.CancelReturnTransaction();

                dataGrid = (DataGrid)window.GetChildByName("dataGrid");
                DataGridColumn colLabels = new DataGridColumn("", 80);
                DataGridColumn colValue = new DataGridColumn("", 320 - colLabels.Width);
                DataGridItem titleItem = new DataGridItem(new string[] { "Title", null });
                DataGridItem publisherItem = new DataGridItem(new string[] { "Publisher", null });
                DataGridItem ISBNItem = new DataGridItem(new string[] { "ISBN", null });
                DataGridItem startDateItem = new DataGridItem(new string[] { "Start date", null });
                DataGridItem dueDateItem = new DataGridItem(new string[] { "Due date", null });
                dataGrid.RowCount = 5;
                dataGrid.AddColumn(colLabels);
                dataGrid.AddColumn(colValue);
                dataGrid.AddItem(titleItem);
                dataGrid.AddItem(publisherItem);
                dataGrid.AddItem(ISBNItem);
                dataGrid.AddItem(startDateItem);
                dataGrid.AddItem(dueDateItem);
            }
            BookCompositeType book = LibraryModelSingleton.Instance.Book;
            if (dataGrid == null) dataGrid = (DataGrid)window.GetChildByName("dataGrid");
            dataGrid.SetCellData(1, 0, book.Title);
            dataGrid.SetCellData(1, 1, book.Publisher);
            dataGrid.SetCellData(1, 2, book.ISBN);
            dataGrid.SetCellData(1, 3, LibraryModelSingleton.Instance.StartDate.ToString("dd/MM/yyyy"));
            dataGrid.SetCellData(1, 4, LibraryModelSingleton.Instance.DueDate.ToString("dd/MM/yyyy"));

            Glide.MainWindow = window;
        }