-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AdminUI #1
base: master
Are you sure you want to change the base?
AdminUI #1
Changes from all commits
860a13b
3912fd4
0bca4af
5ccad87
2851830
7c3929b
7ea9623
a7ffa1c
c78c76e
f4dc3b6
475ef30
ac8e3db
45fac6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace Meridian59.DebugUI.CustomDataGridColumns | ||
{ | ||
class TagCell : DataGridViewTextBoxCell | ||
{ | ||
|
||
} | ||
} |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Windows.Forms; | ||
using Meridian59.Data.Models.AdminData; | ||
|
||
namespace Meridian59.DebugUI | ||
{ | ||
public partial class ObjectEditor : Form | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually the classname of all views refers to the model name that is shown in the view, e.g.:
It looks like a proper name would be "AdminObjectView", because this class seems to display the data of the "AdminObject" model. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. |
||
{ | ||
private BindingSource dataBindingSource; | ||
private AdminObject trackedObject; | ||
|
||
public ObjectEditor(AdminObject obj) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not pass the datasource as a constructor parameter. Instead define a property "DataSource" on your UI (view), according to MVC pattern the type of this property of course would be the one of the according underlying model providing the data for the view (your "AdminData" class for example if you need all of it - or in this case probably just "AdminObject") Please have a look at "RoomInfoView.cs" or "RoomObjectsView.cs" for examples for "DataSource" property. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not completed yet. There are a lof of ways I can work better within your design/architecture. I'll work on that slowly. I feel like now that I have AdminData class in Meridian59 I might need an AdminUIController in DebugUI that handles talking to AdminData. I probably need to define some Interfaces for AdminObject and AdminProperty, INotifyProeprtyChanged is probably not going to work in the long run. |
||
{ | ||
InitializeComponent(); | ||
Text = String.Format("{0} {1}", obj.ObjectNumber, obj.ClassName); | ||
dataBindingSource = new BindingSource(); | ||
dataBindingSource.DataSource = obj.Properties; | ||
dataGridView1.DataSource = dataBindingSource; | ||
dataGridView1.Columns[0].ReadOnly = true; | ||
obj.PropertyChanged += TrackedObject_OnPropertyChanged; | ||
trackedObject = obj; | ||
} | ||
|
||
private void TrackedObject_OnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) | ||
{ | ||
RefreshData(); | ||
ResetBindings(); | ||
} | ||
|
||
public void RefreshData() | ||
{ | ||
dataBindingSource.Clear(); | ||
dataBindingSource.DataSource = null; | ||
dataGridView1.DataSource = null; | ||
dataBindingSource.DataSource = trackedObject.Properties; | ||
dataGridView1.DataSource = dataBindingSource; | ||
dataGridView1.Refresh(); | ||
} | ||
|
||
public AdminObject GetTrackedObject() | ||
{ | ||
return trackedObject; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this class have any purpose yet or is it a preparation for something you have in mind ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a placeholder. I want to have a custom column for the "Tag/Blakserv DataType" column in the ObjectEditor form.