This file contains hidden or 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
| internal class Typografie | |
| { | |
| public Typografie() | |
| { | |
| } | |
| public static void HledejMezery(string s, ref List<int> indexy) | |
| { | |
| indexy.Clear(); | |
| s = Typografie.SmazSpecialniJazyky(s); |
This file contains hidden or 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
| try | |
| { | |
| var res = await _connectedTCS.Task; | |
| if (res.Result) | |
| { | |
| var res2 = await _userStatusTCS.Task; | |
| if (res2.Result) | |
| { | |
| var res3 = await _profileTCS.Task; | |
| if (res3.Result) |
This file contains hidden or 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
| var result = await _connectedTCS.Task.FailOnCancel() | |
| .OnSuccess(async () => await _userStatusTCS.Task.FailOnCancel()) | |
| .OnSuccess(async () => await _profileTCS.Task.FailOnCancel()); | |
| result.OnSuccess(() => | |
| { | |
| Log.Info("Connecting to the Gateway successful"); | |
| connectedSuccessfully = true; | |
| RootNode = _profileTCS.Task.Result.Value; | |
| connectedEvent.Set(); |
This file contains hidden or 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
| private async Task<Result<T>> Send<T>(string urlSuffix, Func<HttpContent, T> responseParser) | |
| { | |
| try | |
| { | |
| var answer = await SendInternal(urlSuffix); | |
| if (answer.IsSuccessStatusCode) | |
| { | |
| return Result.Ok(responseParser(answer.Content)); | |
| } | |
| else |
This file contains hidden or 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
| public bool Start() | |
| { | |
| Gateway = new GatewayConnection(IPAddress, Port, UserName, Password, AppId); | |
| var connectedEvent = new ManualResetEvent(false); | |
| var cancel = new CancellationTokenSource(); | |
| var connectedSuccessfully = false; | |
| var rootNode = default(SiteNode); | |
| var connectedTCS = new TaskCompletionSource<Result>(cancel); |
This file contains hidden or 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
| Task.Factory.StartNew(async () => | |
| { | |
| try | |
| { | |
| var res = await connectedTCS.Task; | |
| if (res.IsFailure) | |
| { | |
| DeviceEvent.AuthenticationFailure(this); | |
| connectedEvent.Set(); | |
| return; |
This file contains hidden or 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
| static State Request(this State state, Transition transition) => | |
| (state, transition) match | |
| ( | |
| case (State.Running, Transition.Suspend): State.Suspended | |
| case (State.Suspended, Transition.Resume): State.Running | |
| case (State.Suspended, Transition.Terminate): State.NotRunning | |
| case (State.NotRunning, Transition.Activate): State.Running | |
| case *: throw new InvalidOperationException() | |
| ); |
This file contains hidden or 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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.Windows; | |
| using System.Windows.Controls; | |
| using System.Windows.Input; | |
| namespace WpfTest |
This file contains hidden or 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
| public static async Task ChangeViewAsync(this ScrollViewer scrollViewer, double? horizontalOffset, double? verticalOffset, bool disableAnimation) | |
| { | |
| var tcs = new TaskCompletionSource<object>(); | |
| EventHandler<ScrollViewerViewChangedEventArgs> viewChanged = (s, e) => tcs.TrySetResult(null); | |
| try | |
| { | |
| scrollViewer.ViewChanged += viewChanged; | |
| scrollViewer.ChangeView(horizontalOffset, verticalOffset, null, disableAnimation); | |
| await tcs.Task; |
This file contains hidden or 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
| protected override void OnNavigatedTo(NavigationEventArgs e) | |
| { | |
| base.OnNavigatedTo(e); | |
| InputPane.GetForCurrentView().Showing += OnKeyboardShowing; | |
| InputPane.GetForCurrentView().Hiding += OnKeyboardHiding; | |
| } | |
| protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) | |
| { |