Example #1
0
 private void pathSelectorControl4_PathChanged(object sender, EventArgs e)
 {
     try {
         DialogEx.Show(this, SystemIconType.None, "Result", pathSelectorControl4.Path, "OK");
     } catch (Exception error) {
         ExceptionDialog.Show(this, error);
     }
 }
Example #2
0
 private void _genOnlyButton_Click(object sender, EventArgs e)
 {
     try {
         _standardTextBox.Clear();
         var  start   = DateTime.Now;
         long genSize = 0;
         while (genSize < 1000000)
         {
             var randomString = Tools.Text.GenerateRandomString(50) + Environment.NewLine;
             genSize += randomString.Length * sizeof(char);
         }
         DialogEx.Show(this, SystemIconType.Information, "Results", "{0} bytes took {1} seconds".FormatWith(genSize, DateTime.Now.Subtract(start).TotalSeconds));
     } catch (Exception error) {
         ExceptionDialog.Show(error);
     }
 }
Example #3
0
        internal void FireAppointmentResizingFinished()
        {
            try {
                _resizing = false;
                var appointment = ViewModel.GetAppointmentBlockAt(_resizingStart.Item1, _resizingStart.Item2);
                Debug.Assert(appointment != null);
                Debug.Assert(_resizingStart.Item1 == _resizingEnd.Item1);
                var column = ViewModel.GetColumnAt(_resizingStart.Item1);
                int minRow, maxRow;
                switch (_resizingBorder)
                {
                case ResizedAppointmentBorder.Top:
                    minRow = _resizingEnd.Item2;
                    maxRow = appointment.EndRow;
                    break;

                case ResizedAppointmentBorder.Bottom:
                    minRow = appointment.StartRow;
                    maxRow = _resizingEnd.Item2;
                    break;

                default:
                    return;
                }

                var    newStartTime = ViewModel.RowToStartTime(minRow);
                var    newEndTime   = ViewModel.RowToEndTime(maxRow);
                string errorMessage;
                bool   resizeAccepted = OnAppointmentRescheduled(column.ColumnDataObject, appointment.AppointmentDataObject, newStartTime, newEndTime, out errorMessage);
                if (!resizeAccepted)
                {
                    DialogEx.Show(SystemIconType.Error, "Scheduling Error", errorMessage ?? "Unable to reschedule appointment", "OK");
                }
                else
                {
                    if (AppointmentResizingFinished != null)
                    {
                        foreach (EventHandlerEx <AppointmentResizingFinishedEvent> handler in AppointmentResizingFinished.GetInvocationList())
                        {
                            var eventArgs = new AppointmentResizingFinishedEvent {
                                Source            = this,
                                SourceColumn      = column.ColumnDataObject,
                                Appointment       = appointment.AppointmentDataObject,
                                SelectedStartTime = newStartTime,
                                SelectedEndTime   = newEndTime,
                            };
                            handler.Invoke(eventArgs);
                            resizeAccepted = !eventArgs.Cancel;
                            if (!resizeAccepted)
                            {
                                DialogEx.Show(SystemIconType.Error, "Scheduling Error", errorMessage ?? "Unable to reschedule appointment", "OK");
                                ClearSelection();
                                break;
                            }
                        }
                    }
                }

                if (resizeAccepted)
                {
                    RescheduleAppointment(appointment.AppointmentDataObject, column.ColumnDataObject, column.ColumnDataObject, newStartTime, newEndTime);
                }
            } catch (Exception error) {
                ExceptionDialog.Show(this, error);
            }
        }