Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/29/09 12:16:28 (15 years ago)
Author:
whackl
Message:

#663 Refactor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Console/3.2/HiveClientConsole.cs

    r1930 r1943  
    6868    {
    6969      InitializeComponent();
    70       //lvwColumnSorter = new ListViewColumnSorterDate();
    71       //lvLog.ListViewItemSorter = lvwColumnSorter;
    72       //lvwColumnSorter.SortColumn = 3;
    73       //lvwColumnSorter.Order = SortOrder.Descending;
    7470      InitTimer();
    7571      ConnectToClient();
    7672      RefreshGui();
    77       //GetEventLog();
    7873      InitCalender();
    7974      InitLogFileReader();
    8075    }
    8176
     77    #endregion
     78
     79    #region Methods
     80
    8281    private void InitLogFileReader() {
    83       //lo = new Tail(this.tailFilenameTextbox.Text);
    84       //myTail.MoreData += new Tail.MoreDataHandler(myTail_MoreData);
    85       //myTail.Start();
    86       //MessageBox.Show(Environment.CurrentDirectory);
    87       logFileReader = new LogFileReader(Environment.CurrentDirectory + @"/HiveLog.log");
     82      logFileReader = new LogFileReader(Environment.CurrentDirectory + @"/Hive.log");
    8883      logFileReader.MoreData += new LogFileReader.MoreDataHandler(logFileReader_MoreData);
    8984      logFileReader.Start();
     
    10297      AppendText(newData);
    10398    }
    104 
    105     #endregion
    106 
    107     #region Methods
    10899
    109100    private void InitTimer()
     
    147138          this.Close();
    148139      }
    149     }
    150 
    151     //private void GetEventLog()
    152     //{
    153     //  HiveClientEventLog = new EventLog(EVENTLOGNAME);
    154     //  HiveClientEventLog.Source = EVENTLOGNAME;
    155     //  HiveClientEventLog.EntryWritten += new EntryWrittenEventHandler(OnEntryWritten);
    156     //  HiveClientEventLog.EnableRaisingEvents = true;
    157 
    158     //  ListViewItem curEventLogEntry;
    159 
    160     //  //databinding on listview?
    161     //  if (HiveClientEventLog != null && HiveClientEventLog.Entries != null)
    162     //  {
    163     //    foreach (EventLogEntry ele in HiveClientEventLog.Entries)
    164     //    {
    165     //      curEventLogEntry = GenerateEventEntry(ele);
    166     //      lvLog.Items.Add(curEventLogEntry);
    167     //    }
    168     //    lvJobDetail.Sort();
    169     //  }
    170     //}
    171 
    172     private ListViewItem GenerateEventEntry(EventLogEntry ele)
    173     {
    174       ListViewItem curEventLogEntry;
    175       curEventLogEntry = new ListViewItem("", 0);
    176       if (ele.EntryType == EventLogEntryType.Error)
    177         curEventLogEntry = new ListViewItem("", 1);
    178       curEventLogEntry.SubItems.Add(ele.InstanceId.ToString());
    179       curEventLogEntry.SubItems.Add(ele.Message);
    180       curEventLogEntry.SubItems.Add(ele.TimeGenerated.ToString());
    181       return curEventLogEntry;
    182140    }
    183141
     
    376334    }
    377335
    378     public void OnEntryWritten(object source, EntryWrittenEventArgs e)
    379     {
    380       //UpdateText(e.Entry);
    381     }
    382 
    383     //private void lvLog_DoubleClick(object sender, EventArgs e)
    384     //{
    385     //  ListViewItem lvi = lvLog.SelectedItems[0];
    386     //  HiveEventEntry hee = new HiveEventEntry(lvi.SubItems[2].Text, lvi.SubItems[3].Text, lvi.SubItems[1].Text);
    387 
    388     //  Form EventlogDetails = new EventLogEntryForm(hee);
    389     //  EventlogDetails.Show();
    390     //}
    391 
    392336    private void btConnect_Click(object sender, EventArgs e)
    393337    {
     
    411355      cccc.DisconnectAsync();
    412356    }
    413 
    414     //private void lvLog_ColumnClick(object sender, ColumnClickEventArgs e)
    415     //{
    416     //  // Determine if clicked column is already the column that is being sorted.
    417     //  if (e.Column == lvwColumnSorter.SortColumn)
    418     //  {
    419     //    // Reverse the current sort direction for this column.
    420     //    if (lvwColumnSorter.Order == SortOrder.Ascending)
    421     //    {
    422     //      lvwColumnSorter.Order = SortOrder.Descending;
    423     //    }
    424     //    else
    425     //    {
    426     //      lvwColumnSorter.Order = SortOrder.Ascending;
    427     //    }
    428     //  }
    429     //  else
    430     //  {
    431     //    // Set the column number that is to be sorted; default to ascending.
    432     //    lvwColumnSorter.SortColumn = e.Column;
    433     //    lvwColumnSorter.Order = SortOrder.Ascending;
    434     //  }
    435 
    436     //  // Perform the sort with these new sort options.
    437     //  //lvLog.Sort();
    438     //}
    439357
    440358    private void btn_clientShutdown_Click(object sender, EventArgs e)
     
    475393    private void dvOnline_OnSelectionChanged(object sender, EventArgs e)
    476394    {
     395      btCreate.Enabled = true;
    477396      if (dvOnline.Selection == SelectionType.DateRange)
    478397      {
     
    493412        txttimeTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortTimeString();
    494413
     414        if (dvOnline.SelectedAppointment.Recurring)
     415          btCreate.Enabled = false;
    495416        //also change the caption of the save button
    496417        btCreate.Text = "Save changes";
     
    594515    {
    595516      List<Appointment> recurringAppointments = onlineTimes.Where(appointment => appointment.RecurringId == recurringId).ToList();
    596       recurringAppointments.ForEach(appointment => appointment.StartDate = DateTime.Parse(appointment.StartDate.Date + " " + txttimeFrom.Text));
    597       recurringAppointments.ForEach(appointment => appointment.EndDate = DateTime.Parse(appointment.EndDate.Date + " " + txttimeTo.Text));
     517      recurringAppointments.ForEach(appointment => appointment.StartDate = DateTime.Parse(appointment.StartDate.Date.ToString() + " " + txttimeFrom.Text));
     518      recurringAppointments.ForEach(appointment => appointment.EndDate = DateTime.Parse(appointment.EndDate.Date.ToString() + " " + txttimeTo.Text));
    598519
    599520      DeleteRecurringAppointment(recurringId);
     
    634555    }
    635556
    636     #endregion
    637 
    638     private void CreateDailyRecurrenceAppointments(DateTime dateFrom, DateTime dateTo, bool allDay, int incWeek, HashSet<DayOfWeek> daysOfWeek)
    639     {
     557    private void CreateDailyRecurrenceAppointments(DateTime dateFrom, DateTime dateTo, bool allDay, int incWeek, HashSet<DayOfWeek> daysOfWeek) {
    640558      DateTime incDate = dateFrom;
    641559      Guid guid = Guid.NewGuid();
    642560
    643       while (incDate.Date <= dateTo.Date)
    644       {
     561      while (incDate.Date <= dateTo.Date) {
    645562        if (daysOfWeek.Contains(incDate.Date.DayOfWeek))
    646563          onlineTimes.Add(CreateAppointment(incDate, new DateTime(incDate.Year, incDate.Month, incDate.Day, dateTo.Hour, dateTo.Minute, 0), allDay, true, guid));
     
    651568    }
    652569
    653     private void lvLog_SelectedIndexChanged(object sender, EventArgs e) {
    654 
    655     }
     570    #endregion
     571
    656572  }
    657573}
Note: See TracChangeset for help on using the changeset viewer.