Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1511


Ignore:
Timestamp:
04/03/09 14:35:19 (16 years ago)
Author:
whackl
Message:

added recurring appoinment (#468)

Location:
trunk/sources/HeuristicLab.Hive.Client.Console
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Console/HeuristicLab.Hive.Client.Console.csproj

    r1474 r1511  
    156156      <DependentUpon>Recurrence.cs</DependentUpon>
    157157    </Compile>
     158    <Compile Include="RecurrentEvent.cs" />
    158159    <Compile Include="Service References\ClientService\Reference.cs">
    159160      <AutoGen>True</AutoGen>
  • trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.Designer.cs

    r1333 r1511  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       Calendar.DrawTool drawTool2 = new Calendar.DrawTool();
     48      Calendar.DrawTool drawTool1 = new Calendar.DrawTool();
    4949      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveClientConsole));
    5050      this.dvOnline = new Calendar.DayView();
     
    115115      // dvOnline
    116116      //
    117       drawTool2.DayView = this.dvOnline;
    118       this.dvOnline.ActiveTool = drawTool2;
     117      drawTool1.DayView = this.dvOnline;
     118      this.dvOnline.ActiveTool = drawTool1;
    119119      this.dvOnline.AmPmDisplay = false;
    120120      this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes;
     
    529529      this.groupBox1.Controls.Add(this.label1);
    530530      this.groupBox1.Controls.Add(this.btCreate);
    531       this.groupBox1.Location = new System.Drawing.Point(353, 7);
     531      this.groupBox1.Location = new System.Drawing.Point(373, 7);
    532532      this.groupBox1.Name = "groupBox1";
    533       this.groupBox1.Size = new System.Drawing.Size(274, 161);
     533      this.groupBox1.Size = new System.Drawing.Size(254, 161);
    534534      this.groupBox1.TabIndex = 21;
    535535      this.groupBox1.TabStop = false;
     
    539539      this.txttimeTo.CustomFormat = "HH:00";
    540540      this.txttimeTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    541       this.txttimeTo.Location = new System.Drawing.Point(189, 64);
     541      this.txttimeTo.Location = new System.Drawing.Point(164, 45);
    542542      this.txttimeTo.Name = "txttimeTo";
    543543      this.txttimeTo.ShowUpDown = true;
     
    549549      this.txttimeFrom.CustomFormat = "HH:00";
    550550      this.txttimeFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    551       this.txttimeFrom.Location = new System.Drawing.Point(189, 31);
     551      this.txttimeFrom.Location = new System.Drawing.Point(164, 12);
    552552      this.txttimeFrom.Name = "txttimeFrom";
    553553      this.txttimeFrom.ShowUpDown = true;
     
    558558      //
    559559      this.dtpTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    560       this.dtpTo.Location = new System.Drawing.Point(97, 64);
     560      this.dtpTo.Location = new System.Drawing.Point(72, 45);
    561561      this.dtpTo.Name = "dtpTo";
    562562      this.dtpTo.Size = new System.Drawing.Size(89, 20);
     
    566566      //
    567567      this.dtpFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    568       this.dtpFrom.Location = new System.Drawing.Point(97, 31);
     568      this.dtpFrom.Location = new System.Drawing.Point(72, 12);
    569569      this.dtpFrom.Name = "dtpFrom";
    570570      this.dtpFrom.Size = new System.Drawing.Size(89, 20);
     
    574574      //
    575575      this.chbade.AutoSize = true;
    576       this.chbade.Location = new System.Drawing.Point(97, 90);
     576      this.chbade.Location = new System.Drawing.Point(72, 71);
    577577      this.chbade.Name = "chbade";
    578578      this.chbade.Size = new System.Drawing.Size(90, 17);
     
    584584      // btnRecurrence
    585585      //
    586       this.btnRecurrence.Location = new System.Drawing.Point(189, 129);
     586      this.btnRecurrence.Location = new System.Drawing.Point(141, 129);
    587587      this.btnRecurrence.Name = "btnRecurrence";
    588       this.btnRecurrence.Size = new System.Drawing.Size(75, 26);
     588      this.btnRecurrence.Size = new System.Drawing.Size(113, 26);
    589589      this.btnRecurrence.TabIndex = 30;
    590590      this.btnRecurrence.Text = "Recurrence";
     
    594594      // btbDelete
    595595      //
    596       this.btbDelete.Location = new System.Drawing.Point(100, 129);
     596      this.btbDelete.Location = new System.Drawing.Point(8, 129);
    597597      this.btbDelete.Name = "btbDelete";
    598       this.btbDelete.Size = new System.Drawing.Size(75, 26);
     598      this.btbDelete.Size = new System.Drawing.Size(114, 26);
    599599      this.btbDelete.TabIndex = 25;
    600600      this.btbDelete.Text = "Delete";
     
    605605      //
    606606      this.label2.AutoSize = true;
    607       this.label2.Location = new System.Drawing.Point(41, 65);
     607      this.label2.Location = new System.Drawing.Point(16, 46);
    608608      this.label2.Name = "label2";
    609609      this.label2.Size = new System.Drawing.Size(55, 13);
     
    614614      //
    615615      this.label1.AutoSize = true;
    616       this.label1.Location = new System.Drawing.Point(41, 34);
     616      this.label1.Location = new System.Drawing.Point(16, 15);
    617617      this.label1.Name = "label1";
    618618      this.label1.Size = new System.Drawing.Size(58, 13);
     
    622622      // btCreate
    623623      //
    624       this.btCreate.Location = new System.Drawing.Point(11, 129);
     624      this.btCreate.Location = new System.Drawing.Point(6, 93);
    625625      this.btCreate.Name = "btCreate";
    626       this.btCreate.Size = new System.Drawing.Size(75, 26);
     626      this.btCreate.Size = new System.Drawing.Size(242, 26);
    627627      this.btCreate.TabIndex = 20;
    628628      this.btCreate.Text = "Save";
  • trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.cs

    r1333 r1511  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.ComponentModel;
    25 using System.Data;
     24using System.Diagnostics;
    2625using System.Drawing;
    2726using System.Linq;
    28 using System.Text;
     27using System.Net;
     28using System.ServiceModel;
    2929using System.Windows.Forms;
    30 using System.Diagnostics;
    31 using System.Threading;
     30using Calendar;
     31using HeuristicLab.Hive.Client.Console.ClientService;
    3232using ZedGraph;
    33 using HeuristicLab.Hive.Client.Console.ClientService;
    34 using System.ServiceModel;
    35 using System.Net;
    36 using Calendar;
    37 using System.Globalization;
    38 
    39 namespace HeuristicLab.Hive.Client.Console {
     33
     34namespace HeuristicLab.Hive.Client.Console
     35{
    4036
    4137  #region Delegates
    4238
    43   delegate void UpdateTextDelegate(EventLogEntry ev);
     39  public delegate void UpdateTextDelegate(EventLogEntry ev);
     40  public delegate void OnDialogClosedDelegate(RecurrentEvent e);
    4441
    4542  #endregion
    4643
    47   public partial class HiveClientConsole : Form {
     44  public partial class HiveClientConsole : Form
     45  {
    4846
    4947    #region Declarations
     
    5957    private List<Appointment> onlineTimes = new List<Appointment>();
    6058
     59    public OnDialogClosedDelegate dialogClosedDelegate;
     60
    6161    #endregion
    6262
    6363    #region Constructor
    6464
    65     public HiveClientConsole() {
     65    public HiveClientConsole()
     66    {
    6667      InitializeComponent();
    6768      lvwColumnSorter = new ListViewColumnSorterDate();
     
    8081    #region Methods
    8182
    82     private void InitTimer() {
     83    private void InitTimer()
     84    {
    8385      refreshTimer = new System.Windows.Forms.Timer();
    8486      refreshTimer.Interval = 1000;
     
    8789    }
    8890
    89     private void RefreshGui() {
    90       try {
     91    private void RefreshGui()
     92    {
     93      try
     94      {
    9195        cccc.GetStatusInfosAsync();
    9296      }
    93       catch (Exception ex) {
     97      catch (Exception ex)
     98      {
    9499        refreshTimer.Stop();
    95100        DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
    99104    }
    100105
    101     private void ConnectToClient() {
    102       try {
     106    private void ConnectToClient()
     107    {
     108      try
     109      {
    103110        cccc = new ClientConsoleCommunicatorClient(new NetTcpBinding(), new EndpointAddress(ENDPOINTADRESS));
    104111        cccc.GetStatusInfosCompleted += new EventHandler<GetStatusInfosCompletedEventArgs>(cccc_GetStatusInfosCompleted);
    105112        cccc.GetCurrentConnectionCompleted += new EventHandler<GetCurrentConnectionCompletedEventArgs>(cccc_GetCurrentConnectionCompleted);
    106113      }
    107       catch (Exception) {
     114      catch (Exception)
     115      {
    108116        refreshTimer.Stop();
    109117        DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
    113121    }
    114122
    115     private void GetEventLog() {
     123    private void GetEventLog()
     124    {
    116125      HiveClientEventLog = new EventLog(EVENTLOGNAME);
    117126      HiveClientEventLog.Source = EVENTLOGNAME;
     
    122131
    123132      //databinding on listview?
    124       if (HiveClientEventLog != null && HiveClientEventLog.Entries != null) {
    125         foreach (EventLogEntry ele in HiveClientEventLog.Entries) {
     133      if (HiveClientEventLog != null && HiveClientEventLog.Entries != null)
     134      {
     135        foreach (EventLogEntry ele in HiveClientEventLog.Entries)
     136        {
    126137          curEventLogEntry = GenerateEventEntry(ele);
    127138          lvLog.Items.Add(curEventLogEntry);
     
    131142    }
    132143
    133     private ListViewItem GenerateEventEntry(EventLogEntry ele) {
     144    private ListViewItem GenerateEventEntry(EventLogEntry ele)
     145    {
    134146      ListViewItem curEventLogEntry;
    135147      curEventLogEntry = new ListViewItem("", 0);
     
    142154    }
    143155
    144     private void UpdateGraph(JobStatus[] jobs) {
     156    private void UpdateGraph(JobStatus[] jobs)
     157    {
    145158      ZedGraphControl zgc = new ZedGraphControl();
    146159      GraphPane myPane = zgc.GraphPane;
     
    162175      double done = 0;
    163176
    164       if (jobs.Length == 0) {
     177      if (jobs.Length == 0)
     178      {
    165179        myPane.AddPieSlice(100, Color.Green, 0.1, "");
    166       } else {
    167         for (int i = 0; i < jobs.Length; i++) {
     180      }
     181      else
     182      {
     183        for (int i = 0; i < jobs.Length; i++)
     184        {
    168185          allProgress += jobs[i].Progress;
    169186        }
     
    182199    }
    183200
    184     private void InitCalender() {
     201    private void InitCalender()
     202    {
    185203      dvOnline.StartDate = DateTime.Now;
    186204      dvOnline.OnNewAppointment += new EventHandler<NewAppointmentEventArgs>(DvOnline_OnNewAppointment);
     
    188206    }
    189207
    190     private Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay) {
     208    private Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay)
     209    {
    191210      Appointment App = new Appointment();
    192211      App.StartDate = startDate;
     
    196215      App.Locked = true;
    197216      App.Subject = "Online";
     217      App.Recurring = false;
    198218      return App;
    199219    }
    200220
    201     //private ConvertToAppointments(List<
     221    private Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay, bool recurring, Guid recurringId)
     222    {
     223      Appointment App = new Appointment();
     224      App.StartDate = startDate;
     225      App.EndDate = endDate;
     226      App.AllDayEvent = allDay;
     227      App.BorderColor = Color.Red;
     228      App.Locked = true;
     229      App.Subject = "Online";
     230      App.Recurring = recurring;
     231      App.RecurringId = recurringId;
     232      return App;
     233    }
     234
     235    private void DeleteAppointment()
     236    {
     237      onlineTimes.Remove(dvOnline.SelectedAppointment);
     238    }
     239
     240    private void DeleteRecurringAppointment(Guid recurringId)
     241    {
     242      onlineTimes.RemoveAll(a => a.RecurringId.ToString() == dvOnline.SelectedAppointment.RecurringId.ToString());
     243    }
    202244
    203245    #endregion
     
    205247    #region Events
    206248
    207     private void refreshTimer_Tick(object sender, EventArgs e) {
     249    private void refreshTimer_Tick(object sender, EventArgs e)
     250    {
    208251      RefreshGui();
    209252    }
    210253
    211     private void cccc_GetCurrentConnectionCompleted(object sender, GetCurrentConnectionCompletedEventArgs e) {
    212       if (e.Error == null) {
     254    private void cccc_GetCurrentConnectionCompleted(object sender, GetCurrentConnectionCompletedEventArgs e)
     255    {
     256      if (e.Error == null)
     257      {
    213258        ConnectionContainer curConnection = e.Result;
    214259        tbIPAdress.Text = curConnection.IPAdress;
    215260        tbPort.Text = curConnection.Port.ToString();
    216       } else {
     261      }
     262      else
     263      {
    217264        refreshTimer.Stop();
    218265        DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running! - " + e.Error.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
    222269    }
    223270
    224     private void cccc_GetStatusInfosCompleted(object sender, GetStatusInfosCompletedEventArgs e) {
    225 
    226       if (e.Error == null) {
     271    private void cccc_GetStatusInfosCompleted(object sender, GetStatusInfosCompletedEventArgs e)
     272    {
     273
     274      if (e.Error == null)
     275      {
    227276        StatusCommons sc = e.Result;
    228277
     
    237286        ListViewItem curJobStatusItem;
    238287
    239         if (sc.Jobs != null) {
     288        if (sc.Jobs != null)
     289        {
    240290          lvJobDetail.Items.Clear();
    241291          double progress;
    242           foreach (JobStatus curJob in sc.Jobs) {
     292          foreach (JobStatus curJob in sc.Jobs)
     293          {
    243294            curJobStatusItem = new ListViewItem(curJob.JobId.ToString());
    244295            curJobStatusItem.SubItems.Add(curJob.Since.ToString());
     
    252303        UpdateGraph(sc.Jobs);
    253304
    254         if (sc.Status == NetworkEnumWcfConnState.Connected || sc.Status == NetworkEnumWcfConnState.Loggedin) {
     305        if (sc.Status == NetworkEnumWcfConnState.Connected || sc.Status == NetworkEnumWcfConnState.Loggedin)
     306        {
    255307          btConnect.Enabled = false;
    256308          btnDisconnect.Enabled = true;
    257309          lbCs.Text = sc.ConnectedSince.ToString();
    258310          cccc.GetCurrentConnectionAsync();
    259         } else if (sc.Status == NetworkEnumWcfConnState.Disconnected) {
     311        }
     312        else if (sc.Status == NetworkEnumWcfConnState.Disconnected)
     313        {
    260314          btConnect.Enabled = true;
    261315          btnDisconnect.Enabled = false;
    262316          lbCs.Text = String.Empty;
    263         } else if (sc.Status == NetworkEnumWcfConnState.Failed) {
     317        }
     318        else if (sc.Status == NetworkEnumWcfConnState.Failed)
     319        {
    264320          btConnect.Enabled = true;
    265321          btnDisconnect.Enabled = false;
     
    268324
    269325        cccc.GetCurrentConnection();
    270       } else {
     326      }
     327      else
     328      {
    271329        refreshTimer.Stop();
    272330        DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running! - " + e.Error.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
    276334    }
    277335
    278     private void HiveClientConsole_Load(object sender, EventArgs e) {
     336    private void HiveClientConsole_Load(object sender, EventArgs e)
     337    {
    279338      //nothing to do
    280339    }
    281340
    282     private void UpdateText(EventLogEntry ev) {
    283       if (this.lvLog.InvokeRequired) {
     341    private void UpdateText(EventLogEntry ev)
     342    {
     343      if (this.lvLog.InvokeRequired)
     344      {
    284345        this.lvLog.Invoke(new
    285346          UpdateTextDelegate(UpdateText), new object[] { ev });
    286       } else {
     347      }
     348      else
     349      {
    287350        ListViewItem curEventLogEntry = GenerateEventEntry(ev);
    288351        lvLog.Items.Add(curEventLogEntry);
     
    291354    }
    292355
    293     public void OnEntryWritten(object source, EntryWrittenEventArgs e) {
     356    public void OnEntryWritten(object source, EntryWrittenEventArgs e)
     357    {
    294358      UpdateText(e.Entry);
    295359    }
    296360
    297     private void lvLog_DoubleClick(object sender, EventArgs e) {
     361    private void lvLog_DoubleClick(object sender, EventArgs e)
     362    {
    298363      ListViewItem lvi = lvLog.SelectedItems[0];
    299364      HiveEventEntry hee = new HiveEventEntry(lvi.SubItems[2].Text, lvi.SubItems[3].Text, lvi.SubItems[1].Text);
     
    303368    }
    304369
    305     private void btConnect_Click(object sender, EventArgs e) {
     370    private void btConnect_Click(object sender, EventArgs e)
     371    {
    306372      IPAddress ipAdress;
    307373      int port;
    308374      ConnectionContainer cc = new ConnectionContainer();
    309       if (IPAddress.TryParse(tbIPAdress.Text, out ipAdress) && int.TryParse(tbPort.Text, out port)) {
     375      if (IPAddress.TryParse(tbIPAdress.Text, out ipAdress) && int.TryParse(tbPort.Text, out port))
     376      {
    310377        cc.IPAdress = tbIPAdress.Text;
    311378        cc.Port = port;
    312379        cccc.SetConnectionAsync(cc);
    313       } else {
     380      }
     381      else
     382      {
    314383        MessageBox.Show("IP Adress and/or Port Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    315384      }
    316385    }
    317386
    318     private void btnDisconnect_Click(object sender, EventArgs e) {
     387    private void btnDisconnect_Click(object sender, EventArgs e)
     388    {
    319389      cccc.DisconnectAsync();
    320390    }
    321391
    322     private void lvLog_ColumnClick(object sender, ColumnClickEventArgs e) {
     392    private void lvLog_ColumnClick(object sender, ColumnClickEventArgs e)
     393    {
    323394      // Determine if clicked column is already the column that is being sorted.
    324       if (e.Column == lvwColumnSorter.SortColumn) {
     395      if (e.Column == lvwColumnSorter.SortColumn)
     396      {
    325397        // Reverse the current sort direction for this column.
    326         if (lvwColumnSorter.Order == SortOrder.Ascending) {
     398        if (lvwColumnSorter.Order == SortOrder.Ascending)
     399        {
    327400          lvwColumnSorter.Order = SortOrder.Descending;
    328         } else {
     401        }
     402        else
     403        {
    329404          lvwColumnSorter.Order = SortOrder.Ascending;
    330405        }
    331       } else {
     406      }
     407      else
     408      {
    332409        // Set the column number that is to be sorted; default to ascending.
    333410        lvwColumnSorter.SortColumn = e.Column;
     
    339416    }
    340417
    341     private void btn_clientShutdown_Click(object sender, EventArgs e) {
     418    private void btn_clientShutdown_Click(object sender, EventArgs e)
     419    {
    342420      DialogResult res = MessageBox.Show("Do you really want to shutdown the Hive Client?", "Hive Client Console", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
    343       if (res == DialogResult.Yes) {
     421      if (res == DialogResult.Yes)
     422      {
    344423        cccc.ShutdownClient();
    345424        this.Close();
     
    347426    }
    348427
    349     private void btbDelete_Click(object sender, EventArgs e) {
     428    private void btbDelete_Click(object sender, EventArgs e)
     429    {
     430      Appointment selectedAppointment = dvOnline.SelectedAppointment;
    350431      if (dvOnline.SelectedAppointment != null)
    351         onlineTimes.Remove(dvOnline.SelectedAppointment);
     432      {
     433        if (!selectedAppointment.Recurring)
     434          DeleteAppointment();
     435        else
     436        {
     437          DialogResult res = MessageBox.Show("Delete all events in this series?", "Delete recurrences", MessageBoxButtons.YesNo);
     438          if (res != DialogResult.Yes)
     439            DeleteAppointment();
     440          else
     441            DeleteRecurringAppointment(selectedAppointment.RecurringId);
     442        }
     443      }
    352444      dvOnline.Invalidate();
    353445    }
    354446
    355     private void chbade_CheckedChanged(object sender, EventArgs e) {
    356       //if (chbade.Checked) {
    357       //  txttimeFrom.Visible = false;
    358       //  txttimeTo.Visible = false;
    359       //} else {
    360       //  txttimeFrom.Visible = true;
    361       //  txttimeTo.Visible = true;
    362       //}
     447    private void chbade_CheckedChanged(object sender, EventArgs e)
     448    {
    363449      txttimeFrom.Visible = !chbade.Checked;
    364450      txttimeTo.Visible = !chbade.Checked;
    365451    }
    366452
    367     private void dvOnline_OnSelectionChanged(object sender, EventArgs e) {
    368       if (dvOnline.Selection == SelectionType.DateRange) {
     453    private void dvOnline_OnSelectionChanged(object sender, EventArgs e)
     454    {
     455      if (dvOnline.Selection == SelectionType.DateRange)
     456      {
    369457        dtpFrom.Text = dvOnline.SelectionStart.ToShortDateString();
    370458        dtpTo.Text = dvOnline.SelectionEnd.Date.ToShortDateString();
    371459        txttimeFrom.Text = dvOnline.SelectionStart.ToShortTimeString();
    372460        txttimeTo.Text = dvOnline.SelectionEnd.ToShortTimeString();
    373       }
    374     }
    375 
    376     private void Connection_KeyPress(object sender, KeyPressEventArgs e) {
     461
     462        btCreate.Text = "Save";
     463      }
     464
     465      if (dvOnline.Selection == SelectionType.Appointment)
     466      {
     467
     468        dtpFrom.Text = dvOnline.SelectedAppointment.StartDate.ToShortDateString();
     469        dtpTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortDateString();
     470        txttimeFrom.Text = dvOnline.SelectedAppointment.StartDate.ToShortTimeString();
     471        txttimeTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortTimeString();
     472
     473        //also change the caption of the save button
     474        btCreate.Text = "Save changes";
     475      }
     476
     477      if (dvOnline.Selection == SelectionType.None)
     478      {
     479        //also change the caption of the save button
     480        btCreate.Text = "Save";
     481      }
     482
     483    }
     484
     485    private void Connection_KeyPress(object sender, KeyPressEventArgs e)
     486    {
    377487      if (e.KeyChar == (char)Keys.Return)
    378488        btConnect_Click(null, null);
    379489    }
    380490
    381     private void mcOnline_DateChanged(object sender, DateRangeEventArgs e) {
     491    private void mcOnline_DateChanged(object sender, DateRangeEventArgs e)
     492    {
    382493      dvOnline.StartDate = mcOnline.SelectionStart;
    383494    }
    384495
    385     private void btCreate_Click(object sender, EventArgs e) {
     496    private bool CreateAppointment()
     497    {
    386498      DateTime from, to;
    387499
    388       if (!string.IsNullOrEmpty(dtpFrom.Text) && !string.IsNullOrEmpty(dtpTo.Text)) {
    389         if (chbade.Checked) {
     500      if (!string.IsNullOrEmpty(dtpFrom.Text) && !string.IsNullOrEmpty(dtpTo.Text))
     501      {
     502        if (chbade.Checked)
     503        {
    390504          //whole day appointment, only dates are visible
    391505          if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to)
     
    393507          else
    394508            MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    395         } else if (!string.IsNullOrEmpty(txttimeFrom.Text) && !string.IsNullOrEmpty(txttimeTo.Text)) {
     509        }
     510        else if (!string.IsNullOrEmpty(txttimeFrom.Text) && !string.IsNullOrEmpty(txttimeTo.Text))
     511        {
    396512          //Timeframe appointment
    397           if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to) {
     513          if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to)
     514          {
    398515            if (from.Date == to.Date)
    399516              onlineTimes.Add(CreateAppointment(from, to, false));
    400             else {
     517            else
     518            {
    401519              //more than 1 day selected
    402               while (from.Date != to.Date) {
     520              while (from.Date != to.Date)
     521              {
    403522                onlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false));
    404523                from = from.AddDays(1);
     
    406525              onlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false));
    407526            }
    408           } else
     527          }
     528          else
    409529            MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    410530        }
    411531        dvOnline.Invalidate();
    412       } else {
     532        return true;
     533      }
     534      else
     535      {
    413536        MessageBox.Show("Error in create appointment, please fill out all textboxes!", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    414       }
    415     }
    416 
    417     void DvOnline_OnResolveAppointments(object sender, ResolveAppointmentsEventArgs e) {
     537        return false;
     538      }
     539    }
     540
     541    private void btCreate_Click(object sender, EventArgs e)
     542    {
     543      if (dvOnline.Selection != SelectionType.Appointment)
     544      {
     545        CreateAppointment();
     546      }
     547      else
     548      {
     549        //now we want to change an existing appointment
     550        if (!dvOnline.SelectedAppointment.Recurring)
     551        {
     552          if (CreateAppointment())
     553            DeleteAppointment();
     554        }
     555        else
     556        {
     557          //change recurring appointment
     558          //check, if only selected appointment has to change or whole recurrence
     559          DialogResult res = MessageBox.Show("Change all events in this series?", "Change recurrences", MessageBoxButtons.YesNo);
     560          if (res != DialogResult.Yes)
     561          {
     562            if (CreateAppointment())
     563              DeleteAppointment();
     564          }
     565          else
     566            ChangeRecurrenceAppointment(dvOnline.SelectedAppointment.RecurringId);
     567        }
     568      }
     569    }
     570
     571    private void ChangeRecurrenceAppointment(Guid recurringId)
     572    {
     573      List<Appointment> recurringAppointments = onlineTimes.Where(appointment => appointment.RecurringId == recurringId).ToList();
     574      recurringAppointments.ForEach(appointment => appointment.StartDate = DateTime.Parse(appointment.StartDate.Date + " " + txttimeFrom.Text));
     575      recurringAppointments.ForEach(appointment => appointment.EndDate = DateTime.Parse(appointment.EndDate.Date + " " + txttimeTo.Text));
     576
     577      DeleteRecurringAppointment(recurringId);
     578      onlineTimes.AddRange(recurringAppointments);
     579    }
     580
     581    private void DvOnline_OnResolveAppointments(object sender, ResolveAppointmentsEventArgs e)
     582    {
    418583      List<Appointment> Apps = new List<Appointment>();
    419584
     
    425590    }
    426591
    427     void DvOnline_OnNewAppointment(object sender, NewAppointmentEventArgs e) {
     592    private void DvOnline_OnNewAppointment(object sender, NewAppointmentEventArgs e)
     593    {
    428594      Appointment Appointment = new Appointment();
    429595
     
    434600    }
    435601
    436     private void btnRecurrence_Click(object sender, EventArgs e) {
    437       Form recurrence = new Recurrence();
     602    private void btnRecurrence_Click(object sender, EventArgs e)
     603    {
     604      Recurrence recurrence = new Recurrence();
     605      recurrence.dialogClosedDelegate = new OnDialogClosedDelegate(this.DialogClosed);
    438606      recurrence.Show();
    439607    }
    440608
     609    public void DialogClosed(RecurrentEvent e)
     610    {
     611      CreateDailyRecurrenceAppointments(e.DateFrom, e.DateTo, e.AllDay, e.IncWeeks, e.WeekDays);
     612    }
     613
    441614    #endregion
    442615
     616    private void CreateDailyRecurrenceAppointments(DateTime dateFrom, DateTime dateTo, bool allDay, int incWeek, HashSet<DayOfWeek> daysOfWeek)
     617    {
     618      DateTime incDate = dateFrom;
     619      Guid guid = Guid.NewGuid();
     620
     621      while (incDate.Date <= dateTo.Date)
     622      {
     623        if (daysOfWeek.Contains(incDate.Date.DayOfWeek))
     624          onlineTimes.Add(CreateAppointment(incDate, new DateTime(incDate.Year, incDate.Month, incDate.Day, dateTo.Hour, dateTo.Minute, 0), allDay, true, guid));
     625        incDate = incDate.AddDays(1);
     626      }
     627
     628      dvOnline.Invalidate();
     629    }
    443630  }
    444631}
  • trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.resx

    r1333 r1511  
    125125        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
    126126        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
    127         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABS
     127        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABQ
    128128        CgAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
    129         AwABEAMAAQEBAAEgBgABECoAAUMCAQF0AWYCCQHxAx0B/wFiAgMB1AEgAgEBLCwAAUMCAQF0AWYCCQHx
    130         Ax0B/wFiAgMB1AEgAgEBLKQAAWACCgHyAZMBdwEdAf8BvwGBAR0B/wG9AYEBHQH/AboBgQEdAf8BuAGB
    131         AR0B/wG2AYEBHQH/AVEBOgEdAf8BPQIBAWUcAAFgAgoB8gIdAaQB/wIdAdYB/wIdAdQB/wIdAdIB/wId
    132         AdAB/wIdAc4B/wIdAVgB/wE9AgEBZZgAAScBIwEdAf8BxwGBAR0B/wHDAYEBHQH/AbEBfwEdAf8BsQF/
    133         AR0B/wGxAX8BHQH/AbEBfwEdAf8BswGBAR0B/wG2AYEBHQH/AbQBgQEdAf8BZAIFAeQUAAIdASgB/wId
    134         AdwB/wIdAdkB/wIdAcoB/wIdAcoB/wIdAcoB/wIdAcoB/wIdAcsB/wIdAc4B/wIdAcwB/wFkAgUB5JAA
    135         Ax0B/wHLAYEBHQH/AbsBgQEdAf8BtgGBAR0B/wG2AYEBHQH/Ae4B3AHEBf8BvgGBAToB/wG2AYEBHQH/
    136         AbYBgQEdAf8BtgGBAR0B/wG0AYEBHQH/AUkCAgGGDAADHQH/Ah0B4AH/Ah0B0gH/Ah0BzgH/AkoB1gH/
    137         Ah0BzgH/Ah0BzgH/Ah0BzgH/AiABzgH/Ah0BzgH/Ah0BzgH/Ah0BzAH/AUkCAgGGiAABLAIBAUIB0AGG
    138         AR0B/wHHAYEBHQH/AboBgQEdAf8BugGBAR0B/wG6AYEBHQH/AdABnAFuBf8BugGBAR0B/wG6AYEBHQH/
    139         AboBgQEdAf8BugGBAR0B/wG2AYEBHQH/AXEBTAEdAf8IAAEsAgEBQgIdAeQB/wIdAdwB/wIdAdIB/wKf
    140         Ae0F/wJjAd4B/wIdAdIB/wL0Af0F/wIgAdIB/wIdAdIB/wIdAc4B/wIdAXwB/4gAAx0B/wHSAYkBHQH/
    141         Ab8BgQEdAf8BvwGBAR0B/wG/AYEBHQH/Ab8BgQEdAf8B0wGfAW4F/wG/AYEBHQH/Ab8BgQEdAf8BvwGB
    142         AR0B/wG/AYEBHQH/Ab4BgQEdAf8BtgGBAR0B/wE2AgEBVwQAAx0B/wIdAeUB/wIdAdYB/wIdAdYN/wL1
    143         Af0J/wLiAfoB/wIdAdYB/wIdAdUB/wIdAc4B/wE2AgEBV4QAAWUBTQEdAf8B1AGMAR0B/wHEAYEBHQH/
    144         AcQBgQEdAf8BxAGBAR0B/wHEAYEBHQH/AdcBpAFvBf8BxAGBAR0B/wHEAYEBHQH/AcQBgQEdAf8BxAGB
    145         AR0B/wHEAYEBHQH/AbgBgQEdAf8BZQIHAewEAAIdAWsB/wIdAegB/wIdAdoB/wIdAdoB/wIdAdoR/wLi
    146         AfoB/wIdAdoB/wIdAdoB/wIdAdoB/wIdAdAB/wFlAgcB7IQAAYEBYgEdAf8B1wGOAR0B/wHJAYEBHQH/
    147         AckBgQEdAf8ByQGBAR0B/wHJAYEBHQn/AckBgQEdAf8ByQGBAR0B/wHJAYEBHQH/AckBgQEdAf8ByQGB
    148         AR0B/wG6AYEBHQH/Ax0B/wQAAh0BgQH/Ah0B6QH/Ah0B3gH/Ah0B3gH/Ah0B3gH/AvQB/Q3/AmMB5wH/
    149         Ah0B3gH/Ah0B3gH/Ah0B3gH/Ah0B0gH/Ax0B/4QAAXUBUwEdAf8B2QGRAR0B/wHOAYMBHQH/Ac4BgwEd
    150         Af8BzgGDAR0B/wHOAYMBHQH/Ac4BgwEdAf8B1wGcAU4B/wHOAYMBHQH/Ac4BgwEdAf8BzgGDAR0B/wHO
    151         AYMBHQH/Ac4BgwEdAf8BvQGBAR0B/wFNAhMB+QQAAR0BIgF0Af8CHQHsAf8CHQHiAf8CHQHiAf8C9AH9
    152         Ff8CYwHqAf8CHQHiAf8CHQHiAf8CHQHUAf8BTQITAfmEAAEgAR4BHQH/AdsBlAEdAf8B0gGJAR0B/wHS
    153         AYkBHQH/AdIBiQEdAf8B0gGJAR0B/wHSAYkBHQH/AesBywGQAf8B0gGJAR0B/wHSAYkBHQH/AdIBiQEd
    154         Af8B0gGJAR0B/wHEAYEBHQH/Ab8BgQEdAf8BUQICAZsEAAIdASAB/wIdAe0B/wIdAeYB/wIdAeUB/wL9
    155         Af4F/wLiAfwB/wIdAeUJ/wKBAfEB/wIdAeUB/wIdAdoB/wIdAdYB/wFRAgIBm4QAAVgCAgGyAd4BmAEd
    156         Af8B2wGUAR0B/wHXAY4BHQH/AdcBjgEdAf8B1wGOAR0B/wH7AfYB6wX/AdcBjgEdAf8B1wGOAR0B/wHX
    157         AY4BHQH/AdYBjQEdAf8BxAGBAR0B/wGpAX4BHQH/CAABWAICAbIBHQEnAe8B/wIdAe0B/wIdAekB/wId
    158         AekB/wLhAfwB/wIdAekB/wIdAekB/wIdAekB/wKBAfMB/wIdAekB/wIdAegB/wIdAdoB/wEdASUBnQH/
    159         jAABVwE8AR0B/wHdAZcBHQH/AdsBlAEdAf8B2wGUAR0B/wHbAZQBHQH/AdsBlAEdAf8B3AGXASMB/wHb
    160         AZQBHQH/AdsBlAEdAf8B1QGMAR0B/wHJAYEBHQH/AdEBiAEdAf8BLAIdAfwMAAIdAVEB/wIdAe8B/wId
    161         Ae0B/wIdAe0B/wIdAe0B/wIdAe0B/wIdAe0B/wIdAe0B/wIdAe0B/wIdAegB/wIdAd4B/wEdATAB4gH/
    162         ASwCHQH8jAABGQIBASEBkAFxAR0B/wHfAZkBHQH/AdsBlAEdAf8B2QGRAR0B/wHYAZABHQH/AdgBkAEd
    163         Af8B0wGKAR0B/wHQAYYBHQH/Ac4BgwEdAf8B2gGSAR0B/wEoASMBHQH/EAABGQIBASECHQGHAf8BHQEj
    164         AfEB/wIdAe0B/wIdAewB/wIdAesB/wIdAesB/wIdAeYB/wIdAeQB/wIdAeIB/wEdAToB5gH/Ah0BJwH/
    165         lAABEgIBARYBQgE0AR0B/wHSAYkBHQH/AeIBnQEdAf8B2QGRAR0B/wHXAY4BHQH/AdUBjAEdAf8B4QGb
    166         AR0B/wHOAYQBHQH/AToCHQH+GAABEgIBARYCHQFBAf8BHQEjAdMB/wEdATQB9AH/Ah0B7AH/Ah0B6QH/
    167         AR0BHgHoAf8BHQE8AfAB/wIdAcwB/wE6Ah0B/qAAAUYCAQF9Ax0B/wFuAVUBHQH/AYEBbgEdAf8BTwFA
    168         AR0B/wE6Ah0B/gEUAgEBGiQAAUYCAQF9Ax0B/wIdAXEB/wIdAYEB/wIdAVEB/wE6Ah0B/gEUAgEBGv8A
    169         kQABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEAAQEFAAGAFwAD/wEAAfwBHwH8AR8EAAHwAQcB8AEH
    170         BAAB4AEDAeABAwQAAcABAQHAAQEEAAGAAQEBgAEBBAABgAEAAYAFAAGAAQABgAUAAYABAAGABQABgAEA
    171         AYAFAAGAAQABgAUAAYABAQGAAQEEAAHAAQEBwAEBBAABwAEDAcABAwQAAeABBwHgAQcEAAH4AQ8B+AEP
    172         BAAE/wQACw==
     129        AwABEAMAAQEBAAEgBgABECoAAUMCAQF0AWYCCQHxAyEB/wFiAgMB1AEgAgEBLCwAAUMCAQF0AWYCCQHx
     130        AyEB/wFiAgMB1AEgAgEBLKQAAWACCgHyAZMBewEhAf8BvwGBASEB/wG9AYEBIQH/AboBgQEhAf8BuAGB
     131        ASEB/wG2AYEBIQH/AVUBPgEhAf8BPQIBAWUcAAFgAgoB8gIhAaQB/wIhAdYB/wIhAdQB/wIhAdIB/wIh
     132        AdAB/wIhAc4B/wIhAVwB/wE9AgEBZZgAASsBJwEhAf8BxwGBASEB/wHDAYEBIQH/AbEBgQEhAf8BsQGB
     133        ASEB/wGxAYEBIQH/AbEBgQEhAf8BswGBASEB/wG2AYEBIQH/AbQBgQEhAf8BZAIFAeQUAAIhASwB/wIh
     134        AdwB/wIhAdkB/wIhAcoB/wIhAcoB/wIhAcoB/wIhAcoB/wIhAcsB/wIhAc4B/wIhAcwB/wFkAgUB5JAA
     135        AyEB/wHLAYEBIQH/AbsBgQEhAf8BtgGBASEB/wG2AYEBIQH/Ae4B3AHEBf8BvgGBAT4B/wG2AYEBIQH/
     136        AbYBgQEhAf8BtgGBASEB/wG0AYEBIQH/AUkCAgGGDAADIQH/AiEB4AH/AiEB0gH/AiEBzgH/Ak4B1gH/
     137        AiEBzgH/AiEBzgH/AiEBzgH/AiQBzgH/AiEBzgH/AiEBzgH/AiEBzAH/AUkCAgGGiAABLAIBAUIB0AGG
     138        ASEB/wHHAYEBIQH/AboBgQEhAf8BugGBASEB/wG6AYEBIQH/AdABnAFyBf8BugGBASEB/wG6AYEBIQH/
     139        AboBgQEhAf8BugGBASEB/wG2AYEBIQH/AXUBUAEhAf8IAAEsAgEBQgIhAeQB/wIhAdwB/wIhAdIB/wKf
     140        Ae0F/wJnAd4B/wIhAdIB/wL0Af0F/wIkAdIB/wIhAdIB/wIhAc4B/wIhAYAB/4gAAyEB/wHSAYkBIQH/
     141        Ab8BgQEhAf8BvwGBASEB/wG/AYEBIQH/Ab8BgQEhAf8B0wGfAXIF/wG/AYEBIQH/Ab8BgQEhAf8BvwGB
     142        ASEB/wG/AYEBIQH/Ab4BgQEhAf8BtgGBASEB/wE2AgEBVwQAAyEB/wIhAeUB/wIhAdYB/wIhAdYN/wL1
     143        Af0J/wLiAfoB/wIhAdYB/wIhAdUB/wIhAc4B/wE2AgEBV4QAAWkBUQEhAf8B1AGMASEB/wHEAYEBIQH/
     144        AcQBgQEhAf8BxAGBASEB/wHEAYEBIQH/AdcBpAFzBf8BxAGBASEB/wHEAYEBIQH/AcQBgQEhAf8BxAGB
     145        ASEB/wHEAYEBIQH/AbgBgQEhAf8BZQIHAewEAAIhAW8B/wIhAegB/wIhAdoB/wIhAdoB/wIhAdoR/wLi
     146        AfoB/wIhAdoB/wIhAdoB/wIhAdoB/wIhAdAB/wFlAgcB7IQAAYEBZgEhAf8B1wGOASEB/wHJAYEBIQH/
     147        AckBgQEhAf8ByQGBASEB/wHJAYEBIQn/AckBgQEhAf8ByQGBASEB/wHJAYEBIQH/AckBgQEhAf8ByQGB
     148        ASEB/wG6AYEBIQH/AyEB/wQAAiEBgQH/AiEB6QH/AiEB3gH/AiEB3gH/AiEB3gH/AvQB/Q3/AmcB5wH/
     149        AiEB3gH/AiEB3gH/AiEB3gH/AiEB0gH/AyEB/4QAAXkBVwEhAf8B2QGRASEB/wHOAYMBIQH/Ac4BgwEh
     150        Af8BzgGDASEB/wHOAYMBIQH/Ac4BgwEhAf8B1wGcAVIB/wHOAYMBIQH/Ac4BgwEhAf8BzgGDASEB/wHO
     151        AYMBIQH/Ac4BgwEhAf8BvQGBASEB/wFRAhMB+QQAASEBJgF4Af8CIQHsAf8CIQHiAf8CIQHiAf8C9AH9
     152        Ff8CZwHqAf8CIQHiAf8CIQHiAf8CIQHUAf8BUQITAfmEAAEkASIBIQH/AdsBlAEhAf8B0gGJASEB/wHS
     153        AYkBIQH/AdIBiQEhAf8B0gGJASEB/wHSAYkBIQH/AesBywGQAf8B0gGJASEB/wHSAYkBIQH/AdIBiQEh
     154        Af8B0gGJASEB/wHEAYEBIQH/Ab8BgQEhAf8BUQICAZsEAAIhASQB/wIhAe0B/wIhAeYB/wIhAeUB/wL9
     155        Af4F/wLiAfwB/wIhAeUJ/wKBAfEB/wIhAeUB/wIhAdoB/wIhAdYB/wFRAgIBm4QAAVgCAgGyAd4BmAEh
     156        Af8B2wGUASEB/wHXAY4BIQH/AdcBjgEhAf8B1wGOASEB/wH7AfYB6wX/AdcBjgEhAf8B1wGOASEB/wHX
     157        AY4BIQH/AdYBjQEhAf8BxAGBASEB/wGpAYEBIQH/CAABWAICAbIBIQErAe8B/wIhAe0B/wIhAekB/wIh
     158        AekB/wLhAfwB/wIhAekB/wIhAekB/wIhAekB/wKBAfMB/wIhAekB/wIhAegB/wIhAdoB/wEhASkBnQH/
     159        jAABWwFAASEB/wHdAZcBIQH/AdsBlAEhAf8B2wGUASEB/wHbAZQBIQH/AdsBlAEhAf8B3AGXAScB/wHb
     160        AZQBIQH/AdsBlAEhAf8B1QGMASEB/wHJAYEBIQH/AdEBiAEhAf8BLAIhAfwMAAIhAVUB/wIhAe8B/wIh
     161        Ae0B/wIhAe0B/wIhAe0B/wIhAe0B/wIhAe0B/wIhAe0B/wIhAe0B/wIhAegB/wIhAd4B/wEhATQB4gH/
     162        ASwCIQH8jAABGQIBASEBkAF1ASEB/wHfAZkBIQH/AdsBlAEhAf8B2QGRASEB/wHYAZABIQH/AdgBkAEh
     163        Af8B0wGKASEB/wHQAYYBIQH/Ac4BgwEhAf8B2gGSASEB/wEsAScBIQH/EAABGQIBAyEBhwH/ASEBJwHx
     164        Af8CIQHtAf8CIQHsAf8CIQHrAf8CIQHrAf8CIQHmAf8CIQHkAf8CIQHiAf8BIQE+AeYB/wIhASsB/5QA
     165        ARICAQEWAUYBOAEhAf8B0gGJASEB/wHiAZ0BIQH/AdkBkQEhAf8B1wGOASEB/wHVAYwBIQH/AeEBmwEh
     166        Af8BzgGEASEB/wFBAiEB/hgAARICAQEWAiEBRQH/ASEBJwHTAf8BIQE4AfQB/wIhAewB/wIhAekB/wEh
     167        ASIB6AH/ASEBQAHwAf8CIQHMAf8BQQIhAf6gAAFGAgEBfQMhAf8BcgFZASEB/wGBAXIBIQH/AVMBRAEh
     168        Af8BQQIhAf4BFAIBARokAAFGAgEBfQMhAf8CIQF1Af8CIQGBAf8CIQFVAf8BQQIhAf4BFAIBARr/AJEA
     169        AUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcAA/8BAAH8AR8B/AEfBAAB8AEHAfABBwQA
     170        AeABAwHgAQMEAAHAAQEBwAEBBAABgAEBAYABAQQAAYABAAGABQABgAEAAYAFAAGAAQABgAUAAYABAAGA
     171        BQABgAEAAYAFAAGAAQEBgAEBBAABwAEBAcABAQQAAcABAwHAAQMEAAHgAQcB4AEHBAAB+AEPAfgBDwQA
     172        BP8EAAs=
    173173</value>
    174174  </data>
  • trunk/sources/HeuristicLab.Hive.Client.Console/Recurrence.Designer.cs

    r1333 r1511  
    1 namespace HeuristicLab.Hive.Client.Console {
    2   partial class Recurrence {
     1namespace HeuristicLab.Hive.Client.Console
     2{
     3  partial class Recurrence
     4  {
    35    /// <summary>
    46    /// Required designer variable.
     
    1012    /// </summary>
    1113    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    12     protected override void Dispose(bool disposing) {
    13       if (disposing && (components != null)) {
     14    protected override void Dispose(bool disposing)
     15    {
     16      if (disposing && (components != null))
     17      {
    1418        components.Dispose();
    1519      }
     
    2327    /// the contents of this method with the code editor.
    2428    /// </summary>
    25     private void InitializeComponent() {
     29    private void InitializeComponent()
     30    {
    2631      this.gbAppointment = new System.Windows.Forms.GroupBox();
    2732      this.chbade = new System.Windows.Forms.CheckBox();
     
    3237      this.dtpFromTime = new System.Windows.Forms.DateTimePicker();
    3338      this.label6 = new System.Windows.Forms.Label();
    34       this.gbRecurrence = new System.Windows.Forms.GroupBox();
    35       this.rbtWeekly = new System.Windows.Forms.RadioButton();
    36       this.rbtDaily = new System.Windows.Forms.RadioButton();
     39      this.txtDays = new System.Windows.Forms.TextBox();
     40      this.label4 = new System.Windows.Forms.Label();
     41      this.label7 = new System.Windows.Forms.Label();
     42      this.btSaveRecurrence = new System.Windows.Forms.Button();
     43      this.btCancelRecurrence = new System.Windows.Forms.Button();
    3744      this.gbWeekly = new System.Windows.Forms.GroupBox();
    3845      this.cbSunday = new System.Windows.Forms.CheckBox();
     
    4350      this.cbTuesday = new System.Windows.Forms.CheckBox();
    4451      this.cbMonday = new System.Windows.Forms.CheckBox();
    45       this.txtDays = new System.Windows.Forms.TextBox();
    46       this.label4 = new System.Windows.Forms.Label();
    47       this.gbDaily = new System.Windows.Forms.GroupBox();
    48       this.label7 = new System.Windows.Forms.Label();
    49       this.btSaveRecurrence = new System.Windows.Forms.Button();
    50       this.btCancelRecurrence = new System.Windows.Forms.Button();
    5152      this.gbAppointment.SuspendLayout();
    52       this.gbRecurrence.SuspendLayout();
    5353      this.gbWeekly.SuspendLayout();
    54       this.gbDaily.SuspendLayout();
    5554      this.SuspendLayout();
    5655      //
     
    7069      this.gbAppointment.TabStop = false;
    7170      this.gbAppointment.Text = "Appointment";
    72       this.gbAppointment.Enter += new System.EventHandler(this.gbAppointment_Enter);
    7371      //
    7472      // chbade
     
    8179      this.chbade.Text = "All Day Event";
    8280      this.chbade.UseVisualStyleBackColor = true;
    83       this.chbade.CheckedChanged += new System.EventHandler(this.chbade_CheckedChanged);
    8481      //
    8582      // dtpEnd
     
    9390      // dtpToTime
    9491      //
    95       this.dtpToTime.CustomFormat = "hh:00";
     92      this.dtpToTime.CustomFormat = "HH:00";
    9693      this.dtpToTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    9794      this.dtpToTime.Location = new System.Drawing.Point(226, 56);
     
    10097      this.dtpToTime.Size = new System.Drawing.Size(73, 20);
    10198      this.dtpToTime.TabIndex = 38;
    102       this.dtpToTime.ValueChanged += new System.EventHandler(this.dtpToTime_ValueChanged);
    10399      //
    104100      // label5
     
    138134      this.label6.Text = "Start Date:";
    139135      //
    140       // gbRecurrence
    141       //
    142       this.gbRecurrence.Controls.Add(this.rbtWeekly);
    143       this.gbRecurrence.Controls.Add(this.rbtDaily);
    144       this.gbRecurrence.Location = new System.Drawing.Point(2, 117);
    145       this.gbRecurrence.Name = "gbRecurrence";
    146       this.gbRecurrence.Size = new System.Drawing.Size(123, 94);
    147       this.gbRecurrence.TabIndex = 40;
    148       this.gbRecurrence.TabStop = false;
    149       this.gbRecurrence.Text = "Recurrence Pattern";
    150       //
    151       // rbtWeekly
    152       //
    153       this.rbtWeekly.AutoSize = true;
    154       this.rbtWeekly.Location = new System.Drawing.Point(11, 58);
    155       this.rbtWeekly.Name = "rbtWeekly";
    156       this.rbtWeekly.Size = new System.Drawing.Size(61, 17);
    157       this.rbtWeekly.TabIndex = 1;
    158       this.rbtWeekly.Text = "Weekly";
    159       this.rbtWeekly.UseVisualStyleBackColor = true;
    160       this.rbtWeekly.CheckedChanged += new System.EventHandler(this.rbtDaily_CheckedChanged);
    161       //
    162       // rbtDaily
    163       //
    164       this.rbtDaily.AutoSize = true;
    165       this.rbtDaily.Checked = true;
    166       this.rbtDaily.Location = new System.Drawing.Point(11, 34);
    167       this.rbtDaily.Name = "rbtDaily";
    168       this.rbtDaily.Size = new System.Drawing.Size(48, 17);
    169       this.rbtDaily.TabIndex = 0;
    170       this.rbtDaily.TabStop = true;
    171       this.rbtDaily.Text = "Daily";
    172       this.rbtDaily.UseVisualStyleBackColor = true;
    173       this.rbtDaily.CheckedChanged += new System.EventHandler(this.rbtDaily_CheckedChanged);
    174       //
    175       // gbWeekly
    176       //
    177       this.gbWeekly.Controls.Add(this.cbSunday);
    178       this.gbWeekly.Controls.Add(this.cbSaturday);
    179       this.gbWeekly.Controls.Add(this.cbFriday);
    180       this.gbWeekly.Controls.Add(this.cbThursday);
    181       this.gbWeekly.Controls.Add(this.cbWednesday);
    182       this.gbWeekly.Controls.Add(this.cbTuesday);
    183       this.gbWeekly.Controls.Add(this.cbMonday);
    184       this.gbWeekly.Location = new System.Drawing.Point(123, 117);
    185       this.gbWeekly.Name = "gbWeekly";
    186       this.gbWeekly.Size = new System.Drawing.Size(265, 94);
    187       this.gbWeekly.TabIndex = 42;
    188       this.gbWeekly.TabStop = false;
    189       this.gbWeekly.Visible = false;
    190       //
    191       // cbSunday
    192       //
    193       this.cbSunday.AutoSize = true;
    194       this.cbSunday.Location = new System.Drawing.Point(11, 58);
    195       this.cbSunday.Name = "cbSunday";
    196       this.cbSunday.Size = new System.Drawing.Size(62, 17);
    197       this.cbSunday.TabIndex = 6;
    198       this.cbSunday.Text = "Sunday";
    199       this.cbSunday.UseVisualStyleBackColor = true;
    200       //
    201       // cbSaturday
    202       //
    203       this.cbSaturday.AutoSize = true;
    204       this.cbSaturday.Location = new System.Drawing.Point(173, 37);
    205       this.cbSaturday.Name = "cbSaturday";
    206       this.cbSaturday.Size = new System.Drawing.Size(68, 17);
    207       this.cbSaturday.TabIndex = 5;
    208       this.cbSaturday.Text = "Saturday";
    209       this.cbSaturday.UseVisualStyleBackColor = true;
    210       //
    211       // cbFriday
    212       //
    213       this.cbFriday.AutoSize = true;
    214       this.cbFriday.Location = new System.Drawing.Point(97, 37);
    215       this.cbFriday.Name = "cbFriday";
    216       this.cbFriday.Size = new System.Drawing.Size(54, 17);
    217       this.cbFriday.TabIndex = 4;
    218       this.cbFriday.Text = "Friday";
    219       this.cbFriday.UseVisualStyleBackColor = true;
    220       //
    221       // cbThursday
    222       //
    223       this.cbThursday.AutoSize = true;
    224       this.cbThursday.Location = new System.Drawing.Point(11, 37);
    225       this.cbThursday.Name = "cbThursday";
    226       this.cbThursday.Size = new System.Drawing.Size(70, 17);
    227       this.cbThursday.TabIndex = 3;
    228       this.cbThursday.Text = "Thursday";
    229       this.cbThursday.UseVisualStyleBackColor = true;
    230       //
    231       // cbWednesday
    232       //
    233       this.cbWednesday.AutoSize = true;
    234       this.cbWednesday.Location = new System.Drawing.Point(173, 16);
    235       this.cbWednesday.Name = "cbWednesday";
    236       this.cbWednesday.Size = new System.Drawing.Size(86, 17);
    237       this.cbWednesday.TabIndex = 2;
    238       this.cbWednesday.Text = "Wednesday ";
    239       this.cbWednesday.UseVisualStyleBackColor = true;
    240       //
    241       // cbTuesday
    242       //
    243       this.cbTuesday.AutoSize = true;
    244       this.cbTuesday.Location = new System.Drawing.Point(97, 16);
    245       this.cbTuesday.Name = "cbTuesday";
    246       this.cbTuesday.Size = new System.Drawing.Size(67, 17);
    247       this.cbTuesday.TabIndex = 1;
    248       this.cbTuesday.Text = "Tuesday";
    249       this.cbTuesday.UseVisualStyleBackColor = true;
    250       //
    251       // cbMonday
    252       //
    253       this.cbMonday.AutoSize = true;
    254       this.cbMonday.Location = new System.Drawing.Point(11, 16);
    255       this.cbMonday.Name = "cbMonday";
    256       this.cbMonday.Size = new System.Drawing.Size(64, 17);
    257       this.cbMonday.TabIndex = 0;
    258       this.cbMonday.Text = "Monday";
    259       this.cbMonday.UseVisualStyleBackColor = true;
    260       //
    261136      // txtDays
    262137      //
    263       this.txtDays.Location = new System.Drawing.Point(50, 17);
     138      this.txtDays.Location = new System.Drawing.Point(160, 13);
    264139      this.txtDays.Name = "txtDays";
    265140      this.txtDays.Size = new System.Drawing.Size(30, 20);
    266141      this.txtDays.TabIndex = 24;
     142      this.txtDays.Text = "1";
     143      this.txtDays.Visible = false;
    267144      //
    268145      // label4
    269146      //
    270147      this.label4.AutoSize = true;
    271       this.label4.Location = new System.Drawing.Point(10, 20);
     148      this.label4.Location = new System.Drawing.Point(120, 16);
    272149      this.label4.Name = "label4";
    273150      this.label4.Size = new System.Drawing.Size(34, 13);
    274151      this.label4.TabIndex = 23;
    275152      this.label4.Text = "Every";
    276       //
    277       // gbDaily
    278       //
    279       this.gbDaily.Controls.Add(this.label7);
    280       this.gbDaily.Controls.Add(this.txtDays);
    281       this.gbDaily.Controls.Add(this.label4);
    282       this.gbDaily.Location = new System.Drawing.Point(123, 117);
    283       this.gbDaily.Name = "gbDaily";
    284       this.gbDaily.Size = new System.Drawing.Size(265, 94);
    285       this.gbDaily.TabIndex = 41;
    286       this.gbDaily.TabStop = false;
     153      this.label4.Visible = false;
    287154      //
    288155      // label7
    289156      //
    290157      this.label7.AutoSize = true;
    291       this.label7.Location = new System.Drawing.Point(86, 20);
     158      this.label7.Location = new System.Drawing.Point(196, 16);
    292159      this.label7.Name = "label7";
    293       this.label7.Size = new System.Drawing.Size(37, 13);
     160      this.label7.Size = new System.Drawing.Size(59, 13);
    294161      this.label7.TabIndex = 25;
    295       this.label7.Text = "Day(s)";
     162      this.label7.Text = "week(s) on";
     163      this.label7.Visible = false;
    296164      //
    297165      // btSaveRecurrence
     
    303171      this.btSaveRecurrence.Text = "Save";
    304172      this.btSaveRecurrence.UseVisualStyleBackColor = true;
     173      this.btSaveRecurrence.Click += new System.EventHandler(this.btSaveRecurrence_Click);
    305174      //
    306175      // btCancelRecurrence
     
    314183      this.btCancelRecurrence.Click += new System.EventHandler(this.btCancelRecurrence_Click);
    315184      //
     185      // gbWeekly
     186      //
     187      this.gbWeekly.Controls.Add(this.label7);
     188      this.gbWeekly.Controls.Add(this.cbSunday);
     189      this.gbWeekly.Controls.Add(this.txtDays);
     190      this.gbWeekly.Controls.Add(this.cbSaturday);
     191      this.gbWeekly.Controls.Add(this.cbFriday);
     192      this.gbWeekly.Controls.Add(this.cbThursday);
     193      this.gbWeekly.Controls.Add(this.label4);
     194      this.gbWeekly.Controls.Add(this.cbWednesday);
     195      this.gbWeekly.Controls.Add(this.cbTuesday);
     196      this.gbWeekly.Controls.Add(this.cbMonday);
     197      this.gbWeekly.Location = new System.Drawing.Point(2, 111);
     198      this.gbWeekly.Name = "gbWeekly";
     199      this.gbWeekly.Size = new System.Drawing.Size(386, 100);
     200      this.gbWeekly.TabIndex = 42;
     201      this.gbWeekly.TabStop = false;
     202      this.gbWeekly.Text = "Days of week";
     203      //
     204      // cbSunday
     205      //
     206      this.cbSunday.AutoSize = true;
     207      this.cbSunday.Location = new System.Drawing.Point(199, 65);
     208      this.cbSunday.Name = "cbSunday";
     209      this.cbSunday.Size = new System.Drawing.Size(62, 17);
     210      this.cbSunday.TabIndex = 6;
     211      this.cbSunday.Text = "Sunday";
     212      this.cbSunday.UseVisualStyleBackColor = true;
     213      //
     214      // cbSaturday
     215      //
     216      this.cbSaturday.AutoSize = true;
     217      this.cbSaturday.Location = new System.Drawing.Point(122, 65);
     218      this.cbSaturday.Name = "cbSaturday";
     219      this.cbSaturday.Size = new System.Drawing.Size(68, 17);
     220      this.cbSaturday.TabIndex = 5;
     221      this.cbSaturday.Text = "Saturday";
     222      this.cbSaturday.UseVisualStyleBackColor = true;
     223      //
     224      // cbFriday
     225      //
     226      this.cbFriday.AutoSize = true;
     227      this.cbFriday.Location = new System.Drawing.Point(37, 65);
     228      this.cbFriday.Name = "cbFriday";
     229      this.cbFriday.Size = new System.Drawing.Size(54, 17);
     230      this.cbFriday.TabIndex = 4;
     231      this.cbFriday.Text = "Friday";
     232      this.cbFriday.UseVisualStyleBackColor = true;
     233      //
     234      // cbThursday
     235      //
     236      this.cbThursday.AutoSize = true;
     237      this.cbThursday.Location = new System.Drawing.Point(289, 40);
     238      this.cbThursday.Name = "cbThursday";
     239      this.cbThursday.Size = new System.Drawing.Size(70, 17);
     240      this.cbThursday.TabIndex = 3;
     241      this.cbThursday.Text = "Thursday";
     242      this.cbThursday.UseVisualStyleBackColor = true;
     243      //
     244      // cbWednesday
     245      //
     246      this.cbWednesday.AutoSize = true;
     247      this.cbWednesday.Location = new System.Drawing.Point(199, 42);
     248      this.cbWednesday.Name = "cbWednesday";
     249      this.cbWednesday.Size = new System.Drawing.Size(86, 17);
     250      this.cbWednesday.TabIndex = 2;
     251      this.cbWednesday.Text = "Wednesday ";
     252      this.cbWednesday.UseVisualStyleBackColor = true;
     253      //
     254      // cbTuesday
     255      //
     256      this.cbTuesday.AutoSize = true;
     257      this.cbTuesday.Location = new System.Drawing.Point(123, 42);
     258      this.cbTuesday.Name = "cbTuesday";
     259      this.cbTuesday.Size = new System.Drawing.Size(67, 17);
     260      this.cbTuesday.TabIndex = 1;
     261      this.cbTuesday.Text = "Tuesday";
     262      this.cbTuesday.UseVisualStyleBackColor = true;
     263      //
     264      // cbMonday
     265      //
     266      this.cbMonday.AutoSize = true;
     267      this.cbMonday.Location = new System.Drawing.Point(37, 42);
     268      this.cbMonday.Name = "cbMonday";
     269      this.cbMonday.Size = new System.Drawing.Size(64, 17);
     270      this.cbMonday.TabIndex = 0;
     271      this.cbMonday.Text = "Monday";
     272      this.cbMonday.UseVisualStyleBackColor = true;
     273      //
    316274      // Recurrence
    317275      //
     
    319277      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    320278      this.ClientSize = new System.Drawing.Size(393, 243);
     279      this.Controls.Add(this.gbWeekly);
    321280      this.Controls.Add(this.btCancelRecurrence);
    322281      this.Controls.Add(this.btSaveRecurrence);
    323       this.Controls.Add(this.gbWeekly);
    324       this.Controls.Add(this.gbDaily);
    325       this.Controls.Add(this.gbRecurrence);
    326282      this.Controls.Add(this.gbAppointment);
    327283      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     
    330286      this.gbAppointment.ResumeLayout(false);
    331287      this.gbAppointment.PerformLayout();
    332       this.gbRecurrence.ResumeLayout(false);
    333       this.gbRecurrence.PerformLayout();
    334288      this.gbWeekly.ResumeLayout(false);
    335289      this.gbWeekly.PerformLayout();
    336       this.gbDaily.ResumeLayout(false);
    337       this.gbDaily.PerformLayout();
    338290      this.ResumeLayout(false);
    339291
     
    343295
    344296    private System.Windows.Forms.GroupBox gbAppointment;
    345     private System.Windows.Forms.GroupBox gbRecurrence;
    346     private System.Windows.Forms.RadioButton rbtWeekly;
    347     private System.Windows.Forms.RadioButton rbtDaily;
    348297    private System.Windows.Forms.TextBox txtDays;
    349298    private System.Windows.Forms.Label label4;
    350     private System.Windows.Forms.GroupBox gbDaily;
    351299    private System.Windows.Forms.DateTimePicker dtpEnd;
    352300    private System.Windows.Forms.DateTimePicker dtpStart;
     
    354302    private System.Windows.Forms.Label label6;
    355303    private System.Windows.Forms.Label label7;
     304    private System.Windows.Forms.Button btSaveRecurrence;
     305    private System.Windows.Forms.Button btCancelRecurrence;
     306    private System.Windows.Forms.DateTimePicker dtpFromTime;
     307    private System.Windows.Forms.DateTimePicker dtpToTime;
     308    private System.Windows.Forms.CheckBox chbade;
    356309    private System.Windows.Forms.GroupBox gbWeekly;
    357310    private System.Windows.Forms.CheckBox cbSunday;
     
    362315    private System.Windows.Forms.CheckBox cbTuesday;
    363316    private System.Windows.Forms.CheckBox cbMonday;
    364     private System.Windows.Forms.Button btSaveRecurrence;
    365     private System.Windows.Forms.Button btCancelRecurrence;
    366     private System.Windows.Forms.DateTimePicker dtpFromTime;
    367     private System.Windows.Forms.DateTimePicker dtpToTime;
    368     private System.Windows.Forms.CheckBox chbade;
    369317  }
    370318}
  • trunk/sources/HeuristicLab.Hive.Client.Console/Recurrence.cs

    r1333 r1511  
    11using System;
    22using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Data;
    5 using System.Drawing;
    6 using System.Linq;
    7 using System.Text;
    83using System.Windows.Forms;
    94
    10 namespace HeuristicLab.Hive.Client.Console {
    11   public partial class Recurrence : Form {
    12     public Recurrence() {
     5namespace HeuristicLab.Hive.Client.Console
     6{
     7
     8  public enum RecurrenceMode
     9  {
     10    Daily,
     11    Weekly
     12  }
     13
     14  public partial class Recurrence : Form
     15  {
     16
     17    public OnDialogClosedDelegate dialogClosedDelegate;
     18
     19    public Recurrence()
     20    {
    1321      InitializeComponent();
    1422    }
    1523
    16     private void rbtDaily_CheckedChanged(object sender, EventArgs e) {
    17       if (rbtDaily.Checked) {
    18         gbDaily.Visible = true;
    19         gbWeekly.Visible = false;
    20       } else if (rbtWeekly.Checked) {
    21         gbDaily.Visible = false;
    22         gbWeekly.Visible = true;
    23       }
    24     }
    25 
    26     private void btCancelRecurrence_Click(object sender, EventArgs e) {
     24    private void btCancelRecurrence_Click(object sender, EventArgs e)
     25    {
    2726      this.Close();
    2827    }
    2928
    30     private void gbAppointment_Enter(object sender, EventArgs e) {
     29    private void btSaveRecurrence_Click(object sender, EventArgs e)
     30    {
     31      DateTime dateFrom, dateTo;
     32      RecurrenceMode mode = RecurrenceMode.Daily;
     33      int incWeek = 0;
     34      HashSet<DayOfWeek> days = new HashSet<DayOfWeek>();
    3135
     36      days = GetDays();
     37
     38      //check if valid
     39      if (InputIsValid())
     40      {
     41        //set entity
     42
     43        dateFrom = DateTime.Parse(dtpStart.Text + " " + dtpFromTime.Text);
     44        dateTo = DateTime.Parse(dtpEnd.Text + " " + dtpToTime.Text);
     45
     46        if (int.TryParse(txtDays.Text, out incWeek))
     47          mode = RecurrenceMode.Weekly;
     48        else
     49          mode = RecurrenceMode.Daily;
     50
     51        RecurrentEvent recurrentEvent = new RecurrentEvent()
     52        {
     53          DateFrom = dateFrom,
     54          DateTo = dateTo,
     55          AllDay = chbade.Checked,
     56          WeekDays = days,
     57          IncWeeks = incWeek,
     58        };
     59
     60        //fire delegate and close the dialog
     61        dialogClosedDelegate(recurrentEvent);
     62        this.Close();
     63      }
     64      else
     65        MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    3266    }
    3367
    34     private void cmbEnd_Click(object sender, EventArgs e) {
     68    private HashSet<DayOfWeek> GetDays()
     69    {
     70      HashSet<DayOfWeek> days = new HashSet<DayOfWeek>();
    3571
     72      if (cbMonday.Checked)
     73        days.Add(DayOfWeek.Monday);
     74      if (cbTuesday.Checked)
     75        days.Add(DayOfWeek.Tuesday);
     76      if (cbWednesday.Checked)
     77        days.Add(DayOfWeek.Wednesday);
     78      if (cbThursday.Checked)
     79        days.Add(DayOfWeek.Thursday);
     80      if (cbFriday.Checked)
     81        days.Add(DayOfWeek.Friday);
     82      if (cbSaturday.Checked)
     83        days.Add(DayOfWeek.Saturday);
     84      if (cbSunday.Checked)
     85        days.Add(DayOfWeek.Sunday);
     86
     87      return days;
    3688    }
    3789
    38     private void dtpToTime_ValueChanged(object sender, EventArgs e) {
     90    private bool InputIsValid()
     91    {
     92      DateTime dateFrom, dateTo;
     93      int i = 0;
    3994
    40     }
     95      dateFrom = DateTime.Parse(dtpStart.Text + " " + dtpFromTime.Text);
     96      dateTo = DateTime.Parse(dtpEnd.Text + " " + dtpToTime.Text);
    4197
    42     private void chbade_CheckedChanged(object sender, EventArgs e) {
    43         dtpFromTime.Visible = !chbade.Checked;
    44         dtpToTime.Visible = !chbade.Checked;
     98      if (dateFrom < dateTo && dateFrom.TimeOfDay < dateTo.TimeOfDay && int.TryParse(txtDays.Text, out i))
     99        return true;
     100      else
     101        return false;
    45102    }
    46103  }
Note: See TracChangeset for help on using the changeset viewer.