210201PX Further work on MV GUI, replacing the "invitation wizard"
This commit is contained in:
parent
04535e8427
commit
322dd5ac70
|
@ -7,19 +7,13 @@ using dezentrale.model.money;
|
|||
|
||||
namespace dezentrale.core
|
||||
{
|
||||
public enum MvInvitationGroup
|
||||
{
|
||||
AllActiveMembers,
|
||||
AllMembers,
|
||||
AllSelectedFromMainWindow,
|
||||
}
|
||||
//! \short Data provider for the MV invitation process
|
||||
public interface IMvInvitationData
|
||||
{
|
||||
bool GenerateAuthCode { get; }
|
||||
string Headline { get; }
|
||||
string Body { get; }
|
||||
DateTime MvEventDate { get; }
|
||||
string InviteHeadline { get; }
|
||||
string InviteBody { get; }
|
||||
DateTime EventDate { get; }
|
||||
|
||||
|
||||
|
||||
|
@ -83,12 +77,12 @@ namespace dezentrale.core
|
|||
m.MvAuthenticationCode = RandomString(10);
|
||||
}
|
||||
|
||||
m.MvEventDate = data.MvEventDate;
|
||||
m.MvEventDate = data.EventDate;
|
||||
FormMail fm = new FormMail()
|
||||
{
|
||||
To = $"{m.EMailName} <{m.EMail}>",
|
||||
Subject = data.Headline,
|
||||
Body = data.Body,
|
||||
Subject = data.InviteHeadline,
|
||||
Body = data.InviteBody,
|
||||
};
|
||||
m.CurrentLog.SubEvents.Add(fm.Send(m));
|
||||
m.MvDateInvited = DateTime.Now;
|
||||
|
|
|
@ -196,7 +196,7 @@
|
|||
<Compile Include="view\FormWithOkCancel.cs" />
|
||||
<Compile Include="core\PaymentReceiptProcess.cs" />
|
||||
<Compile Include="core\ReplaceReflectEntity.cs" />
|
||||
<Compile Include="view\frmMvInvitation.cs" />
|
||||
<Compile Include="view\frmMv.cs" />
|
||||
<Compile Include="core\MvInvitationProcess.cs" />
|
||||
<Compile Include="model\Mv.cs" />
|
||||
<Compile Include="model\svg\SvgFile.cs" />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using dezentrale.core;
|
||||
|
||||
namespace dezentrale.model
|
||||
{
|
||||
|
@ -11,7 +12,7 @@ namespace dezentrale.model
|
|||
public bool AttendedMv { get; set; } = false;
|
||||
}
|
||||
|
||||
public class Mv : XmlData
|
||||
public class Mv : XmlData, IMvInvitationData
|
||||
{
|
||||
public enum MvStatus
|
||||
{
|
||||
|
@ -24,7 +25,8 @@ namespace dezentrale.model
|
|||
|
||||
public MvStatus Status { get; set; }
|
||||
public DateTime EventDate { get; set; }
|
||||
public string Headline { get; set; }
|
||||
public string InviteHeadline { get; set; }
|
||||
public string InviteBody { get; set; } //Todo: Generation on-the-fly
|
||||
public string Introduction { get; set; }
|
||||
public string Place { get; set; }
|
||||
public bool GenerateAuthCode { get; set; }
|
||||
|
|
|
@ -68,9 +68,9 @@ namespace dezentrale.view
|
|||
new MenuItem("Show numeric &info", lstMembers_mnuMain_Members_ShowInfo),
|
||||
} },
|
||||
new MenuItem("MV")
|
||||
{ MenuItems = {
|
||||
new MenuItem("&Send MV invitation...", mnuMain_Members_MV_intivation),
|
||||
new MenuItem("Run MV", mnuMain_Members_MV_run),
|
||||
{ MenuItems = {
|
||||
new MenuItem("&New MV...", lstMv_New), //Todo: Do we even need this here?
|
||||
new MenuItem("&Cancel selected MV...", lstMv_CancelSelected), //Todo: Do we even need this here?
|
||||
} },
|
||||
new MenuItem("Payments")
|
||||
{ MenuItems = {
|
||||
|
@ -106,7 +106,8 @@ namespace dezentrale.view
|
|||
|
||||
TabPage tabMvList = new TabPage("MvList");
|
||||
tabMvList.Controls.Add(lstMv = new LvMv() { Dock = DockStyle.Fill, });
|
||||
|
||||
lstMv.AddMenuItem("New MV...", lstMv_New);
|
||||
lstMv.AddMenuItem("Cancel selected MV...", lstMv_CancelSelected);
|
||||
TabPage tabMoneyTransfers = new TabPage("MoneyTransfers");
|
||||
BuildMoneyTransfers(tabMoneyTransfers);
|
||||
|
||||
|
@ -249,11 +250,16 @@ namespace dezentrale.view
|
|||
}
|
||||
}
|
||||
|
||||
private void mnuMain_Members_MV_intivation(object sender, EventArgs e)
|
||||
private void lstMv_New(object sender, EventArgs e)
|
||||
{
|
||||
frmMv newMv = new frmMv();
|
||||
newMv.ShowDialog();
|
||||
//if(newMv.DialogResult == DialogResult.OK)
|
||||
//lstMv.AddEntry(newMv.GetMv());
|
||||
|
||||
//This process runs in two steps: First, the GUI will ask the user about all details,
|
||||
//Second, there will be a @ref BackgroundProcess launched that prepares and sends the e-mails.
|
||||
frmMvInvitation mvInvitation = new frmMvInvitation();
|
||||
/* frmMvInvitation mvInvitation = new frmMvInvitation();
|
||||
DialogResult dr = mvInvitation.ShowDialog();
|
||||
if (dr == DialogResult.Cancel) return;
|
||||
{
|
||||
|
@ -280,10 +286,15 @@ namespace dezentrale.view
|
|||
MvInvitationProcess inv = new MvInvitationProcess(mvInvitation, lm);
|
||||
frmProcessWithLog frmInv = new frmProcessWithLog(inv, true);
|
||||
dr = frmInv.ShowDialog();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
private void mnuMain_Members_MV_run(object sender, EventArgs e)
|
||||
private void lstMv_CancelSelected(object sender, EventArgs e)
|
||||
{
|
||||
//Cancels selected MV
|
||||
//- check if there's a valid selection
|
||||
//- ask if the program shall send cancellation mails to the invided members
|
||||
//- set mv status to Cancelled
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using dezentrale.core;
|
||||
using dezentrale.model;
|
||||
|
||||
namespace dezentrale.view
|
||||
{
|
||||
/**
|
||||
* This form contains multiple tabs to handle the aspects of a
|
||||
* MV, starting from invitation up to running the MV.
|
||||
*/
|
||||
public class frmMv : FormWithOkCancel
|
||||
{
|
||||
private Mv mv;
|
||||
private TabControl tabControl;
|
||||
|
||||
//private TabPage tabInvitationSettings;
|
||||
//DateTime
|
||||
private DateTimePicker mvDate, mvTime;
|
||||
//Place
|
||||
private TextBox tbPlace;
|
||||
|
||||
//Agenda
|
||||
private TextBox tbMvAgenda;
|
||||
//Subject
|
||||
private TextBox tbInviteHeadline;
|
||||
private TextBox tbInviteBody;
|
||||
//private TabPage tabMemberInvitation;
|
||||
//private ComboBox cbInviteSelection;
|
||||
//List with all members and invited yes|no
|
||||
//Option to invite selected|all members
|
||||
//private TabPage tabRunningMv;
|
||||
//List with invited members with authenticated status
|
||||
//Textbox to paste auth codes from the users
|
||||
//textbox to hold an external MV protocol URL and/or
|
||||
//[rich] textbox for MV protocol
|
||||
//Button to finish MV
|
||||
|
||||
private TabPage BuildPageInvitationSettings()
|
||||
{
|
||||
TabPage page = new TabPage("Invitation Settings");
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Event date+time:",
|
||||
Location = new Point(lm, 0 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(mvDate = new DateTimePicker()
|
||||
{
|
||||
Location = new Point(lm + 113, 0 * line + tm),
|
||||
Width = 110,
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left,
|
||||
Format = DateTimePickerFormat.Short,
|
||||
});
|
||||
page.Controls.Add(mvTime = new DateTimePicker()
|
||||
{
|
||||
Location = new Point(lm + 243, 0 * line + tm),
|
||||
Width = 90,
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left,
|
||||
Format = DateTimePickerFormat.Time,
|
||||
});
|
||||
|
||||
mvDate.Value = this.mv.EventDate;
|
||||
mvTime.Value = this.mv.EventDate;
|
||||
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Place:",
|
||||
Location = new Point(lm, 1 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbPlace = new TextBox()
|
||||
{
|
||||
Location = new Point(lm + 113, 1 * line + tm),
|
||||
Width = 580,
|
||||
Text = "Räumlichkeiten des dezentrale e.V., Dreilindenstr. 19, 04177 Leipzig"
|
||||
});
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Agenda (one item per line, auto-numbered:",
|
||||
Location = new Point(lm, 2 * line + tm + labelOffs),
|
||||
Size = new Size(320, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbMvAgenda = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 3 * line + tm),
|
||||
Size = new Size(700, 160),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Bestimmung des Versammlungsleiters sowie Protokollanten\n" +
|
||||
"Feststellung der ordnungsgemäßen Einberufung\n" +
|
||||
"Feststellung der Beschlussfähigkeit\n" +
|
||||
"Genehmigung der Tagesordnung\n" +
|
||||
"Genehmigung des Protokolls der letzten Mitgliederversammlung\n" +
|
||||
"Berichte des Vorstandes\n" +
|
||||
"Entlastung des Vorstandes\n" +
|
||||
"Neuwahl des Vorstandes\n" +
|
||||
"Verschiedenes"
|
||||
});
|
||||
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Headline:",
|
||||
Location = new Point(lm, 6 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbInviteHeadline = new TextBox()
|
||||
{
|
||||
Location = new Point(lm + 113, 6 * line + tm),
|
||||
Width = 580,
|
||||
Text = "Einladung zur Mitgliederversammlung des dezentrale e.V. am {EventDate}"
|
||||
});
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Invitation Body:",
|
||||
Location = new Point(lm, 7 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbInviteBody = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 8 * line + tm),
|
||||
Size = new Size(700, 80),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Hallo {EMailName},\n\nhiermit möchte ich Dich als Mitglied\n"
|
||||
+ "des dezentrale e.V. zur Mitgliederversammlung einladen.\n\n"
|
||||
+ "Ort: {Place}\n"
|
||||
+ "Datum und Uhrzeit: {EventDate}\n"
|
||||
+ "Dein Authentifizierungscode: {MvAuthenticationCode}\n\n"
|
||||
+ "Agenda:\n-------\n"
|
||||
+ "{AgendaNumberedString}\n\n"
|
||||
+ "Bitte denkt daran, dass für die Beschlussfähigkeit 51% der regulären Mitglieder vonnöten sind.\n\n"
|
||||
+ "Liebe Grüße,\n\n\n"
|
||||
+ $"{Program.config.LocalUser}"
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
private TabPage BuildPageMemberInvitation()
|
||||
{
|
||||
TabPage page = new TabPage("Member invitation");
|
||||
return page;
|
||||
}
|
||||
|
||||
private TabPage BuildPageRunningMv()
|
||||
{
|
||||
TabPage page = new TabPage("Running MV");
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
this.StartPosition = FormStartPosition.CenterParent;
|
||||
this.Size = new System.Drawing.Size(800, 600);
|
||||
this.Text = "dezentrale-members :: Send MV invitation";
|
||||
this.Controls.Add(tabControl = new TabControl()
|
||||
{
|
||||
Size = new System.Drawing.Size(this.Width - 16, this.Height - 95),
|
||||
TabPages =
|
||||
{
|
||||
BuildPageInvitationSettings(),
|
||||
BuildPageMemberInvitation(),
|
||||
BuildPageRunningMv(),
|
||||
},
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
});
|
||||
|
||||
AddOkCancel(this, btnOK_Click, btnCancel_Click);
|
||||
}
|
||||
public frmMv(Mv mv)
|
||||
{
|
||||
this.mv = mv;
|
||||
Init();
|
||||
}
|
||||
public frmMv()
|
||||
{
|
||||
this.mv = new Mv();
|
||||
DateTime inTwoWeeks = DateTime.Now.Add(new TimeSpan(14, 0, 0, 0));
|
||||
DateTime dtSuggested = inTwoWeeks.Hour < 15 ? inTwoWeeks : inTwoWeeks.Add(new TimeSpan(1, 0, 0, 0));
|
||||
while (dtSuggested.DayOfWeek != DayOfWeek.Sunday)
|
||||
dtSuggested = dtSuggested.Add(new TimeSpan(1, 0, 0, 0));
|
||||
this.mv.EventDate = new DateTime(dtSuggested.Year, dtSuggested.Month, dtSuggested.Day, 15, 0, 0);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
private string GenerateAgenda()
|
||||
{
|
||||
string agenda = "Tagesordnung:\n";
|
||||
string[] items = tbMvAgenda.Text.Split('\n');
|
||||
for(int i = 0; i < items.Length; i++)
|
||||
{
|
||||
agenda += $"{i + 1}. {items[i]}\n";
|
||||
}
|
||||
return agenda;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
/*
|
||||
GenerateAuthCode = chkGenerateAuthCode.Checked;
|
||||
Headline = tbPreviewHeadline.Text;
|
||||
Body = tbPreviewBody.Text;
|
||||
InvitationGroup = (MvInvitationGroup)cbInviteSelection.SelectedItem;
|
||||
MvEventDate = new DateTime(mvDate.Value.Year, mvDate.Value.Month, mvDate.Value.Day,
|
||||
mvTime.Value.Hour, mvTime.Value.Minute, mvTime.Value.Second);
|
||||
*/
|
||||
this.Close();
|
||||
}
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,355 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using dezentrale.core;
|
||||
using dezentrale.model;
|
||||
|
||||
namespace dezentrale.view
|
||||
{
|
||||
/**
|
||||
* This form is wizard-alike and contains multiple pages that are
|
||||
* designed to be worked through in order.
|
||||
*/
|
||||
public class frmMvInvitation : FormWithOkCancel, IMvInvitationData
|
||||
{
|
||||
//IMvInvitationData
|
||||
public bool GenerateAuthCode { get; private set; } = false;
|
||||
public string Headline { get; private set; } = "";
|
||||
public string Body { get; private set; } = "";
|
||||
public MvInvitationGroup InvitationGroup { get; private set; } = MvInvitationGroup.AllActiveMembers;
|
||||
public DateTime MvEventDate { get; private set; }
|
||||
|
||||
|
||||
TabControl tabControl;
|
||||
//Page Generic
|
||||
private ComboBox cbInviteSelection;
|
||||
private DateTimePicker mvDate, mvTime;
|
||||
private CheckBox chkGenerateAuthCode;
|
||||
|
||||
private TextBox tbHeadline;
|
||||
|
||||
private TextBox tbIntroductionPassage;
|
||||
private TextBox tbEventTimeAndPlacePassage;
|
||||
private TextBox tbAuthCodePassage;
|
||||
|
||||
//Page Agenda
|
||||
private TextBox tbAgendaPassage;
|
||||
private TextBox tbAdditionalInfoPassage;
|
||||
|
||||
//Page Preview
|
||||
private TextBox tbPreviewHeadline;
|
||||
private TextBox tbPreviewBody;
|
||||
|
||||
|
||||
protected Button tabControlNext;
|
||||
|
||||
private bool DataGenerated { get; set; } = false;
|
||||
|
||||
private TabPage BuildPageGeneric()
|
||||
{
|
||||
DateTime inTwoWeeks = DateTime.Now.Add(new TimeSpan(14, 0, 0, 0));
|
||||
|
||||
TabPage page = new TabPage("Generic");
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Send invitation to:",
|
||||
Location = new Point(lm, 0 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(cbInviteSelection = new ComboBox()
|
||||
{
|
||||
Location = new Point(lm + 113, 0 * line + tm),
|
||||
Width = 220,
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left,
|
||||
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||
ForeColor = Color.Black,
|
||||
});
|
||||
foreach (MvInvitationGroup group in Enum.GetValues(typeof(MvInvitationGroup)))
|
||||
cbInviteSelection.Items.Add(group);
|
||||
cbInviteSelection.SelectedIndex = 0;
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Event date+time:",
|
||||
Location = new Point(lm, 1 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(mvDate = new DateTimePicker()
|
||||
{
|
||||
Location = new Point(lm + 113, 1 * line + tm),
|
||||
Width = 110,
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left,
|
||||
Format = DateTimePickerFormat.Short,
|
||||
});
|
||||
page.Controls.Add(mvTime = new DateTimePicker()
|
||||
{
|
||||
Location = new Point(lm + 243, 1 * line + tm),
|
||||
Width = 90,
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left,
|
||||
Format = DateTimePickerFormat.Time,
|
||||
});
|
||||
mvDate.Value = new DateTime(inTwoWeeks.Year, inTwoWeeks.Month, inTwoWeeks.Day, 15, 0, 0);
|
||||
mvTime.Value = new DateTime(inTwoWeeks.Year, inTwoWeeks.Month, inTwoWeeks.Day, 15, 0, 0);
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Headline:",
|
||||
Location = new Point(lm, 2 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbHeadline = new TextBox()
|
||||
{
|
||||
Location = new Point(lm + 113, 2 * line + tm),
|
||||
Width = 580,
|
||||
Text = "Einladung zur Mitgliederversammlung des dezentrale e.V. am {MvEventDate}"
|
||||
});
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Introduction:",
|
||||
Location = new Point(lm, 3 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbIntroductionPassage = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 4 * line + tm),
|
||||
Size = new Size(700, 80),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Hallo {EMailName},\n\nhiermit möchte ich Dich als Mitglied\n"
|
||||
+ "des dezentrale e.V. zur Mitgliederversammlung einladen."
|
||||
});
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Event place+time:",
|
||||
Location = new Point(lm, 8 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbEventTimeAndPlacePassage = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 9 * line + tm),
|
||||
Size = new Size(700, 50),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Ort: Räumlichkeiten des dezentrale e.V., Dreilindenstr. 19, 04177 Leipzig\n"
|
||||
+ "Datum und Uhrzeit: {MvEventDate}"
|
||||
});
|
||||
page.Controls.Add(chkGenerateAuthCode = new CheckBox()
|
||||
{
|
||||
Location = new Point(0, 12 * line + tm),
|
||||
Width = 700,
|
||||
Text = "Generate authentification code for every member",
|
||||
Checked = true,
|
||||
});
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Auth Code:",
|
||||
Location = new Point(lm, 13 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbAuthCodePassage = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 14 * line + tm),
|
||||
Size = new Size(700, 50),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Dein Authentifizierungscode: {MvAuthenticationCode}"
|
||||
});
|
||||
chkGenerateAuthCode.CheckedChanged += (sender, e) => { tbAuthCodePassage.Enabled = chkGenerateAuthCode.Checked; };
|
||||
return page;
|
||||
}
|
||||
|
||||
private TabPage BuildPageAgenda()
|
||||
{
|
||||
TabPage page = new TabPage("Agenda");
|
||||
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Agenda (one item per line, auto-numbered:",
|
||||
Location = new Point(lm, 0 * line + tm + labelOffs),
|
||||
Size = new Size(320, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbAgendaPassage = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 1 * line + tm),
|
||||
Size = new Size(700, 160),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Bestimmung des Versammlungsleiters sowie Protokollanten\n" +
|
||||
"Feststellung der ordnungsgemäßen Einberufung\n" +
|
||||
"Feststellung der Beschlussfähigkeit\n" +
|
||||
"Genehmigung der Tagesordnung\n" +
|
||||
"Genehmigung des Protokolls der letzten Mitgliederversammlung\n" +
|
||||
"Berichte des Vorstandes\n" +
|
||||
"Entlastung des Vorstandes\n" +
|
||||
"Neuwahl des Vorstandes\n" +
|
||||
"Verschiedenes"
|
||||
});
|
||||
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Additional information (e.g. Satzung quotes, etc):",
|
||||
Location = new Point(lm, 8 * line + tm + labelOffs),
|
||||
Size = new Size(320, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbAdditionalInfoPassage = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 9 * line + tm),
|
||||
Size = new Size(700, 160),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Text = "Bitte denkt daran, dass für die Beschlussfähigkeit 51% der regulären Mitglieder vonnöten sind.\n\n" +
|
||||
$"Liebe Grüße,\n\n\n{Program.config.LocalUser}"
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
private TabPage BuildPagePreview()
|
||||
{
|
||||
TabPage page = new TabPage("Preview");
|
||||
Button btnGenerateResult;
|
||||
page.Controls.Add(btnGenerateResult = new Button()
|
||||
{
|
||||
Location = new Point(lm, 0 * line + tm + labelOffs),
|
||||
Width = 220,
|
||||
Text = "Generate from previous pages"
|
||||
});
|
||||
btnGenerateResult.Click += btnGenerateResult_Click;
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Headline:",
|
||||
Location = new Point(lm, 2 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbPreviewHeadline = new TextBox()
|
||||
{
|
||||
Location = new Point(lm + 113, 2 * line + tm),
|
||||
Width = 580,
|
||||
Text = "",
|
||||
Enabled = false,
|
||||
});
|
||||
page.Controls.Add(new Label()
|
||||
{
|
||||
Text = "Message body:",
|
||||
Location = new Point(lm, 3 * line + tm + labelOffs),
|
||||
Size = new Size(110, labelHeight),
|
||||
TextAlign = ContentAlignment.BottomRight,
|
||||
});
|
||||
page.Controls.Add(tbPreviewBody = new TextBox()
|
||||
{
|
||||
Location = new Point(0, 4 * line + tm),
|
||||
Size = new Size(700, 370),
|
||||
Multiline = true,
|
||||
ScrollBars = ScrollBars.Both,
|
||||
Text = "",
|
||||
Enabled = false,
|
||||
});
|
||||
return page;
|
||||
}
|
||||
public frmMvInvitation()
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
this.StartPosition = FormStartPosition.CenterParent;
|
||||
this.Size = new System.Drawing.Size(800, 600);
|
||||
this.Text = "dezentrale-members :: Send MV invitation";
|
||||
this.Controls.Add(tabControl = new TabControl()
|
||||
{
|
||||
Size = new System.Drawing.Size(this.Width - 16, this.Height - 95),
|
||||
TabPages =
|
||||
{
|
||||
BuildPageGeneric(),
|
||||
BuildPageAgenda(),
|
||||
BuildPagePreview(),
|
||||
},
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
});
|
||||
|
||||
this.Controls.Add(tabControlNext = new Button()
|
||||
{
|
||||
Text = "Next",
|
||||
Location = new System.Drawing.Point(this.Width - 240 - rm, this.Height - 57),
|
||||
Anchor = AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
});
|
||||
tabControlNext.Click += tabControlNext_Click;
|
||||
|
||||
AddOkCancel(this, btnOK_Click, btnCancel_Click);
|
||||
|
||||
btnOk.Enabled = false; //will be enabled when last pane is active:
|
||||
tabControl.Selected += tabControl_Selected;
|
||||
}
|
||||
|
||||
private string GenerateAgenda()
|
||||
{
|
||||
string agenda = "Tagesordnung:\n";
|
||||
string[] items = tbAgendaPassage.Text.Split('\n');
|
||||
for(int i = 0; i < items.Length; i++)
|
||||
{
|
||||
agenda += $"{i + 1}. {items[i]}\n";
|
||||
}
|
||||
return agenda;
|
||||
}
|
||||
private void GenerateResult()
|
||||
{
|
||||
tbPreviewHeadline.Enabled = true;
|
||||
tbPreviewBody.Enabled = true;
|
||||
tbPreviewHeadline.Text = tbHeadline.Text;
|
||||
tbPreviewBody.Text = tbIntroductionPassage.Text + "\n\n"
|
||||
+ tbEventTimeAndPlacePassage.Text + "\n\n"
|
||||
+ (chkGenerateAuthCode.Checked ? (tbAuthCodePassage.Text + "\n\n") : "")
|
||||
+ GenerateAgenda() + "\n\n"
|
||||
+ tbAdditionalInfoPassage.Text + "\n\n";
|
||||
DataGenerated = true;
|
||||
}
|
||||
private void btnGenerateResult_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenerateResult();
|
||||
}
|
||||
|
||||
private void tabControl_Selected(object sender, TabControlEventArgs e)
|
||||
{
|
||||
btnOk.Enabled = (e.TabPageIndex == tabControl.TabPages.Count - 1);
|
||||
if (btnOk.Enabled && !DataGenerated) GenerateResult();
|
||||
tabControlNext.Enabled = !btnOk.Enabled;
|
||||
}
|
||||
private void tabControlNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (tabControl.SelectedIndex < tabControl.TabPages.Count - 1)
|
||||
tabControl.SelectedIndex++;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
GenerateAuthCode = chkGenerateAuthCode.Checked;
|
||||
Headline = tbPreviewHeadline.Text;
|
||||
Body = tbPreviewBody.Text;
|
||||
InvitationGroup = (MvInvitationGroup)cbInviteSelection.SelectedItem;
|
||||
MvEventDate = new DateTime(mvDate.Value.Year, mvDate.Value.Month, mvDate.Value.Day,
|
||||
mvTime.Value.Hour, mvTime.Value.Minute, mvTime.Value.Second);
|
||||
this.Close();
|
||||
}
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue