public MainForm() { InitializeComponent(); model = new MainFormModel(); model.Load(); }
/// <summary> /// Creates the main table layout for the main form. /// </summary> public MainSplitter(MainFormModel viewModel) { DataContext = viewModel; Panel1 = OpenedDatabaseTree = new OpenedDatabaseTree(viewModel); Panel2 = MultiTabControl = new MultiTabControl(viewModel); Position = 300; }
public MainForm() { Model = new MainFormModel(); InitializeComponent(); currentDir = string.Empty; LoadSideBar(); }
/// <summary> /// Creates a model for a collection in a database file. /// </summary> public CollectionModel(MainFormModel viewModel, DatabaseModel db, string name) { Database = db; Name = name; Parent = viewModel; Collection = db.Database.GetCollection(name); }
/// <summary> /// Creates a model for an opened database. /// </summary> public DatabaseModel(MainFormModel viewModel, LiteDatabase db, string filePath) { Database = db; FilePath = filePath; Parent = viewModel; Collections = new ObservableCollection <CollectionModel>(Database .GetCollectionNames() .Select(name => new CollectionModel(viewModel, this, name))); }
static void Main() { var view = new MainFormView(); var model = new MainFormModel(); var controller = new MainFormController(model,view); Application.EnableVisualStyles(); // Application.SetCompatibleTextRenderingDefault(false); Application.Run(view); }
static void Main() { var view = new MainFormView(); var model = new MainFormModel(); var controller = new MainFormController(model, view); Application.EnableVisualStyles(); // Application.SetCompatibleTextRenderingDefault(false); Application.Run(view); }
public MainFormController(MainFormModel model, MainFormView view) { //todo check model and view if null _model = model; _view = view; _view.AddButtonListener(AddButtonClick); _view.EditButtonListener(EditButtonClick); _view.DeleteButtonListener(DeleteButtonClick); _view.SearchButtonListener(SearchButtonClick); _view.PrintButtonListener(PrintButtonClick); }
/// <summary> /// Creates an opened database tree item control. /// </summary> public OpenedDatabaseTreeItem(MainFormModel viewModel, OpenedDatabaseTree parentTree, DatabaseModel db) { Database = db; Image = Icon.FromResource("LiteDB.Explorer.Core.Assets.Icons.Db.ico", typeof(OpenedDatabaseTreeItem).Assembly); openedDatabaseTree = parentTree; parentViewModel = viewModel; Text = Path.GetFileNameWithoutExtension(db.FilePath); db.Collections.CollectionChanged += onCollectionChanged; Children.AddRange(db.Collections.Select(collection => new CollectionTreeItem(db, collection))); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mainForm = new MainForm(); MessageService messageService = new MessageService(); MainFormModel mainFormModel = new MainFormModel(); MainFormPresenter mainFormPresenter = new MainFormPresenter(mainForm, messageService, mainFormModel, new MSWordWorker()); Application.Run(mainForm); }
void IMainFormView.ShowResult(MainFormModel model) { if (this.uxUnparsedTextBox.Text != model.Input) { this.uxUnparsedTextBox.Text = model.Input; } if (this.uxAttributeTextBox.Text != model.AttributeDecorator) { this.uxAttributeTextBox.Text = model.AttributeDecorator; } if (this.uxINotifyPropertyChangedCheckBox.Checked != model.IsINotifyPropertyChanged) { this.uxINotifyPropertyChangedCheckBox.Checked = model.IsINotifyPropertyChanged; } this.uxResultTextbox.Text = model.Result; }
/// <summary> /// Creates a tab control for queries, index updates, etc. /// </summary> public MultiTabControl(MainFormModel viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } parentViewModel = viewModel; viewModel.CollectionRemoved += onCollectionRemoved; viewModel.PropertyChanged += viewModelOnPropertyChanged; if (viewModel.OpenedDatabases != null) { openedDatabases = viewModel.OpenedDatabases; openedDatabases.CollectionChanged += onOpenedDatabasesChanged; } }
/// <summary> /// Creates a tree control for a summary view of each opened database. /// </summary> public OpenedDatabaseTree(MainFormModel viewModel) { DataContext = parentViewModel = viewModel; DataStore = tree = new TreeItemCollection(); SelectionChanged += onSelectionChanged; parentViewModel.PropertyChanged += viewModelOnPropertyChanged; if (parentViewModel.OpenedDatabases != null) { openedDatabases = parentViewModel.OpenedDatabases; openedDatabases.CollectionChanged += onOpenedDatabasesChanged; } MouseDoubleClick += onMouseDoubleClick; viewModel.ActiveClipboardController = this; GotFocus += (sender, args) => viewModel.ActiveClipboardController = this; }
public MainController(MainForm mainForm) { Form = mainForm; Model = new MainFormModel(Form); Form.mainFormModelBindingSource.DataSource = Model; UpdateController.Instance.UpdateCheckFinished += Instance_UpdateCheckFinished; if (!Properties.Settings.Default.MinimizeToTray) { Form.systemTrayNotifyIcon.Visible = false; } scanTimer.Enabled = false; scanTimer.Interval = Properties.Settings.Default.ScanTimer; scanTimer.Tick += new EventHandler(Scan); }
/// <summary> /// The actual Work to be done. /// </summary> protected override void Execute() { Util Util = new Util(); List <TranscriptionModel> transcriptionModels = new List <TranscriptionModel>(); IQueryable <transcription> transcriptions = TranscriptionRepository .FindBy(i => i.UpdatedBy == Request.UserModel.UserId) .OrderByDescending(i => i.CreatedDate) .Take(20); foreach (transcription item in transcriptions.ToList()) { transcriptionModels.Add(Util.ConvertToTranscriptionModel(item)); } MainFormModel mainFormModel = new MainFormModel(); if (Request.IsAdminUser) { mainFormModel = new MainFormModel() { BrowseRecordCount = TranscriptionRepository.GetAll().Count(), TranscrptionQueueRecordCount = TranscriptionRepository.FindBy(t => t.TranscriptStatus == false).Count(), }; } else { mainFormModel = new MainFormModel() { BrowseRecordCount = TranscriptionRepository.FindBy(t => !t.IsRestriction).Count(), TranscrptionQueueRecordCount = TranscriptionRepository.FindBy(t => t.TranscriptStatus == false && !t.IsRestriction).Count(), }; } Response = new ResponseModel() { MainFormModel = mainFormModel, Transcriptions = transcriptionModels, IsOperationSuccess = true }; }
private void MainForm_Load(object sender, EventArgs e) { base.Text = string.Concat(new string[] { Application.ProductName, " ", Application.ProductVersion, " by ", Application.CompanyName }); MainFormModel mainFormModel = new MainFormModel(); }
/// <summary> /// The actual Work to be done. /// </summary> protected override void Execute() { MainFormModel mainFormModel = null; List <RepositoryModel> repositoryList = new List <RepositoryModel>(); List <CollectionModel> newlist = new List <CollectionModel>(); List <SubseryModel> newSubseriesList = new List <SubseryModel>(); List <SubjectModel> subjectList = new List <SubjectModel>(); List <KeywordModel> keywordList = new List <KeywordModel>(); List <UserTypeModel> userTypes = new List <UserTypeModel>(); //if (Request.IsStartup) //{ mainFormModel = new MainFormModel() { BrowseRecordCount = TranscriptionRepository.GetAll().Count(), TranscrptionQueueRecordCount = TranscriptionRepository.FindBy(t => t.TranscriptStatus == false).Count(), }; // collect repository details. List <repository> repositories = RepositoryRepository.GetRepositoriess(); foreach (repository item in repositories) { repositoryList.Add(Util.ConvertToRepositoryModel(item)); } // collect collection details. List <collection> collections = CollectionRepository.GetCollections().OrderBy(c => c.CollectionName).ToList(); foreach (collection item in collections) { newlist.Add(Util.ConvertToCollectionModel(item, repositories.First(c => c.Id == item.RepositoryId).RepositoryName)); } // collect subseries details. foreach (subsery item in SubseryRepository.GetSubseries().OrderBy(s => s.SubseriesName)) { newSubseriesList.Add(Util.ConvertToSubseryModel(item, collections.FirstOrDefault(s => s.Id == item.CollectionId).CollectionName)); } // collect subject details. foreach (subject item in SubjectRepository.GetSubjects()) { subjectList.Add(Util.ConvertToSubjectModel(item)); } // collect keywords details. foreach (keyword item in KeywordRepository.GetKeywords()) { keywordList.Add(Util.ConvertToKeywordModel(item)); } // collect user types details. foreach (usertype item in UserTypeRepository.GetAll()) { userTypes.Add(Util.ConvertToUsertypeModel(item)); } //} List <PredefinedUserModel> predefineUserList = Util.ConvertToPredefinedUserModel(PredefineUserRepository.GetPredefinedUsers()); List <string> audioEquipmentsUsed = AudioEquipmentUsedRepository.List(); List <string> videoEquipmentsUsed = VideoEquipmentUsedRepository.List(); Response = new ResponseModel() { Repositories = repositoryList, Subseries = newSubseriesList, Collections = newlist, Subjects = subjectList, Keywords = keywordList, PredefinedUsers = predefineUserList, AudioEquipmentsUsed = audioEquipmentsUsed, VideoEquipmentsUsed = videoEquipmentsUsed, UserTypes = userTypes, MainFormModel = mainFormModel, IsOperationSuccess = true }; }
public MainFormViewModel(MainFormModel model) : this() { Model = model; }
/// <summary> /// Creates a control for quering a collection. /// </summary> public QueryPageControl(MultiTabControl parent, MainFormModel viewModel, QueryModel query) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } if (query == null) { throw new ArgumentNullException(nameof(query)); } if (query.Collection == null) { throw new ArgumentNullException(nameof(query.Collection)); } Image = Icon.FromResource("LiteDB.Explorer.Core.Assets.Icons.Search.ico", typeof(QueryPageControl).Assembly); Query = query; this.Bind(page => page.Text, query.Collection, model => model.Name, DualBindingMode.OneWay); NumericUpDown itemsPerPage, pageCount, pageIndex; SyntaxHighlightingTextBox queryTextBox; Content = new TableLayout { Padding = new Padding(5), Rows = { #region Query Row new TableRow(new TableLayout { Padding = new Padding(0, 0, 0, 5), Spacing = new Size(5, 5), Rows = { new TableRow( new TableCell(new Label { Text = "Query:" }), new TableCell(queryTextBox = new SyntaxHighlightingTextBox { ReadOnly = false, ShowLines = false, Text = Query.QueryAsString = "{}" }, true), new TableCell(new Button(async(sender, e) => await runQuery(true).ConfigureAwait(false)) { Text = "Count" }), new TableCell(new Button(async(sender, e) => await runQuery().ConfigureAwait(false)) { Text = "Search" }), new TableCell(new Button((sender, e) => FindParent <MultiTabControl>()?.Remove(this)) { Text = "Close" })) } }), #endregion #region Query Paramters Row new TableRow(new TableLayout { Padding = new Padding(0, 0, 0, 5), Spacing = new Size(5, 5), Rows = { new TableRow( new TableCell(new Label { Text = "Items per Page:" }), new TableCell(itemsPerPage = new NumericUpDown { DecimalPlaces = 0, Increment = 1, MinValue = 1, Value = Query.ItemsPerPage = 50 }), new TableCell(new Label { Text = "Page:" }), new TableCell(pageIndex = new NumericUpDown { DecimalPlaces = 0, Increment = 1, MinValue = 1, Value = Query.PageIndex = 1 }), new TableCell(new Label { Text = "out of" }), new TableCell(pageCount = new NumericUpDown { DecimalPlaces = 0, Increment = 1, MinValue = 0, ReadOnly = true, Value = Query.PageCount = 0 }), null, new TableCell(new Button(addDoc) { Text = "Add" }), new TableCell(new Button(removeDoc) { Text = "Remove" }), new TableCell(new Button(editDoc) { Text = "Edit" })) } }), #endregion #region Query Results Row new TableRow(new TableCell(resultsTextBox = new SyntaxHighlightingTextBox { ReadOnly = true, ShowLines = true, Text = Query.ResultsAsString = "" }, true)) { ScaleHeight = true } #endregion } }; itemsPerPage.Bind(control => control.Value, query, model => model.ItemsPerPage, DualBindingMode.OneWayToSource); pageCount.Bind(control => control.Value, query, model => model.PageCount, DualBindingMode.OneWay); pageIndex.Bind(control => control.Value, query, model => model.PageIndex, DualBindingMode.OneWayToSource); queryTextBox.Bind(control => control.Text, query, model => model.QueryAsString, DualBindingMode.OneWayToSource); resultsTextBox.Bind(control => control.Text, query, model => model.ResultsAsString, DualBindingMode.OneWay); queryTextBox.KeyUp += async(sender, e) => { if (e.Control && e.Key == Keys.Enter) { await runQuery().ConfigureAwait(false); e.Handled = true; } }; itemsPerPage.ValueChanged += async(sender, e) => await runQuery().ConfigureAwait(false); pageIndex.ValueChanged += async(sender, e) => await runQuery().ConfigureAwait(false); viewModel.ActiveClipboardController = this; GotFocus += (sender, args) => { viewModel.ActiveClipboardController = this; viewModel.SelectedDatabase = Collection.Database; viewModel.SelectedCollection = Collection; }; #pragma warning disable 4014 runQuery(); #pragma warning restore 4014 }