|
|
@@ -26,42 +26,6 @@ using SelectionChangedEventArgs = System.Windows.Controls.SelectionChangedEventA
|
|
|
|
|
|
namespace PRSDesktop
|
|
|
{
|
|
|
-
|
|
|
- public class SfScheduler2 : SfScheduler
|
|
|
- {
|
|
|
-
|
|
|
- public static readonly DependencyProperty HeaderVisibilityProperty =
|
|
|
- DependencyProperty.Register(
|
|
|
- nameof(HeaderVisibility),
|
|
|
- typeof(Visibility),
|
|
|
- typeof(SfScheduler2),
|
|
|
- new UIPropertyMetadata(Visibility.Collapsed)
|
|
|
- );
|
|
|
-
|
|
|
- public Visibility HeaderVisibility
|
|
|
- {
|
|
|
- get => (Visibility)GetValue(HeaderVisibilityProperty);
|
|
|
- set
|
|
|
- {
|
|
|
- SetValue(HeaderVisibilityProperty,value);
|
|
|
- SetHeaderVisibility();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void SetHeaderVisibility()
|
|
|
- {
|
|
|
- if (GetTemplateChild("PART_ScheduleHeaderControl") is SchedulerHeaderControl cell)
|
|
|
- cell.Visibility = HeaderVisibility;
|
|
|
- }
|
|
|
-
|
|
|
- public override void OnApplyTemplate()
|
|
|
- {
|
|
|
- base.OnApplyTemplate();
|
|
|
- SetHeaderVisibility();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public partial class Calendar
|
|
|
{
|
|
|
|
|
|
@@ -133,6 +97,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.SettingsVisible = value;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
|
|
|
calendar._splitPanel.View = value == CalendarSettingsVisibility.Visible
|
|
|
@@ -174,6 +139,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.CalendarView = calendar.CalendarView;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
|
|
|
calendar.Refresh();
|
|
|
@@ -204,6 +170,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.EmployeeSelection = calendar.EmployeeSelection;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
|
|
|
calendar.EmployeeSelector.Selection = calendar.EmployeeSelection;
|
|
|
@@ -238,6 +205,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.EmployeeSelector = calendar.EmployeeSettings;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
calendar.EmployeeSelector.Settings = calendar.EmployeeSettings;
|
|
|
}
|
|
|
@@ -280,11 +248,11 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.TimeInterval = calendar.TimeInterval;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
calendar.IntervalSelector.SelectedIndex = (int)calendar.TimeInterval;
|
|
|
|
|
|
calendar.CalendarControl.RowInterval = TimeIntervalToTimeSpan(calendar.TimeInterval);
|
|
|
- calendar.UpdateZoom();
|
|
|
}
|
|
|
|
|
|
private void IntervalSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
@@ -333,6 +301,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.Date = calendar.SelectedDate;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
|
|
|
calendar.Refresh();
|
|
|
@@ -380,10 +349,10 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.StartHour = calendar.StartHour;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
calendar.StartTimeSelector.Text = FormatHour(calendar.StartHour);
|
|
|
calendar.CalendarControl.StartHour = TimeSpan.FromHours(calendar.StartHour);
|
|
|
- calendar.UpdateZoom();
|
|
|
}
|
|
|
|
|
|
private void StartTimeSelector_Down_Click(object sender, RoutedEventArgs e)
|
|
|
@@ -434,10 +403,10 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.EndHour = calendar.EndHour;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
calendar.FinishTimeSelector.Text = FormatHour(calendar.EndHour);
|
|
|
calendar.CalendarControl.EndHour = TimeSpan.FromHours(calendar.EndHour);
|
|
|
- calendar.UpdateZoom();
|
|
|
}
|
|
|
|
|
|
private void FinishTimeSelector_Down_Click(object sender, RoutedEventArgs e)
|
|
|
@@ -490,6 +459,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.AssignmentType = calendar.AssignmentType;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
calendar.AssignmentTypeSelector.SelectedIndex = (int)calendar.AssignmentType;
|
|
|
calendar.Refresh();
|
|
|
@@ -530,6 +500,7 @@ namespace PRSDesktop
|
|
|
if (!EventSuppressor.IsSet(Suppress.Settings))
|
|
|
{
|
|
|
calendar.Properties.BackgroundType = calendar.BackgroundType;
|
|
|
+ calendar.DoSaveSettings();
|
|
|
}
|
|
|
calendar.BackgroundTypeSelector.SelectedIndex = (int)calendar.BackgroundType;
|
|
|
calendar.Refresh();
|
|
|
@@ -552,33 +523,27 @@ namespace PRSDesktop
|
|
|
nameof(Zoom),
|
|
|
typeof(double),
|
|
|
typeof(Calendar),
|
|
|
- new UIPropertyMetadata((double)100F)
|
|
|
+ new UIPropertyMetadata(100.0, Zoom_Changed, Zoom_Coerce)
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
+ private static object Zoom_Coerce(DependencyObject d, object baseValue)
|
|
|
+ {
|
|
|
+ if (baseValue is not double zoom) return baseValue;
|
|
|
+ return Math.Max(zoom, 100.0);
|
|
|
+ }
|
|
|
+
|
|
|
public double Zoom
|
|
|
{
|
|
|
get => (double)GetValue(ZoomProperty);
|
|
|
set => SetValue(ZoomProperty, value);
|
|
|
}
|
|
|
|
|
|
- // private void SetZoom(double value)
|
|
|
- // {
|
|
|
- // DoSetValue(
|
|
|
- // ZoomProperty,
|
|
|
- // value,
|
|
|
- // () => ZoomSelector.Text = $"{value:F0}%",
|
|
|
- // () => UpdateZoom()
|
|
|
- // );
|
|
|
- // }
|
|
|
-
|
|
|
- private void UpdateZoom()
|
|
|
+ private static void Zoom_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
|
{
|
|
|
- // TODO: Remove this method.
|
|
|
+ if (d is not Calendar calendar) return;
|
|
|
|
|
|
- // if (double.IsNaN(ActualHeight) || (ActualHeight == 0.0F))
|
|
|
- // return;
|
|
|
- // var blocksize = (ActualHeight - (Bookings.DaysViewSettings.ViewHeaderHeight + Bookings.DaysViewSettings.ResourceHeaderSize + 2.0F)) / ((EndHour - StartHour) * this.BlocksPerHour(TimeInterval));
|
|
|
- // Calendar.RowHeight = (double)Zoom * blocksize / 100.0F;
|
|
|
+ calendar.CalendarControl.Zoom = calendar.Zoom / 100;
|
|
|
+ calendar.ZoomSelector.Text = $"{calendar.Zoom:F0}%";
|
|
|
}
|
|
|
|
|
|
private void ZoomSelector_Down_Click(object sender, RoutedEventArgs e)
|
|
|
@@ -654,6 +619,7 @@ namespace PRSDesktop
|
|
|
using (EventSuppressor.All<Suppress>())
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
+ _splitPanel.DataContext = this;
|
|
|
|
|
|
StartHour = 0;
|
|
|
EndHour = 24;
|
|
|
@@ -691,7 +657,6 @@ namespace PRSDesktop
|
|
|
|
|
|
var query = new MultiQuery();
|
|
|
|
|
|
- // TODO: check columns
|
|
|
query.Add(
|
|
|
Filter<LeaveRequest>.Where(x =>x.Status).IsNotEqualTo(LeaveRequestStatus.Rejected),
|
|
|
Columns.None<LeaveRequest>()
|
|
|
@@ -742,6 +707,11 @@ namespace PRSDesktop
|
|
|
public virtual void Shutdown(CancelEventArgs? cancel)
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
+ private void DoSaveSettings()
|
|
|
+ {
|
|
|
+ SaveSettings?.Invoke(this, Properties);
|
|
|
+ }
|
|
|
|
|
|
private bool bFirst = true;
|
|
|
|
|
|
@@ -812,6 +782,7 @@ namespace PRSDesktop
|
|
|
|
|
|
try
|
|
|
{
|
|
|
+ CalendarControl.Dates = CoreUtils.Range(startDate, endDate, x => x.AddDays(1));
|
|
|
CalendarControl.ItemsSource = appointments;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
@@ -978,6 +949,10 @@ namespace PRSDesktop
|
|
|
var finish = !timesheet.Approved.IsEmpty()
|
|
|
? timesheet.ApprovedFinish
|
|
|
: timesheet.Finish;
|
|
|
+ if(finish == default)
|
|
|
+ {
|
|
|
+ finish = TimeSpan.FromHours(24);
|
|
|
+ }
|
|
|
regions.Add(new CalendarRegion
|
|
|
{
|
|
|
Date = date,
|
|
|
@@ -1074,59 +1049,6 @@ namespace PRSDesktop
|
|
|
return new AutoDataModel<Assignment>(Filter<Assignment>.Where(x => x.ID).InList(ids));
|
|
|
}
|
|
|
|
|
|
- // private void ResizeIntervals(double height)
|
|
|
- // {
|
|
|
- // if (Bookings.FindVisualChildren<ScrollPanel>().Any())
|
|
|
- // {
|
|
|
- //
|
|
|
- // if (height > 95 && Bookings.DaysViewSettings.EndHour - Bookings.DaysViewSettings.StartHour > 0)
|
|
|
- // {
|
|
|
- // double scrollheight = _employees.Length * 75 > Bookings.ActualWidth ? 15.0F : 0.0F;
|
|
|
- // var header = _employees.Length > 1 ? 93.0F + scrollheight : 50.0F;
|
|
|
- // Bookings.DaysViewSettings.TimeIntervalSize =
|
|
|
- // (height - header) / ((Bookings.DaysViewSettings.EndHour - Bookings.DaysViewSettings.StartHour) * 2.0F);
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // // var scrollers = Bookings.FindVisualChildren<ScrollViewer>().Where(x => string.Equals(x.Name, "PART_TimeSlotScrollViewer")).ToArray();
|
|
|
- // // foreach (var scroll in scrollers)
|
|
|
- // // scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
|
|
|
- //
|
|
|
- // }
|
|
|
-
|
|
|
- // TODO: Shorten employee name if column too small.
|
|
|
-
|
|
|
- // private void ResizeColumns(double width)
|
|
|
- // {
|
|
|
- // if (double.IsNaN(width) || !Bookings.FindVisualChildren<ScrollPanel>().Any())
|
|
|
- // return;
|
|
|
-
|
|
|
- // var maxcount = (int)width / 75;
|
|
|
- // Bookings.DaysViewSettings.VisibleResourceCount = Math.Min(maxcount,
|
|
|
- // _employees.Length * (Bookings.ViewType == SchedulerViewType.Day ? 1 : Bookings.ViewType == SchedulerViewType.WorkWeek ? 5 : 7));
|
|
|
- //
|
|
|
- // if (Bookings.ResourceCollection is ObservableCollection<SchedulerResource> resources)
|
|
|
- // {
|
|
|
- // var colwidth = GetResourceColumnWidth();
|
|
|
- // foreach (var emp in _employees)
|
|
|
- // {
|
|
|
- // var resource = resources.FirstOrDefault(x => String.Equals(x.Id?.ToString(), emp.ID.ToString()));
|
|
|
- // if (resource != null)
|
|
|
- // {
|
|
|
- // var comps = emp.Name.Split(' ');
|
|
|
- // var display = emp.Name;
|
|
|
- // if (colwidth < 75)
|
|
|
- // display = string.Format("{0}{1}", comps[0].Length > 0 ? comps[0][..1] : "",
|
|
|
- // comps.Length > 1 ? comps.Skip(1).First()[..1].ToUpper() : "");
|
|
|
- // else if (colwidth < 150)
|
|
|
- // display = string.Format("{0} {1}", comps.First(),
|
|
|
- // comps.Length > 1 ? comps.Skip(1).First()[..1].ToUpper() : "");
|
|
|
- // resource.Name = display;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
private static T CheckGrid<T>([NotNull] ref T? grid) where T : new()
|
|
|
{
|
|
|
grid ??= new T();
|
|
|
@@ -1135,84 +1057,10 @@ namespace PRSDesktop
|
|
|
|
|
|
private void ReloadColumns()
|
|
|
{
|
|
|
- // var colwidth = GetResourceColumnWidth();
|
|
|
-
|
|
|
CalendarControl.Columns = _employees.OrderBy(x => x.Name);
|
|
|
-
|
|
|
- /*
|
|
|
- var resources = new List<SchedulerResource>();
|
|
|
- foreach (var emp in _employees)
|
|
|
- {
|
|
|
- var comps = emp.Name.Split(' ');
|
|
|
- var display = emp.Name;
|
|
|
- if (colwidth < 75)
|
|
|
- display = CoreUtils.Codify(emp.Name);
|
|
|
- else if (colwidth < 150)
|
|
|
- display = string.Format("{0} {1}", comps.Length > 0 ? comps.First() : "", comps.Length > 1 ? comps.Skip(1).First().Substring(0, 1).ToUpper() : "");
|
|
|
- resources.Add(new SchedulerResource { Name = display, Id = emp.ID.ToString() });
|
|
|
- }
|
|
|
-
|
|
|
- var sorted = new ObservableCollection<SchedulerResource>();
|
|
|
- foreach (var resource in resources.OrderBy(x => x.Name))
|
|
|
- sorted.Add(resource);
|
|
|
- try
|
|
|
- {
|
|
|
- Bookings.DaysViewSettings.ResourceHeaderSize = sorted.Count <= 1 ? 0 : 45;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Logger.Send(LogType.Error, "", string.Format("*** Unknown Error: {0}\n{1}", e.Message, e.StackTrace));
|
|
|
- }
|
|
|
-
|
|
|
- //ResizeIntervals(Bookings.ActualHeight);
|
|
|
- try
|
|
|
- {
|
|
|
- Bookings.ResourceCollection = sorted;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Logger.Send(LogType.Error, "", string.Format("*** Unknown Error: {0}\n{1}", e.Message, e.StackTrace));
|
|
|
- }*/
|
|
|
-
|
|
|
bColumnsLoaded = true;
|
|
|
}
|
|
|
|
|
|
- // private SchedulerResource GetCurrentResource()
|
|
|
- // {
|
|
|
- // var p = Mouse.GetPosition(Bookings);
|
|
|
- // var panels = Bookings.FindVisualChildren<ScrollViewer>().FirstOrDefault(x => string.Equals(x.Name, "PART_ViewHeaderScrollViewer"));
|
|
|
- // var resource = (int)((p.X + panels.HorizontalOffset - (Bookings.DaysViewSettings.TimeRulerSize + 20F)) / GetResourceColumnWidth());
|
|
|
- // return (Bookings.ResourceCollection as Collection<SchedulerResource>)[resource];
|
|
|
- // }
|
|
|
- //
|
|
|
- // private DateTime GetCurrentTime()
|
|
|
- // {
|
|
|
- // var p = Mouse.GetPosition(Bookings);
|
|
|
- // var hours = (p.Y - (_employees.Length > 1 ? 95.0F : 50.0F)) / (Bookings.DaysViewSettings.TimeIntervalSize * 2F) +
|
|
|
- // Bookings.DaysViewSettings.StartHour;
|
|
|
- // var result = Bookings.SelectedDate.Value + TimeSpan.FromHours(hours);
|
|
|
- // return result;
|
|
|
- // }
|
|
|
-
|
|
|
- // private double GetResourceColumnWidth()
|
|
|
- // {
|
|
|
- // var colcount = Math.Max(1, _employees.Length);
|
|
|
- // colcount = colcount * (Bookings.ViewType == SchedulerViewType.Day ? 1 : Bookings.ViewType == SchedulerViewType.Day ? 5 : 7);
|
|
|
- // var colwidth = Bookings.ActualWidth / colcount;
|
|
|
- // var minwidth = (Bookings.ActualWidth - (Bookings.DaysViewSettings.TimeRulerSize + 20F)) / Bookings.DaysViewSettings.VisibleResourceCount;
|
|
|
- // return Math.Max(minwidth, colwidth);
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
- // private void Schedule_AppointmentEditorOpening(object sender, AppointmentEditorOpeningEventArgs e)
|
|
|
- // {
|
|
|
- // e.Cancel = true;
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
- //private Dictionary<CalendarMenuName, MenuItem> _menuitems = new Dictionary<CalendarMenuName, MenuItem>();
|
|
|
-
|
|
|
-
|
|
|
private void Calendar_BlockHeld(object sender, CalendarBlockEventArgs e)
|
|
|
{
|
|
|
Calendar_BlockRightClicked(sender, e);
|
|
|
@@ -1254,7 +1102,7 @@ namespace PRSDesktop
|
|
|
e.Menu.AddItem("Zoom Out", null, ZoomOut);
|
|
|
e.Menu.AddItem("Reset Zoom", null, ResetZoom);
|
|
|
|
|
|
- CustomiseContextMenu?.Invoke(e.Menu, new CalendarDataEventArgs<Assignment>(appointment.Model));
|
|
|
+ CustomiseContextMenu?.Invoke(e.Menu, new CalendarDataEventArgs(appointment.Model));
|
|
|
}
|
|
|
else if(e.Value is null)
|
|
|
{
|
|
|
@@ -1277,7 +1125,7 @@ namespace PRSDesktop
|
|
|
e.Menu.AddItem("Zoom Out", null, ZoomOut);
|
|
|
e.Menu.AddItem("Reset Zoom", null, ResetZoom);
|
|
|
|
|
|
- CustomiseContextMenu?.Invoke(e.Menu, new CalendarDataEventArgs<CalendarTimeSlot>(slot));
|
|
|
+ CustomiseContextMenu?.Invoke(e.Menu, new CalendarDataEventArgs(slot));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1301,7 +1149,7 @@ namespace PRSDesktop
|
|
|
meeting.Time.Start = slot.Start;
|
|
|
meeting.Time.Finish = slot.End;
|
|
|
|
|
|
- ItemCreated?.Invoke(this, new CalendarDataEventArgs<Meeting>(meeting));
|
|
|
+ ItemCreated?.Invoke(this, new CalendarDataEventArgs(meeting));
|
|
|
|
|
|
var args = new CalendarHandledEventArgs<Meeting>(meeting);
|
|
|
ItemEditing?.Invoke(this, args);
|
|
|
@@ -1354,7 +1202,7 @@ namespace PRSDesktop
|
|
|
|
|
|
if (DynamicGridUtils.EditEntity<Meeting>(model.Meeting.Link.ID, out var meeting))
|
|
|
{
|
|
|
- ItemChanged?.Invoke(this, new CalendarDataEventArgs<Meeting>(meeting));
|
|
|
+ ItemChanged?.Invoke(this, new CalendarDataEventArgs(meeting));
|
|
|
Refresh();
|
|
|
}
|
|
|
}
|
|
|
@@ -1366,9 +1214,9 @@ namespace PRSDesktop
|
|
|
|
|
|
var meeting = new Meeting { ID = model.Meeting.Link.ID };
|
|
|
Client.Delete(meeting, "Meeting Deleted from Scheduler");
|
|
|
- ItemChanged?.Invoke(this, new CalendarDataEventArgs<Meeting>(meeting));
|
|
|
+ ItemChanged?.Invoke(this, new CalendarDataEventArgs(meeting));
|
|
|
Refresh();
|
|
|
- SelectionChanged?.Invoke(this, new CalendarDataEventArgs<Meeting>(null));
|
|
|
+ SelectionChanged?.Invoke(this, new CalendarDataEventArgs(null));
|
|
|
}
|
|
|
|
|
|
public Assignment? CreateAssignment(CalendarTimeSlot slot)
|
|
|
@@ -1388,7 +1236,7 @@ namespace PRSDesktop
|
|
|
|
|
|
ass.EmployeeLink.ID = slot.EmployeeID;
|
|
|
|
|
|
- ItemCreated?.Invoke(this, new CalendarDataEventArgs<Assignment>(ass));
|
|
|
+ ItemCreated?.Invoke(this, new CalendarDataEventArgs(ass));
|
|
|
|
|
|
var args = new CalendarHandledEventArgs<Assignment>(ass);
|
|
|
ItemEditing?.Invoke(this, args);
|
|
|
@@ -1413,11 +1261,12 @@ namespace PRSDesktop
|
|
|
private void EditAssignment(Assignment model)
|
|
|
{
|
|
|
var grid = CheckGrid(ref ag);
|
|
|
+ Client.EnsureColumns(model, grid.LoadEditorColumns());
|
|
|
|
|
|
- if (DynamicGridUtils.EditEntity<Assignment>(model.ID, out var ass))
|
|
|
+ if (DynamicGridUtils.EditEntity<Assignment>(model))
|
|
|
{
|
|
|
- ItemChanged?.Invoke(this, new CalendarDataEventArgs<Assignment>(ass));
|
|
|
- Refresh();
|
|
|
+ ItemChanged?.Invoke(this, new CalendarDataEventArgs(model));
|
|
|
+ // Refresh();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1428,9 +1277,9 @@ namespace PRSDesktop
|
|
|
|
|
|
var ass = new Assignment { ID = model.ID };
|
|
|
Client.Delete(ass, "Assignment Deleted from Scheduler");
|
|
|
- ItemChanged?.Invoke(this, new CalendarDataEventArgs<Assignment>(ass));
|
|
|
+ ItemChanged?.Invoke(this, new CalendarDataEventArgs(ass));
|
|
|
Refresh();
|
|
|
- SelectionChanged?.Invoke(this, new CalendarDataEventArgs<Assignment>(null));
|
|
|
+ SelectionChanged?.Invoke(this, new CalendarDataEventArgs(null));
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1472,21 +1321,14 @@ namespace PRSDesktop
|
|
|
{
|
|
|
if(e.Value is AssignmentAppointment appointment)
|
|
|
{
|
|
|
- var args = new CalendarDataEventArgs<Assignment>(appointment.Model);
|
|
|
+ var args = new CalendarDataEventArgs(appointment.Model);
|
|
|
SelectionChanged?.Invoke(this, args);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SelectionChanged?.Invoke(this, new CalendarDataEventArgs<Assignment>(null));
|
|
|
+ SelectionChanged?.Invoke(this, new CalendarDataEventArgs(null));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private void Calendar_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
- {
|
|
|
- if (double.IsNaN(this.ActualHeight) || (this.ActualHeight == 0))
|
|
|
- return;
|
|
|
- UpdateZoom();
|
|
|
- }
|
|
|
|
|
|
private void _settingsButton_OnClick(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
@@ -1508,7 +1350,7 @@ namespace PRSDesktop
|
|
|
if (EventSuppressor.IsSet(Suppress.Events)) return;
|
|
|
|
|
|
Properties.AlwaysStartOnToday = AlwaysTodayBox.IsChecked == true;
|
|
|
- SaveSettings?.Invoke(this, Properties);
|
|
|
+ DoSaveSettings();
|
|
|
}
|
|
|
|
|
|
private void TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
@@ -1529,5 +1371,30 @@ namespace PRSDesktop
|
|
|
}
|
|
|
block.Text = display;
|
|
|
}
|
|
|
+
|
|
|
+ private void Left_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ SelectedDate = SelectedDate.AddDays(CalendarView switch
|
|
|
+ {
|
|
|
+ CalendarViewType.Day => -1,
|
|
|
+ CalendarViewType.WorkWeek or CalendarViewType.Week => -7,
|
|
|
+ _ => throw new InvalidEnumException<CalendarViewType>(CalendarView)
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Right_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ SelectedDate = SelectedDate.AddDays(CalendarView switch
|
|
|
+ {
|
|
|
+ CalendarViewType.Day => 1,
|
|
|
+ CalendarViewType.WorkWeek or CalendarViewType.Week => 7,
|
|
|
+ _ => throw new InvalidEnumException<CalendarViewType>(CalendarView)
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Today_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ SelectedDate = DateTime.Today;
|
|
|
+ }
|
|
|
}
|
|
|
}
|