/// <summary> /// Application Services after the launch. /// </summary> /// <returns></returns> private async Task PostLaunchAsync(LaunchActivatedEventArgs e) { CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false; await Task.CompletedTask; }
static void Main(string[] args) { var app = new App(); CoreApplication.Run(app); }
public InitializationOptions(CoreApplication application, bool useDeviceIndependentPixel, HandlerAttribute[] handlers) { Context = application; UseDeviceIndependentPixel = useDeviceIndependentPixel; Handlers = handlers; }
static void Main() => CoreApplication.Run(new UrhoAppViewSource <CognitiveServicesApp>());
private async Task DoRestartRequest() { await CoreApplication.RequestRestartAsync(string.Empty); }
private void OnShutDownCommandExecute() { CoreApplication.Exit(); }
private void CloseApplication() { CoreApplication.Exit(); }
public static void Init(CoreApplication application) { Init(application, false); }
public static void Init(CoreApplication application, bool useDeviceIndependentPixel) { _useDeviceIndependentPixel = useDeviceIndependentPixel; SetupInit(application, null); }
private void TryEnablePrelaunch() { CoreApplication.EnablePrelaunch(true); }
/// <summary> /// Call this method in Unity App Thread can switch to Plan View, create and show a new Xaml View. /// </summary> /// <typeparam name="TReturnValue"></typeparam> /// <param name="xamlPageName"></param> /// <param name="callback"></param> /// <returns></returns> public IEnumerator OnLaunchXamlView <TReturnValue>(string xamlPageName, Action <TReturnValue> callback, object pageNavigateParameter = null) { bool isCompleted = false; #if WINDOWS_UWP object returnValue = null; CoreApplicationView newView = CoreApplication.CreateNewView(); int newViewId = 0; var dispt = newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { //This happens when User switch view back to Main App manually void CoreWindow_VisibilityChanged(CoreWindow sender, VisibilityChangedEventArgs args) { if (args.Visible == false) { CallbackReturnValue(null); } } newView.CoreWindow.VisibilityChanged += CoreWindow_VisibilityChanged; Frame frame = new Frame(); var pageType = Type.GetType(Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName.Replace(".App,", $".{xamlPageName},")); var appv = ApplicationView.GetForCurrentView(); newViewId = appv.Id; var cb = new Action <object>(rval => { returnValue = rval; isCompleted = true; }); frame.Navigate(pageType, pageNavigateParameter); CallbackDictionary[newViewId] = cb; Window.Current.Content = frame; Window.Current.Activate(); }).AsTask(); yield return(new WaitUntil(() => dispt.IsCompleted || dispt.IsCanceled || dispt.IsFaulted)); Task viewShownTask = null; UnityEngine.WSA.Application.InvokeOnUIThread( () => { viewShownTask = ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId).AsTask(); }, true); yield return(new WaitUntil(() => viewShownTask.IsCompleted || viewShownTask.IsCanceled || viewShownTask.IsFaulted)); yield return(new WaitUntil(() => isCompleted)); try { if (returnValue is TReturnValue) { callback?.Invoke((TReturnValue)returnValue); } else { callback?.Invoke(default(TReturnValue)); } } catch (Exception ex) { Debug.LogError(ex); } #else isCompleted = true; yield return(new WaitUntil(() => isCompleted)); #endif }
public IsShowWithSecondaryViewTrigger() { var coreApplication = CoreApplication.GetCurrentView(); SetActive(!coreApplication.IsMain); }
public async Task Run(AppointmentsProviderRemoveAppointmentActivatedEventArgs args, Frame frame) { var payload = new RemoveAppointmentPayload(args.RemoveAppointmentOperation); int currentApplicationViewId = ApplicationView.GetApplicationViewIdForWindow(CoreApplication.GetCurrentView().CoreWindow); var viewConfig = new MultiViewConfiguration <RemoveAppointmentPayload>(View, (p) => true); await viewConfig.Show(payload, currentApplicationViewId, frame); }
static void Main() { CoreApplication.Run(new FrameworkViewSource()); }
private static void Main() { var exclusiveViewApplicationSource = new AppViewSource(); CoreApplication.Run(exclusiveViewApplicationSource); }
static void SetupInit(CoreApplication application, InitializationOptions?maybeOptions = null) { Context = application; if (!IsInitialized) { Internals.Log.Listeners.Add(new XamarinLogListener()); if (System.Threading.SynchronizationContext.Current == null) { TizenSynchronizationContext.Initialize(); } Elementary.Initialize(); Elementary.ThemeOverlay(); } Device.PlatformServices = new TizenPlatformServices(); if (Device.info != null) { ((TizenDeviceInfo)Device.info).Dispose(); Device.info = null; } Device.Info = new Forms.TizenDeviceInfo(); Device.SetFlags(s_flags); if (!Forms.IsInitialized) { if (maybeOptions.HasValue) { var options = maybeOptions.Value; var handlers = options.Handlers; var flags = options.Flags; var effectScopes = options.EffectScopes; _useDeviceIndependentPixel = options.UseDeviceIndependentPixel; // renderers if (handlers != null) { Registrar.RegisterRenderers(handlers); } // effects if (effectScopes != null) { for (var i = 0; i < effectScopes.Length; i++) { var effectScope = effectScopes[0]; Registrar.RegisterEffects(effectScope.Name, effectScope.Effects); } } // css var noCss = (flags & InitializationFlags.DisableCss) != 0; if (!noCss) { Registrar.RegisterStylesheets(); } } else { // In .NETCore, AppDomain feature is not supported. // The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually. // The assembly of the executing application and referenced assemblies of it are added into the list here. TizenPlatformServices.AppDomain.CurrentDomain.RegisterAssemblyRecursively(application.GetType().GetTypeInfo().Assembly); Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute) }); } } string profile = ((TizenDeviceInfo)Device.Info).Profile; if (profile == "mobile") { Device.SetIdiom(TargetIdiom.Phone); } else if (profile == "tv") { Device.SetIdiom(TargetIdiom.TV); } else if (profile == "desktop") { Device.SetIdiom(TargetIdiom.Desktop); } else if (profile == "wearable") { Device.SetIdiom(TargetIdiom.Watch); } else { Device.SetIdiom(TargetIdiom.Unsupported); } Color.SetAccent(GetAccentColor(profile)); ExpressionSearch.Default = new TizenExpressionSearch(); IsInitialized = true; }
private void FlipExtendViewIntoTitleBar_Click(object sender, RoutedEventArgs e) { var coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = !coreTitleBar.ExtendViewIntoTitleBar; }
private async void WindowsPage_Loaded(object sender, RoutedEventArgs e) { #region App Title Bar // Hide default title bar. var coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; UpdateTitleBarLayout(coreTitleBar); // Set XAML element as a draggable region. Window.Current.SetTitleBar(AppTitleBar); // Register a handler for when the size of the overlaid caption control changes. // For example, when the app moves to a screen with a different DPI. coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged; // Register a handler for when the title bar visibility changes. // For example, when the title bar is invoked in full screen mode. coreTitleBar.IsVisibleChanged += CoreTitleBar_IsVisibleChanged; #endregion Log.Debug("[WindowsPage_Loaded] Intialize ..."); LoadingRing.IsActive = true; LoadingFrame.Visibility = Visibility.Visible; WindowsGrid.Visibility = Visibility.Visible; WindowsGrid1.Visibility = Visibility.Collapsed; WindowsFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); WindowsFrame1.Navigate(typeof(SettingsPage), false, new SuppressNavigationTransitionInfo()); LoadEULASettings(); LoadTutorialDone(); await Task.Delay(3000); LoadingFrame.Visibility = Visibility.Collapsed; LoadingRing.IsActive = false; WindowsGrid.Visibility = Visibility.Collapsed; WindowsGrid1.Visibility = Visibility.Collapsed; #region Show EULA page await(new ServiceViewModel()).Sendupdatestatus("ASUSSYS"); if (ServiceViewModel.returnnum == 1)//ASUS SYS { WindowsGrid.Visibility = Visibility.Visible; WindowsGrid1.Visibility = Visibility.Collapsed; if (!TutorialDoneOrNot) { TutorialDialog td = new TutorialDialog(); await td.ShowAsync(); } } else//Other SYS show EULA page { WindowsGrid.Visibility = Visibility.Visible; WindowsGrid1.Visibility = Visibility.Collapsed; if (!EulaAgreeOrNot) { EULADialog ed = new EULADialog(); await ed.ShowAsync(); } else if (!TutorialDoneOrNot) { TutorialDialog td = new TutorialDialog(); await td.ShowAsync(); } } #endregion }
static void Main() { var appViewSource = new UrhoAppViewSource <MainApplication>(new ApplicationOptions("Data")); CoreApplication.Run(appViewSource); }
public void Exit() { CoreApplication.Exit(); }
/// <summary> /// Disposes the page, shuts down the brain and exits the application. /// </summary> public void Dispose() { brain.Dispose(); CoreApplication.Exit(); }
private async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args) { var deferral = args.GetDeferral(); var message = args.Request.Message; try { if (message.ContainsKey("caption") && message.ContainsKey("request")) { var caption = message["caption"] as string; var buffer = message["request"] as string; var req = TLSerializationService.Current.Deserialize(buffer); if (caption.Equals("voip.getUser") && req is TLPeerUser userPeer) { var user = InMemoryCacheService.Current.GetUser(userPeer.UserId); if (user != null) { await args.Request.SendResponseAsync(new ValueSet { { "result", TLSerializationService.Current.Serialize(user) } }); } else { //await args.Request.SendResponseAsync(new ValueSet { { "error", TLSerializationService.Current.Serialize(new TLRPCError { ErrorMessage = "USER_NOT_FOUND", ErrorCode = 404 }) } }); } } else if (caption.Equals("voip.getConfig")) { var config = InMemoryCacheService.Current.GetConfig(); await args.Request.SendResponseAsync(new ValueSet { { "result", TLSerializationService.Current.Serialize(config) } }); } else if (caption.Equals("voip.callInfo") && req is byte[] data) { using (var from = TLObjectSerializer.CreateReader(data.AsBuffer())) { var tupleBase = new TLTuple <int, TLPhoneCallBase, TLUserBase, string>(from); var tuple = new TLTuple <TLPhoneCallState, TLPhoneCallBase, TLUserBase, string>((TLPhoneCallState)tupleBase.Item1, tupleBase.Item2, tupleBase.Item3, tupleBase.Item4); if (tuple.Item2 is TLPhoneCallDiscarded) { if (_phoneView != null) { var newView = _phoneView; _phoneViewExists = false; _phoneView = null; await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { newView.SetCall(tuple); newView.Dispose(); if (newView.Dialog != null) { newView.Dialog.Hide(); } else { Window.Current.Close(); } }); } return; } if (_phoneViewExists == false) { VoIPCallTask.Log("Creating VoIP UI", "Creating VoIP UI"); _phoneViewExists = true; await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { if (ApplicationView.GetForCurrentView().IsCompactOverlaySupported()) { var newView = CoreApplication.CreateNewView(); var newViewId = 0; await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var newPlayer = new PhoneCallPage(true); Window.Current.Content = newPlayer; Window.Current.Activate(); newViewId = ApplicationView.GetForCurrentView().Id; newPlayer.Dialog = null; newPlayer.SetCall(tuple); _phoneView = newPlayer; }); var preferences = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay); preferences.CustomSize = new Size(340, 200); var viewShown = await ApplicationViewSwitcher.TryShowAsViewModeAsync(newViewId, ApplicationViewMode.CompactOverlay, preferences); } else { var dialog = new ContentDialogBase(); dialog.VerticalAlignment = VerticalAlignment.Stretch; dialog.HorizontalAlignment = HorizontalAlignment.Stretch; var newPlayer = new PhoneCallPage(false); newPlayer.Dialog = dialog; newPlayer.SetCall(tuple); _phoneView = newPlayer; dialog.Content = newPlayer; await dialog.ShowAsync(); } }); } else if (_phoneView != null) { VoIPCallTask.Log("VoIP UI already exists", "VoIP UI already exists"); await _phoneView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _phoneView.SetCall(tuple); }); } } } else if (caption.Equals("voip.signalBars") && req is byte[] data2) { using (var from = TLObjectSerializer.CreateReader(data2.AsBuffer())) { var tuple = new TLTuple <int>(from); if (_phoneView != null) { await _phoneView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _phoneView.SetSignalBars(tuple.Item1); }); } } } else if (caption.Equals("voip.setCallRating") && req is TLInputPhoneCall peer) { Execute.BeginOnUIThread(async() => { var dialog = new PhoneCallRatingView(); var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { await MTProtoService.Current.SetCallRatingAsync(peer, dialog.Rating, dialog.Rating >= 0 && dialog.Rating <= 3 ? dialog.Comment : null); } }); } else { var response = await MTProtoService.Current.SendRequestAsync <object>(caption, req as TLObject); if (response.IsSucceeded) { await args.Request.SendResponseAsync(new ValueSet { { "result", TLSerializationService.Current.Serialize(response.Result) } }); } else { await args.Request.SendResponseAsync(new ValueSet { { "error", TLSerializationService.Current.Serialize(response.Error) } }); } } } } finally { deferral.Complete(); } }
private static int Main(string[] args) { CoreApplication.Run(new Program()); return(0); }
private void InitializeContext() { var context = ServiceLocator.Current.GetService <IContextService>(); context.Initialize(Dispatcher, ApplicationView.GetForCurrentView().Id, CoreApplication.GetCurrentView().IsMain); }
private static CoreApplicationView GetCoreApplicationView() { return(CoreApplication.GetCurrentView()); }
public Visibility TitlebarVisibility(bool b) { return((b && CoreApplication.GetCurrentView().TitleBar.IsVisible) ? Visibility.Visible : Visibility.Collapsed); }
public InitializationOptions(CoreApplication application) { Context = application; }
static void Main() => CoreApplication.Run(new UrhoAppViewSource <Progam>("Data"));
public InitializationOptions(CoreApplication application, bool useDeviceIndependentPixel, params Assembly[] assemblies) { Context = application; UseDeviceIndependentPixel = useDeviceIndependentPixel; Assemblies = assemblies; }
private async void LogOff() { await PCLHelper.DeleteFile("User.txt"); CoreApplication.Exit(); }