Changeset 1511 for trunk/sources
- Timestamp:
- 04/03/09 14:35:19 (16 years ago)
- 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 156 156 <DependentUpon>Recurrence.cs</DependentUpon> 157 157 </Compile> 158 <Compile Include="RecurrentEvent.cs" /> 158 159 <Compile Include="Service References\ClientService\Reference.cs"> 159 160 <AutoGen>True</AutoGen> -
trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.Designer.cs
r1333 r1511 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 Calendar.DrawTool drawTool 2= new Calendar.DrawTool();48 Calendar.DrawTool drawTool1 = new Calendar.DrawTool(); 49 49 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveClientConsole)); 50 50 this.dvOnline = new Calendar.DayView(); … … 115 115 // dvOnline 116 116 // 117 drawTool 2.DayView = this.dvOnline;118 this.dvOnline.ActiveTool = drawTool 2;117 drawTool1.DayView = this.dvOnline; 118 this.dvOnline.ActiveTool = drawTool1; 119 119 this.dvOnline.AmPmDisplay = false; 120 120 this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes; … … 529 529 this.groupBox1.Controls.Add(this.label1); 530 530 this.groupBox1.Controls.Add(this.btCreate); 531 this.groupBox1.Location = new System.Drawing.Point(3 53, 7);531 this.groupBox1.Location = new System.Drawing.Point(373, 7); 532 532 this.groupBox1.Name = "groupBox1"; 533 this.groupBox1.Size = new System.Drawing.Size(2 74, 161);533 this.groupBox1.Size = new System.Drawing.Size(254, 161); 534 534 this.groupBox1.TabIndex = 21; 535 535 this.groupBox1.TabStop = false; … … 539 539 this.txttimeTo.CustomFormat = "HH:00"; 540 540 this.txttimeTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 541 this.txttimeTo.Location = new System.Drawing.Point(1 89, 64);541 this.txttimeTo.Location = new System.Drawing.Point(164, 45); 542 542 this.txttimeTo.Name = "txttimeTo"; 543 543 this.txttimeTo.ShowUpDown = true; … … 549 549 this.txttimeFrom.CustomFormat = "HH:00"; 550 550 this.txttimeFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 551 this.txttimeFrom.Location = new System.Drawing.Point(1 89, 31);551 this.txttimeFrom.Location = new System.Drawing.Point(164, 12); 552 552 this.txttimeFrom.Name = "txttimeFrom"; 553 553 this.txttimeFrom.ShowUpDown = true; … … 558 558 // 559 559 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); 561 561 this.dtpTo.Name = "dtpTo"; 562 562 this.dtpTo.Size = new System.Drawing.Size(89, 20); … … 566 566 // 567 567 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); 569 569 this.dtpFrom.Name = "dtpFrom"; 570 570 this.dtpFrom.Size = new System.Drawing.Size(89, 20); … … 574 574 // 575 575 this.chbade.AutoSize = true; 576 this.chbade.Location = new System.Drawing.Point( 97, 90);576 this.chbade.Location = new System.Drawing.Point(72, 71); 577 577 this.chbade.Name = "chbade"; 578 578 this.chbade.Size = new System.Drawing.Size(90, 17); … … 584 584 // btnRecurrence 585 585 // 586 this.btnRecurrence.Location = new System.Drawing.Point(1 89, 129);586 this.btnRecurrence.Location = new System.Drawing.Point(141, 129); 587 587 this.btnRecurrence.Name = "btnRecurrence"; 588 this.btnRecurrence.Size = new System.Drawing.Size( 75, 26);588 this.btnRecurrence.Size = new System.Drawing.Size(113, 26); 589 589 this.btnRecurrence.TabIndex = 30; 590 590 this.btnRecurrence.Text = "Recurrence"; … … 594 594 // btbDelete 595 595 // 596 this.btbDelete.Location = new System.Drawing.Point( 100, 129);596 this.btbDelete.Location = new System.Drawing.Point(8, 129); 597 597 this.btbDelete.Name = "btbDelete"; 598 this.btbDelete.Size = new System.Drawing.Size( 75, 26);598 this.btbDelete.Size = new System.Drawing.Size(114, 26); 599 599 this.btbDelete.TabIndex = 25; 600 600 this.btbDelete.Text = "Delete"; … … 605 605 // 606 606 this.label2.AutoSize = true; 607 this.label2.Location = new System.Drawing.Point( 41, 65);607 this.label2.Location = new System.Drawing.Point(16, 46); 608 608 this.label2.Name = "label2"; 609 609 this.label2.Size = new System.Drawing.Size(55, 13); … … 614 614 // 615 615 this.label1.AutoSize = true; 616 this.label1.Location = new System.Drawing.Point( 41, 34);616 this.label1.Location = new System.Drawing.Point(16, 15); 617 617 this.label1.Name = "label1"; 618 618 this.label1.Size = new System.Drawing.Size(58, 13); … … 622 622 // btCreate 623 623 // 624 this.btCreate.Location = new System.Drawing.Point( 11, 129);624 this.btCreate.Location = new System.Drawing.Point(6, 93); 625 625 this.btCreate.Name = "btCreate"; 626 this.btCreate.Size = new System.Drawing.Size( 75, 26);626 this.btCreate.Size = new System.Drawing.Size(242, 26); 627 627 this.btCreate.TabIndex = 20; 628 628 this.btCreate.Text = "Save"; -
trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.cs
r1333 r1511 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.ComponentModel; 25 using System.Data; 24 using System.Diagnostics; 26 25 using System.Drawing; 27 26 using System.Linq; 28 using System.Text; 27 using System.Net; 28 using System.ServiceModel; 29 29 using System.Windows.Forms; 30 using System.Diagnostics;31 using System.Threading;30 using Calendar; 31 using HeuristicLab.Hive.Client.Console.ClientService; 32 32 using 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 34 namespace HeuristicLab.Hive.Client.Console 35 { 40 36 41 37 #region Delegates 42 38 43 delegate void UpdateTextDelegate(EventLogEntry ev); 39 public delegate void UpdateTextDelegate(EventLogEntry ev); 40 public delegate void OnDialogClosedDelegate(RecurrentEvent e); 44 41 45 42 #endregion 46 43 47 public partial class HiveClientConsole : Form { 44 public partial class HiveClientConsole : Form 45 { 48 46 49 47 #region Declarations … … 59 57 private List<Appointment> onlineTimes = new List<Appointment>(); 60 58 59 public OnDialogClosedDelegate dialogClosedDelegate; 60 61 61 #endregion 62 62 63 63 #region Constructor 64 64 65 public HiveClientConsole() { 65 public HiveClientConsole() 66 { 66 67 InitializeComponent(); 67 68 lvwColumnSorter = new ListViewColumnSorterDate(); … … 80 81 #region Methods 81 82 82 private void InitTimer() { 83 private void InitTimer() 84 { 83 85 refreshTimer = new System.Windows.Forms.Timer(); 84 86 refreshTimer.Interval = 1000; … … 87 89 } 88 90 89 private void RefreshGui() { 90 try { 91 private void RefreshGui() 92 { 93 try 94 { 91 95 cccc.GetStatusInfosAsync(); 92 96 } 93 catch (Exception ex) { 97 catch (Exception ex) 98 { 94 99 refreshTimer.Stop(); 95 100 DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 99 104 } 100 105 101 private void ConnectToClient() { 102 try { 106 private void ConnectToClient() 107 { 108 try 109 { 103 110 cccc = new ClientConsoleCommunicatorClient(new NetTcpBinding(), new EndpointAddress(ENDPOINTADRESS)); 104 111 cccc.GetStatusInfosCompleted += new EventHandler<GetStatusInfosCompletedEventArgs>(cccc_GetStatusInfosCompleted); 105 112 cccc.GetCurrentConnectionCompleted += new EventHandler<GetCurrentConnectionCompletedEventArgs>(cccc_GetCurrentConnectionCompleted); 106 113 } 107 catch (Exception) { 114 catch (Exception) 115 { 108 116 refreshTimer.Stop(); 109 117 DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 113 121 } 114 122 115 private void GetEventLog() { 123 private void GetEventLog() 124 { 116 125 HiveClientEventLog = new EventLog(EVENTLOGNAME); 117 126 HiveClientEventLog.Source = EVENTLOGNAME; … … 122 131 123 132 //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 { 126 137 curEventLogEntry = GenerateEventEntry(ele); 127 138 lvLog.Items.Add(curEventLogEntry); … … 131 142 } 132 143 133 private ListViewItem GenerateEventEntry(EventLogEntry ele) { 144 private ListViewItem GenerateEventEntry(EventLogEntry ele) 145 { 134 146 ListViewItem curEventLogEntry; 135 147 curEventLogEntry = new ListViewItem("", 0); … … 142 154 } 143 155 144 private void UpdateGraph(JobStatus[] jobs) { 156 private void UpdateGraph(JobStatus[] jobs) 157 { 145 158 ZedGraphControl zgc = new ZedGraphControl(); 146 159 GraphPane myPane = zgc.GraphPane; … … 162 175 double done = 0; 163 176 164 if (jobs.Length == 0) { 177 if (jobs.Length == 0) 178 { 165 179 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 { 168 185 allProgress += jobs[i].Progress; 169 186 } … … 182 199 } 183 200 184 private void InitCalender() { 201 private void InitCalender() 202 { 185 203 dvOnline.StartDate = DateTime.Now; 186 204 dvOnline.OnNewAppointment += new EventHandler<NewAppointmentEventArgs>(DvOnline_OnNewAppointment); … … 188 206 } 189 207 190 private Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay) { 208 private Appointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay) 209 { 191 210 Appointment App = new Appointment(); 192 211 App.StartDate = startDate; … … 196 215 App.Locked = true; 197 216 App.Subject = "Online"; 217 App.Recurring = false; 198 218 return App; 199 219 } 200 220 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 } 202 244 203 245 #endregion … … 205 247 #region Events 206 248 207 private void refreshTimer_Tick(object sender, EventArgs e) { 249 private void refreshTimer_Tick(object sender, EventArgs e) 250 { 208 251 RefreshGui(); 209 252 } 210 253 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 { 213 258 ConnectionContainer curConnection = e.Result; 214 259 tbIPAdress.Text = curConnection.IPAdress; 215 260 tbPort.Text = curConnection.Port.ToString(); 216 } else { 261 } 262 else 263 { 217 264 refreshTimer.Stop(); 218 265 DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running! - " + e.Error.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 222 269 } 223 270 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 { 227 276 StatusCommons sc = e.Result; 228 277 … … 237 286 ListViewItem curJobStatusItem; 238 287 239 if (sc.Jobs != null) { 288 if (sc.Jobs != null) 289 { 240 290 lvJobDetail.Items.Clear(); 241 291 double progress; 242 foreach (JobStatus curJob in sc.Jobs) { 292 foreach (JobStatus curJob in sc.Jobs) 293 { 243 294 curJobStatusItem = new ListViewItem(curJob.JobId.ToString()); 244 295 curJobStatusItem.SubItems.Add(curJob.Since.ToString()); … … 252 303 UpdateGraph(sc.Jobs); 253 304 254 if (sc.Status == NetworkEnumWcfConnState.Connected || sc.Status == NetworkEnumWcfConnState.Loggedin) { 305 if (sc.Status == NetworkEnumWcfConnState.Connected || sc.Status == NetworkEnumWcfConnState.Loggedin) 306 { 255 307 btConnect.Enabled = false; 256 308 btnDisconnect.Enabled = true; 257 309 lbCs.Text = sc.ConnectedSince.ToString(); 258 310 cccc.GetCurrentConnectionAsync(); 259 } else if (sc.Status == NetworkEnumWcfConnState.Disconnected) { 311 } 312 else if (sc.Status == NetworkEnumWcfConnState.Disconnected) 313 { 260 314 btConnect.Enabled = true; 261 315 btnDisconnect.Enabled = false; 262 316 lbCs.Text = String.Empty; 263 } else if (sc.Status == NetworkEnumWcfConnState.Failed) { 317 } 318 else if (sc.Status == NetworkEnumWcfConnState.Failed) 319 { 264 320 btConnect.Enabled = true; 265 321 btnDisconnect.Enabled = false; … … 268 324 269 325 cccc.GetCurrentConnection(); 270 } else { 326 } 327 else 328 { 271 329 refreshTimer.Stop(); 272 330 DialogResult res = MessageBox.Show("Connection Error, check if Hive Client is running! - " + e.Error.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 276 334 } 277 335 278 private void HiveClientConsole_Load(object sender, EventArgs e) { 336 private void HiveClientConsole_Load(object sender, EventArgs e) 337 { 279 338 //nothing to do 280 339 } 281 340 282 private void UpdateText(EventLogEntry ev) { 283 if (this.lvLog.InvokeRequired) { 341 private void UpdateText(EventLogEntry ev) 342 { 343 if (this.lvLog.InvokeRequired) 344 { 284 345 this.lvLog.Invoke(new 285 346 UpdateTextDelegate(UpdateText), new object[] { ev }); 286 } else { 347 } 348 else 349 { 287 350 ListViewItem curEventLogEntry = GenerateEventEntry(ev); 288 351 lvLog.Items.Add(curEventLogEntry); … … 291 354 } 292 355 293 public void OnEntryWritten(object source, EntryWrittenEventArgs e) { 356 public void OnEntryWritten(object source, EntryWrittenEventArgs e) 357 { 294 358 UpdateText(e.Entry); 295 359 } 296 360 297 private void lvLog_DoubleClick(object sender, EventArgs e) { 361 private void lvLog_DoubleClick(object sender, EventArgs e) 362 { 298 363 ListViewItem lvi = lvLog.SelectedItems[0]; 299 364 HiveEventEntry hee = new HiveEventEntry(lvi.SubItems[2].Text, lvi.SubItems[3].Text, lvi.SubItems[1].Text); … … 303 368 } 304 369 305 private void btConnect_Click(object sender, EventArgs e) { 370 private void btConnect_Click(object sender, EventArgs e) 371 { 306 372 IPAddress ipAdress; 307 373 int port; 308 374 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 { 310 377 cc.IPAdress = tbIPAdress.Text; 311 378 cc.Port = port; 312 379 cccc.SetConnectionAsync(cc); 313 } else { 380 } 381 else 382 { 314 383 MessageBox.Show("IP Adress and/or Port Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 315 384 } 316 385 } 317 386 318 private void btnDisconnect_Click(object sender, EventArgs e) { 387 private void btnDisconnect_Click(object sender, EventArgs e) 388 { 319 389 cccc.DisconnectAsync(); 320 390 } 321 391 322 private void lvLog_ColumnClick(object sender, ColumnClickEventArgs e) { 392 private void lvLog_ColumnClick(object sender, ColumnClickEventArgs e) 393 { 323 394 // 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 { 325 397 // Reverse the current sort direction for this column. 326 if (lvwColumnSorter.Order == SortOrder.Ascending) { 398 if (lvwColumnSorter.Order == SortOrder.Ascending) 399 { 327 400 lvwColumnSorter.Order = SortOrder.Descending; 328 } else { 401 } 402 else 403 { 329 404 lvwColumnSorter.Order = SortOrder.Ascending; 330 405 } 331 } else { 406 } 407 else 408 { 332 409 // Set the column number that is to be sorted; default to ascending. 333 410 lvwColumnSorter.SortColumn = e.Column; … … 339 416 } 340 417 341 private void btn_clientShutdown_Click(object sender, EventArgs e) { 418 private void btn_clientShutdown_Click(object sender, EventArgs e) 419 { 342 420 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 { 344 423 cccc.ShutdownClient(); 345 424 this.Close(); … … 347 426 } 348 427 349 private void btbDelete_Click(object sender, EventArgs e) { 428 private void btbDelete_Click(object sender, EventArgs e) 429 { 430 Appointment selectedAppointment = dvOnline.SelectedAppointment; 350 431 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 } 352 444 dvOnline.Invalidate(); 353 445 } 354 446 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 { 363 449 txttimeFrom.Visible = !chbade.Checked; 364 450 txttimeTo.Visible = !chbade.Checked; 365 451 } 366 452 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 { 369 457 dtpFrom.Text = dvOnline.SelectionStart.ToShortDateString(); 370 458 dtpTo.Text = dvOnline.SelectionEnd.Date.ToShortDateString(); 371 459 txttimeFrom.Text = dvOnline.SelectionStart.ToShortTimeString(); 372 460 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 { 377 487 if (e.KeyChar == (char)Keys.Return) 378 488 btConnect_Click(null, null); 379 489 } 380 490 381 private void mcOnline_DateChanged(object sender, DateRangeEventArgs e) { 491 private void mcOnline_DateChanged(object sender, DateRangeEventArgs e) 492 { 382 493 dvOnline.StartDate = mcOnline.SelectionStart; 383 494 } 384 495 385 private void btCreate_Click(object sender, EventArgs e) { 496 private bool CreateAppointment() 497 { 386 498 DateTime from, to; 387 499 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 { 390 504 //whole day appointment, only dates are visible 391 505 if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to) … … 393 507 else 394 508 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 { 396 512 //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 { 398 515 if (from.Date == to.Date) 399 516 onlineTimes.Add(CreateAppointment(from, to, false)); 400 else { 517 else 518 { 401 519 //more than 1 day selected 402 while (from.Date != to.Date) { 520 while (from.Date != to.Date) 521 { 403 522 onlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false)); 404 523 from = from.AddDays(1); … … 406 525 onlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false)); 407 526 } 408 } else 527 } 528 else 409 529 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 410 530 } 411 531 dvOnline.Invalidate(); 412 } else { 532 return true; 533 } 534 else 535 { 413 536 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 { 418 583 List<Appointment> Apps = new List<Appointment>(); 419 584 … … 425 590 } 426 591 427 void DvOnline_OnNewAppointment(object sender, NewAppointmentEventArgs e) { 592 private void DvOnline_OnNewAppointment(object sender, NewAppointmentEventArgs e) 593 { 428 594 Appointment Appointment = new Appointment(); 429 595 … … 434 600 } 435 601 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); 438 606 recurrence.Show(); 439 607 } 440 608 609 public void DialogClosed(RecurrentEvent e) 610 { 611 CreateDailyRecurrenceAppointments(e.DateFrom, e.DateTo, e.AllDay, e.IncWeeks, e.WeekDays); 612 } 613 441 614 #endregion 442 615 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 } 443 630 } 444 631 } -
trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.resx
r1333 r1511 125 125 AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w 126 126 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 127 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB S127 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABQ 128 128 CgAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA 129 AwABEAMAAQEBAAEgBgABECoAAUMCAQF0AWYCCQHxA x0B/wFiAgMB1AEgAgEBLCwAAUMCAQF0AWYCCQHx130 A x0B/wFiAgMB1AEgAgEBLKQAAWACCgHyAZMBdwEdAf8BvwGBAR0B/wG9AYEBHQH/AboBgQEdAf8BuAGB131 A R0B/wG2AYEBHQH/AVEBOgEdAf8BPQIBAWUcAAFgAgoB8gIdAaQB/wIdAdYB/wIdAdQB/wIdAdIB/wId132 AdAB/wI dAc4B/wIdAVgB/wE9AgEBZZgAAScBIwEdAf8BxwGBAR0B/wH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EWAUYBOAEhAf8B0gGJASEB/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= 173 173 </value> 174 174 </data> -
trunk/sources/HeuristicLab.Hive.Client.Console/Recurrence.Designer.cs
r1333 r1511 1 namespace HeuristicLab.Hive.Client.Console { 2 partial class Recurrence { 1 namespace HeuristicLab.Hive.Client.Console 2 { 3 partial class Recurrence 4 { 3 5 /// <summary> 4 6 /// Required designer variable. … … 10 12 /// </summary> 11 13 /// <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 { 14 18 components.Dispose(); 15 19 } … … 23 27 /// the contents of this method with the code editor. 24 28 /// </summary> 25 private void InitializeComponent() { 29 private void InitializeComponent() 30 { 26 31 this.gbAppointment = new System.Windows.Forms.GroupBox(); 27 32 this.chbade = new System.Windows.Forms.CheckBox(); … … 32 37 this.dtpFromTime = new System.Windows.Forms.DateTimePicker(); 33 38 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(); 37 44 this.gbWeekly = new System.Windows.Forms.GroupBox(); 38 45 this.cbSunday = new System.Windows.Forms.CheckBox(); … … 43 50 this.cbTuesday = new System.Windows.Forms.CheckBox(); 44 51 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();51 52 this.gbAppointment.SuspendLayout(); 52 this.gbRecurrence.SuspendLayout();53 53 this.gbWeekly.SuspendLayout(); 54 this.gbDaily.SuspendLayout();55 54 this.SuspendLayout(); 56 55 // … … 70 69 this.gbAppointment.TabStop = false; 71 70 this.gbAppointment.Text = "Appointment"; 72 this.gbAppointment.Enter += new System.EventHandler(this.gbAppointment_Enter);73 71 // 74 72 // chbade … … 81 79 this.chbade.Text = "All Day Event"; 82 80 this.chbade.UseVisualStyleBackColor = true; 83 this.chbade.CheckedChanged += new System.EventHandler(this.chbade_CheckedChanged);84 81 // 85 82 // dtpEnd … … 93 90 // dtpToTime 94 91 // 95 this.dtpToTime.CustomFormat = " hh:00";92 this.dtpToTime.CustomFormat = "HH:00"; 96 93 this.dtpToTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 97 94 this.dtpToTime.Location = new System.Drawing.Point(226, 56); … … 100 97 this.dtpToTime.Size = new System.Drawing.Size(73, 20); 101 98 this.dtpToTime.TabIndex = 38; 102 this.dtpToTime.ValueChanged += new System.EventHandler(this.dtpToTime_ValueChanged);103 99 // 104 100 // label5 … … 138 134 this.label6.Text = "Start Date:"; 139 135 // 140 // gbRecurrence141 //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 // rbtWeekly152 //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 // rbtDaily163 //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 // gbWeekly176 //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 // cbSunday192 //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 // cbSaturday202 //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 // cbFriday212 //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 // cbThursday222 //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 // cbWednesday232 //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 // cbTuesday242 //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 // cbMonday252 //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 //261 136 // txtDays 262 137 // 263 this.txtDays.Location = new System.Drawing.Point( 50, 17);138 this.txtDays.Location = new System.Drawing.Point(160, 13); 264 139 this.txtDays.Name = "txtDays"; 265 140 this.txtDays.Size = new System.Drawing.Size(30, 20); 266 141 this.txtDays.TabIndex = 24; 142 this.txtDays.Text = "1"; 143 this.txtDays.Visible = false; 267 144 // 268 145 // label4 269 146 // 270 147 this.label4.AutoSize = true; 271 this.label4.Location = new System.Drawing.Point(1 0, 20);148 this.label4.Location = new System.Drawing.Point(120, 16); 272 149 this.label4.Name = "label4"; 273 150 this.label4.Size = new System.Drawing.Size(34, 13); 274 151 this.label4.TabIndex = 23; 275 152 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; 287 154 // 288 155 // label7 289 156 // 290 157 this.label7.AutoSize = true; 291 this.label7.Location = new System.Drawing.Point( 86, 20);158 this.label7.Location = new System.Drawing.Point(196, 16); 292 159 this.label7.Name = "label7"; 293 this.label7.Size = new System.Drawing.Size( 37, 13);160 this.label7.Size = new System.Drawing.Size(59, 13); 294 161 this.label7.TabIndex = 25; 295 this.label7.Text = "Day(s)"; 162 this.label7.Text = "week(s) on"; 163 this.label7.Visible = false; 296 164 // 297 165 // btSaveRecurrence … … 303 171 this.btSaveRecurrence.Text = "Save"; 304 172 this.btSaveRecurrence.UseVisualStyleBackColor = true; 173 this.btSaveRecurrence.Click += new System.EventHandler(this.btSaveRecurrence_Click); 305 174 // 306 175 // btCancelRecurrence … … 314 183 this.btCancelRecurrence.Click += new System.EventHandler(this.btCancelRecurrence_Click); 315 184 // 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 // 316 274 // Recurrence 317 275 // … … 319 277 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 320 278 this.ClientSize = new System.Drawing.Size(393, 243); 279 this.Controls.Add(this.gbWeekly); 321 280 this.Controls.Add(this.btCancelRecurrence); 322 281 this.Controls.Add(this.btSaveRecurrence); 323 this.Controls.Add(this.gbWeekly);324 this.Controls.Add(this.gbDaily);325 this.Controls.Add(this.gbRecurrence);326 282 this.Controls.Add(this.gbAppointment); 327 283 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; … … 330 286 this.gbAppointment.ResumeLayout(false); 331 287 this.gbAppointment.PerformLayout(); 332 this.gbRecurrence.ResumeLayout(false);333 this.gbRecurrence.PerformLayout();334 288 this.gbWeekly.ResumeLayout(false); 335 289 this.gbWeekly.PerformLayout(); 336 this.gbDaily.ResumeLayout(false);337 this.gbDaily.PerformLayout();338 290 this.ResumeLayout(false); 339 291 … … 343 295 344 296 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;348 297 private System.Windows.Forms.TextBox txtDays; 349 298 private System.Windows.Forms.Label label4; 350 private System.Windows.Forms.GroupBox gbDaily;351 299 private System.Windows.Forms.DateTimePicker dtpEnd; 352 300 private System.Windows.Forms.DateTimePicker dtpStart; … … 354 302 private System.Windows.Forms.Label label6; 355 303 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; 356 309 private System.Windows.Forms.GroupBox gbWeekly; 357 310 private System.Windows.Forms.CheckBox cbSunday; … … 362 315 private System.Windows.Forms.CheckBox cbTuesday; 363 316 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;369 317 } 370 318 } -
trunk/sources/HeuristicLab.Hive.Client.Console/Recurrence.cs
r1333 r1511 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 using System.Data;5 using System.Drawing;6 using System.Linq;7 using System.Text;8 3 using System.Windows.Forms; 9 4 10 namespace HeuristicLab.Hive.Client.Console { 11 public partial class Recurrence : Form { 12 public Recurrence() { 5 namespace 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 { 13 21 InitializeComponent(); 14 22 } 15 23 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 { 27 26 this.Close(); 28 27 } 29 28 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>(); 31 35 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); 32 66 } 33 67 34 private void cmbEnd_Click(object sender, EventArgs e) { 68 private HashSet<DayOfWeek> GetDays() 69 { 70 HashSet<DayOfWeek> days = new HashSet<DayOfWeek>(); 35 71 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; 36 88 } 37 89 38 private void dtpToTime_ValueChanged(object sender, EventArgs e) { 90 private bool InputIsValid() 91 { 92 DateTime dateFrom, dateTo; 93 int i = 0; 39 94 40 } 95 dateFrom = DateTime.Parse(dtpStart.Text + " " + dtpFromTime.Text); 96 dateTo = DateTime.Parse(dtpEnd.Text + " " + dtpToTime.Text); 41 97 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; 45 102 } 46 103 }
Note: See TracChangeset
for help on using the changeset viewer.