-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(calendar): Initial import of the CalendarView
- Loading branch information
Showing
116 changed files
with
16,087 additions
and
7,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Page | ||
x:Class="UITests.Windows_UI_Xaml_Controls.CalendarViewTests.CalendarView_Basics" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Windows_UI_Xaml_Controls.CalendarViewTests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Grid> | ||
<CalendarView /> | ||
</Grid> | ||
</Page> |
29 changes: 29 additions & 0 deletions
29
...mplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
using Uno.UI.Samples.Controls; | ||
|
||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace UITests.Windows_UI_Xaml_Controls.CalendarViewTests | ||
{ | ||
[Sample] | ||
public sealed partial class CalendarView_Basics : Page | ||
{ | ||
public CalendarView_Basics() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
|
||
|
||
namespace DirectUI | ||
{ | ||
partial class BudgetManager | ||
{ | ||
private void Initialize() | ||
{ | ||
//bool success = false; | ||
|
||
//success = QueryPerformanceFrequency(&m_freq); | ||
|
||
//return; | ||
} | ||
|
||
private void StoreFrameTime(bool isBeginOfTick) | ||
{ | ||
//bool success = false; | ||
|
||
//if (isBeginOfTick) | ||
//{ | ||
// m_startFrameTime = success = QueryPerformanceCounter(); | ||
//} | ||
//else | ||
//{ | ||
// m_endFrameTime = success = QueryPerformanceCounter(); | ||
//} | ||
|
||
//// does all ARM hardware support this | ||
//global::System.Diagnostics.Debug.Assert(success); | ||
} | ||
|
||
|
||
private void GetElapsedMilliSecondsSinceLastUITickImpl(out int returnValue) | ||
{ | ||
//long lTimeCurrent = default; | ||
//bool success = false; | ||
|
||
//// todo: switch between end and start time based on whether we trust the tick to be accurate | ||
|
||
//success = QueryPerformanceCounter(lTimeCurrent); | ||
|
||
//if (success) | ||
//{ | ||
// double elapsedSeconds = (double)(lTimeCurrent.QuadPart - m_endFrameTime.QuadPart) / (double)(m_freq.QuadPart); | ||
|
||
// returnValue = (int)(elapsedSeconds1000); | ||
//} | ||
//else | ||
//{ | ||
// // hardware that doesn't understand QPC?? Very unlikely, but in this case, let's not crash | ||
// // and just return that no time has elapsed. This will trigger people relying on budget to see that they | ||
// // have a lot of budget and atleast not have them encounter a situation where they do not get to perform | ||
// // certain work. | ||
// returnValue = 0; | ||
//} | ||
|
||
returnValue = default; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// Abstract: | ||
// Represents budgetmanager to keep the uitick times | ||
|
||
#pragma once | ||
|
||
|
||
namespace DirectUI | ||
{ | ||
internal partial class BudgetManager | ||
{ | ||
// The default elapsed time before deferring | ||
private const int BUDGET_MANAGER_DEFAULT_LIMIT = 40; | ||
|
||
long m_freq; | ||
long m_startFrameTime; | ||
long m_endFrameTime; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Linq; | ||
|
||
namespace DirectUI | ||
{ | ||
partial class BudgetManager | ||
{ | ||
public int GetElapsedMilliSecondsSinceLastUITick() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Linq; | ||
|
||
namespace DirectUI | ||
{ | ||
internal class CalendarConstants | ||
{ | ||
internal const long s_ticksPerDay = 864000000000L; // 24 hours, the regular days | ||
internal const long s_ticksPerHour = 36000000000L; // 1 hour for day light saving | ||
internal const long s_maxTicksPerDay = s_ticksPerDay + s_ticksPerHour; | ||
internal const long s_maxTicksPerMonth = 31 * s_ticksPerDay + s_ticksPerHour; | ||
internal const long s_maxTicksPerYear = 366 * s_ticksPerDay + s_ticksPerHour; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace DirectUI | ||
{ | ||
internal enum DMManipulationState | ||
{ | ||
DMManipulationStarting = 1, | ||
DMManipulationStarted = 2, | ||
DMManipulationDelta = 3, | ||
DMManipulationLastDelta = 4, | ||
DMManipulationCompleted = 5, | ||
ConstantVelocityScrollStarted = 6, | ||
ConstantVelocityScrollStopped = 7 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Windows.UI.Core; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
|
||
namespace DirectUI | ||
{ | ||
internal class DXamlCore | ||
{ | ||
private static DXamlCore _current; | ||
private ElementSoundPlayerService _elementSoundPlayerServiceNoRef; | ||
private BuildTreeService _buildTreeService; | ||
private BudgetManager _budgetManager; | ||
|
||
public static DXamlCore GetCurrent() | ||
=> _current ?? new DXamlCore(); | ||
|
||
public static DXamlCore GetCurrentNoCreate() | ||
=> _current ?? new DXamlCore(); | ||
|
||
public string GetLocalizedResourceString(string key) | ||
=> key; | ||
|
||
public ElementSoundPlayerService GetElementSoundPlayerServiceNoRef() | ||
=> _elementSoundPlayerServiceNoRef ??= new ElementSoundPlayerService(); | ||
|
||
public BuildTreeService GetBuildTreeService() | ||
=> _buildTreeService ??= new BuildTreeService(); | ||
|
||
public BudgetManager GetBudgetManager() | ||
=> _budgetManager ??= new BudgetManager(); | ||
} | ||
|
||
internal class BuildTreeService | ||
{ | ||
public void RegisterWork(ITreeBuilder treeBuilder) | ||
{ | ||
treeBuilder.IsRegisteredForCallbacks = true; | ||
CoreDispatcher.Main.RunAsync(CoreDispatcherPriority.High, () => | ||
{ | ||
if (treeBuilder.IsBuildTreeSuspended) | ||
{ | ||
RegisterWork(treeBuilder); | ||
return; | ||
} | ||
var workerHasWorkLeft = treeBuilder.BuildTree(); | ||
if (workerHasWorkLeft) | ||
{ | ||
var workerReRegistered = treeBuilder.IsRegisteredForCallbacks; | ||
if (!workerReRegistered) | ||
{ | ||
RegisterWork(treeBuilder); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
|
||
internal interface ITreeBuilder | ||
{ | ||
public bool IsBuildTreeSuspended { get; } | ||
|
||
public bool IsRegisteredForCallbacks { get; set; } | ||
|
||
public bool BuildTree(); | ||
} | ||
} |
Oops, something went wrong.