210221PX Added gitignore, removed compilation warnings, more work on MV

This commit is contained in:
phantomix 2021-02-21 16:18:07 +01:00
parent 2aded95f62
commit d8b6dccae5
7 changed files with 103 additions and 20 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
obj/
/*.csproj.user
.vs/
bin/

View File

@ -69,8 +69,23 @@ namespace dezentrale.model
foreach (string f in files) foreach (string f in files)
message.Attachments.Add(new Attachment(f)); message.Attachments.Add(new Attachment(f));
#pragma warning disable CS0618 //Suppress deprecation warning
/* Warning CS0618: 'SmtpClient' is obsolete: 'SmtpClient
* and its network of types are poorly designed, we strongly
* recommend you use https://github.com/jstedfast/MailKit
* and https://github.com/jstedfast/MimeKit instead
* (CS0618) (dezentrale-members)
*
* I'm pretty much aware about this fancy new mail client
* project by some $user, which lets me keep track of POP3 and
* IMAP accounts and everything, but at this point I simply
* need a possibility to send mails via SMTP, and this is a
* feature, SmtpClient does very well, without dragging
* dependencies to other code into our project.
*/
SmtpClient client = new SmtpClient(Program.config.Smtp.Host, Program.config.Smtp.Port) SmtpClient client = new SmtpClient(Program.config.Smtp.Host, Program.config.Smtp.Port)
#pragma warning restore CS0618
{ {
DeliveryMethod = SmtpDeliveryMethod.Network, DeliveryMethod = SmtpDeliveryMethod.Network,
EnableSsl = Program.config.Smtp.SSL, EnableSsl = Program.config.Smtp.SSL,

View File

@ -13,6 +13,7 @@ namespace dezentrale.model
public string AuthCode { get; set; } = ""; public string AuthCode { get; set; } = "";
public bool AttendedMv { get; set; } = false; public bool AttendedMv { get; set; } = false;
[XmlIgnore] public string NumberString { get { return $"{MemberNumber:D3}"; } }
[XmlIgnore] public string InvitedString { get { return Invited ? "Yes" : "No"; } } [XmlIgnore] public string InvitedString { get { return Invited ? "Yes" : "No"; } }
private Member member = null; private Member member = null;

View File

@ -293,17 +293,20 @@ namespace dezentrale.model.svg
/** Tries to transform all contained path commands to absolute coordinate values */ /** Tries to transform all contained path commands to absolute coordinate values */
public void MakeAbsolute() public void MakeAbsolute()
{ {
#pragma warning disable CS0219 // suppress unused for now, until this method is implemented better
double x = 0; double x = 0;
double y = 0; double y = 0;
foreach(SvgPathCommand c in CommandList) #pragma warning restore CS0219
foreach (SvgPathCommand c in CommandList)
{ {
} }
throw new NotImplementedException();
} }
/** Tries to transform all contained path commands to absolute coordinate values */ /** Tries to transform all contained path commands to absolute coordinate values */
public void MakeRelative() public void MakeRelative()
{ {
throw new NotImplementedException();
} }
public void AddCommand(SvgPathCommand cmd) { CommandList.Add(cmd); } public void AddCommand(SvgPathCommand cmd) { CommandList.Add(cmd); }
@ -312,8 +315,10 @@ namespace dezentrale.model.svg
/**\short translates all path coordinates by (dx, dy) */ /**\short translates all path coordinates by (dx, dy) */
public void Translate(double dx, double dy) public void Translate(double dx, double dy)
{ {
#pragma warning disable CS0219 // suppress unused for now, until this method is implemented better
double x = 0; double x = 0;
double y = 0; double y = 0;
#pragma warning restore CS0219
foreach (SvgPathCommand cmd in CommandList) foreach (SvgPathCommand cmd in CommandList)
{ {
if(!cmd.Relative) if(!cmd.Relative)
@ -321,11 +326,12 @@ namespace dezentrale.model.svg
//cmd.Translate(dx, dy); //cmd.Translate(dx, dy);
} }
} }
throw new NotImplementedException();
} }
/**\short scales all path coordinates around the center point (cx,cy) by the factors of (fx, fy) */ /**\short scales all path coordinates around the center point (cx,cy) by the factors of (fx, fy) */
public void Scale(double cx, double cy, double fx, double fy) public void Scale(double cx, double cy, double fx, double fy)
{ {
throw new NotImplementedException();
} }
} }
} }

View File

@ -15,25 +15,39 @@ namespace dezentrale.view
{ {
return new List<ConfigLVDataHandler>() return new List<ConfigLVDataHandler>()
{ {
new ConfigLVDataHandler()
{
Name = "number",
Display = "#",
Width = 40,
CustomToString = x => ((MvInvitedMember)x).NumberString,
},
new ConfigLVDataHandler()
{
Name = "nickname",
Display = "name / nickname",
Width = 120,
CustomToString = x => ((MvInvitedMember)x).Member?.Nickname,
},
new ConfigLVDataHandler() new ConfigLVDataHandler()
{ {
Name = "invited", Name = "invited",
Display = "Invited", Display = "Invited",
Width = 57, TextAlign = HorizontalAlignment.Right, Width = 48, TextAlign = HorizontalAlignment.Right,
CustomToString = ( x => ((MvInvitedMember)x).InvitedString), CustomToString = ( x => ((MvInvitedMember)x).InvitedString),
}, },
new ConfigLVDataHandler() new ConfigLVDataHandler()
{ {
Name = "date", Name = "date",
Display = "Date", Display = "Date",
Width = 160, Width = 130,
CustomToString = ( x => (((MvInvitedMember)x).InvitationDate.ToString()) ), CustomToString = ( x => (((MvInvitedMember)x).InvitationDate.Year > 1 ? ((MvInvitedMember)x).InvitationDate.ToString() : "-") ),
}, },
}; };
} }
} }
public LvMvInvitations() : base(Program.config.MemberListColumns, LvMvInvitations_ColumnsChanged) { } public LvMvInvitations() : base(Program.config.MvInvitationsListColumns, LvMvInvitations_ColumnsChanged, false) { }
private static void LvMvInvitations_ColumnsChanged(object sender, ColumnsChangedArgs e) private static void LvMvInvitations_ColumnsChanged(object sender, ColumnsChangedArgs e)
{ {

View File

@ -252,8 +252,16 @@ namespace dezentrale.view
private void lstMv_New(object sender, EventArgs e) private void lstMv_New(object sender, EventArgs e)
{ {
frmMv newMv = new frmMv(); DialogResult res = MessageBox.Show("This will create a new MV and store it in MV list.\n", "Create new MV?", MessageBoxButtons.YesNo);
newMv.ShowDialog(); if (res == DialogResult.Yes)
{
frmMv newMv = new frmMv();
Program.mvList.Entries.Add(newMv.mv);
Program.mvList.SaveToFile();
newMv.ShowDialog();
Program.mvList.SaveToFile();
}
//if(newMv.DialogResult == DialogResult.OK) //if(newMv.DialogResult == DialogResult.OK)
//lstMv.AddEntry(newMv.GetMv()); //lstMv.AddEntry(newMv.GetMv());

View File

@ -17,7 +17,7 @@ namespace dezentrale.view
*/ */
public class frmMv : FormWithActionButtons public class frmMv : FormWithActionButtons
{ {
private Mv mv; public Mv mv { get; set; }
private TabControl tabControl; private TabControl tabControl;
//private TabPage tabInvitationSettings; //private TabPage tabInvitationSettings;
@ -32,8 +32,8 @@ namespace dezentrale.view
private TextBox tbInviteHeadline; private TextBox tbInviteHeadline;
private TextBox tbInviteBody; private TextBox tbInviteBody;
//private TabPage tabMemberInvitation; //private TabPage tabMemberInvitation;
//private ComboBox cbInviteSelection;
//List with all members and invited yes|no //List with all members and invited yes|no
private LvMvInvitations lvMvInvitations;
//Option to invite selected|all members //Option to invite selected|all members
//private TabPage tabRunningMv; //private TabPage tabRunningMv;
//List with invited members with authenticated status //List with invited members with authenticated status
@ -203,13 +203,19 @@ namespace dezentrale.view
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom, //Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
}; };
split.Panel1.Controls.Add(grpInvitations); split.Panel1.Controls.Add(grpInvitations);
GroupBox grpPreview = new GroupBox()
grpInvitations.Controls.Add(lvMvInvitations = new LvMvInvitations()
{ {
Dock = DockStyle.Fill, Dock = DockStyle.Fill,
Text = "Invitation mail preview", });
Width = 500, GroupBox grpPreview = new GroupBox()
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom, {
}; Dock = DockStyle.Fill,
Text = "Invitation mail preview",
Width = 500,
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
};
split.Panel2.Controls.Add(grpPreview); split.Panel2.Controls.Add(grpPreview);
grpInvitations.Controls.Add(null); grpInvitations.Controls.Add(null);
@ -290,7 +296,36 @@ namespace dezentrale.view
UpdateButtons(); UpdateButtons();
programmaticChange = false; programmaticChange = false;
RefreshPreview(); RefreshPreview();
//for new MV, we want to keep the member list up-to-date in order
//to be able to invite new members even if their membership status
//becomes active after MV entry was generated. The other way round,
//entries with no (or inactive) member reference will not be
//removed (documentation purposes)
if (this.mv.Status < Mv.MvStatus.Started)
{
foreach (Member m in Program.members.Entries)
{
if (m.Status == Member.eStatus.Active)
{
//find invitation entry
if(this.mv.Invited.Find((x) => x.MemberNumber == m.Number) == null)
//if there is none, create one
{
this.mv.Invited.Add(new MvInvitedMember()
{
MemberNumber = m.Number,
});
}
}
}
}
foreach(MvInvitedMember mvi in this.mv.Invited)
lvMvInvitations.AddEntry(mvi);
} }
public frmMv(Mv mv) public frmMv(Mv mv)
{ {
this.mv = mv; this.mv = mv;
@ -327,9 +362,9 @@ namespace dezentrale.view
*/ */
this.Close(); this.Close();
} }
private void btnCancel_Click(object sender, EventArgs e) // private void btnCancel_Click(object sender, EventArgs e)
{ // {
this.Close(); // this.Close();
} // }
} }
} }