210118PX Worked on MV data structures and GUI; the MV list is now read from / stored to Disk and there's a ListView to display MVs in the future
This commit is contained in:
parent
55f446c1d9
commit
04535e8427
28
Program.cs
28
Program.cs
|
@ -53,6 +53,7 @@ namespace dezentrale
|
|||
public static string ConfigFile = Path.Combine(DmDirectory, "configuration.xml");
|
||||
public static Configuration config = new Configuration();
|
||||
public static MemberList members = new MemberList();
|
||||
public static MvList mvList = new MvList();
|
||||
|
||||
public static bool MoneyTransfersLoaded { get { return moneyTransfers != null; } }
|
||||
private static MoneyTransferList moneyTransfers = null;
|
||||
|
@ -118,6 +119,33 @@ namespace dezentrale
|
|||
Console.WriteLine(ex.Message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
string mvFileName = System.IO.Path.Combine(Program.config.DbDirectory, MvList.FileName);
|
||||
mvList = (MvList)XmlData.LoadFromFile(mvFileName, typeof(MvList));
|
||||
Console.WriteLine($"Loaded MV list with {mvList.Entries.Count} entries");
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Console.WriteLine("Creating new MV list file");
|
||||
try
|
||||
{
|
||||
mvList.SaveToFile();
|
||||
} catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error while creating new MV list:");
|
||||
Console.WriteLine(ex.Message);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error while loading MV list:");
|
||||
Console.WriteLine(ex.Message);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
<Compile Include="model\svg\SvgPath.cs" />
|
||||
<Compile Include="model\MvList.cs" />
|
||||
<Compile Include="model\Blob.cs" />
|
||||
<Compile Include="view\LvMv.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace dezentrale.model
|
|||
//UI: lstMembers: Columns
|
||||
[XmlElement("MemberListColumn")] public List<ConfigLVColumn> MemberListColumns { get; set; } = new List<ConfigLVColumn>();
|
||||
[XmlElement("MTListColumn")] public List<ConfigLVColumn> MTListColumns { get; set; } = new List<ConfigLVColumn>();
|
||||
[XmlElement("MvListColumn")] public List<ConfigLVColumn> MvListColumns { get; set; } = new List<ConfigLVColumn>();
|
||||
|
||||
[XmlElement] public List<KeyValue> MoneyTransferRegEx { get; set; } = new List<KeyValue>(); //This doesn't belong here! Move to new file within db-data!
|
||||
[XmlElement] public DateTime LastCronjobRun { get; set; } = DateTime.Now; //This doesn't belong here! Move to new file within db-data!
|
||||
|
|
10
model/Mv.cs
10
model/Mv.cs
|
@ -13,6 +13,16 @@ namespace dezentrale.model
|
|||
|
||||
public class Mv : XmlData
|
||||
{
|
||||
public enum MvStatus
|
||||
{
|
||||
InPreparation = 0,
|
||||
InvitationSent = 1,
|
||||
Started = 2,
|
||||
Ended = 3,
|
||||
Cancelled = 0xFF,
|
||||
}
|
||||
|
||||
public MvStatus Status { get; set; }
|
||||
public DateTime EventDate { get; set; }
|
||||
public string Headline { get; set; }
|
||||
public string Introduction { get; set; }
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using dezentrale.model;
|
||||
|
||||
namespace dezentrale.view
|
||||
{
|
||||
public class LvMv : CustomListView<Mv>
|
||||
{
|
||||
protected override List<ConfigLVDataHandler> DefaultColumns
|
||||
{ get
|
||||
{ return new List<ConfigLVDataHandler>()
|
||||
{
|
||||
new ConfigLVDataHandler()
|
||||
{
|
||||
Name = "status",
|
||||
Display = "Status",
|
||||
Width = 57, TextAlign = HorizontalAlignment.Right,
|
||||
CustomToString = ( x => ((Mv)x).Status.ToString()),
|
||||
},
|
||||
new ConfigLVDataHandler()
|
||||
{
|
||||
Name = "date",
|
||||
Display = "Date",
|
||||
Width = 160,
|
||||
CustomToString = ( x => (((Mv)x).EventDate.ToString()) ),
|
||||
},
|
||||
};
|
||||
} }
|
||||
|
||||
public LvMv() : base(Program.config.MemberListColumns, LvMv_ColumnsChanged) { }
|
||||
|
||||
private static void LvMv_ColumnsChanged(object sender, ColumnsChangedArgs e)
|
||||
{
|
||||
Console.WriteLine("LvMv_ColumnsChanged");
|
||||
Program.config.MvListColumns.Clear();
|
||||
foreach (ConfigLVDataHandler c in e.Columns) Program.config.MvListColumns.Add(new ConfigLVColumn(c));
|
||||
XmlData.SaveToFile(Program.ConfigFile, Program.config);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ namespace dezentrale.view
|
|||
{
|
||||
private LVMembers lstMembers;
|
||||
private LVMoneyTransfers mtv;
|
||||
private LvMv lstMv;
|
||||
|
||||
private void BuildMoneyTransfers(Control parent)
|
||||
{
|
||||
|
@ -103,13 +104,16 @@ namespace dezentrale.view
|
|||
//lstMembers.AddMenuItem("Main Settings", null);
|
||||
lstMembers.DoubleClick += lstMembers_Edit;
|
||||
|
||||
TabPage tabMvList = new TabPage("MvList");
|
||||
tabMvList.Controls.Add(lstMv = new LvMv() { Dock = DockStyle.Fill, });
|
||||
|
||||
TabPage tabMoneyTransfers = new TabPage("MoneyTransfers");
|
||||
BuildMoneyTransfers(tabMoneyTransfers);
|
||||
|
||||
this.Controls.Add(new TabControl()
|
||||
{
|
||||
Dock = DockStyle.Fill,
|
||||
TabPages = { tabMembers, tabMoneyTransfers },
|
||||
TabPages = { tabMembers, tabMvList, tabMoneyTransfers },
|
||||
});
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue