private void MainPage_SizeChanged(object sender, SizeChangedEventArgs e) { // Manage the system tray in landscape mode Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { bool portrait = ApplicationView.GetForCurrentView().Orientation == ApplicationViewOrientation.Portrait; if (portrait) { if (SettingsService.Get <bool>(SettingsKeys.HideSystemTray)) { SystemTrayManager.HideAsync()?.AsTask().Forget(); } else { SystemTrayManager.TryShowAsync().Forget(); } } else { SystemTrayManager.HideAsync()?.AsTask().Forget(); } }).AsTask().Forget(); if (e.NewSize.Width < 720) { if (ViewModel.isLoggedin) { BottomAppBar.Visibility = Visibility.Visible; } else { BottomAppBar.Visibility = Visibility.Collapsed; } } }
private void ShowFileCountNotification(Device connectedDevice) { PortableDevice portableDevice = null; try { if (_connectedDeviceCollection != null && _connectedDeviceCollection.Count > 0) { //get the connect device of same Id portableDevice = _connectedDeviceCollection. SingleOrDefault(p => p.DeviceId.Equals(connectedDevice.Id)); if (portableDevice != null) { portableDevice.Connect(); //set active device to curren-device _activeDevice = connectedDevice; PortableDeviceFolder deviceFolder = portableDevice.GetContents(); var fileCount = EnumerateContents(portableDevice, deviceFolder); Console.WriteLine("Total number of files found {0}", fileCount); if (_fileCounter > 0) { SystemTrayManager.ShowBalloonTip(balloonTipText: string.Format("{0} files found in - {1} " , _fileCounter, connectedDevice.DisplayName)); } } } } catch (Exception) { throw; } finally { if (portableDevice != null) { portableDevice.Disconnect(); } _activeDevice = null; _fileCounter = 0; } }
public MainPage() { InitializeComponent(); // initialising content reference registrar ReferencedContent = new ContentReferenceRegistrar(); // initialising shared UI managers SystemTray = new SystemTrayManager(this); ApplicationBar = new ApplicationBarManager(this); // creating root view rootView = new View(null, this); rootView.VerticalAlignment = VerticalAlignment.Stretch; rootView.HorizontalAlignment = HorizontalAlignment.Stretch; rootView.InitialNodeLoad += new EventHandler(rootView_InitialNodeLoad); // enabling root view Root.Child = rootView; }
public MainPage() { this.Loaded += (s, e) => { if (SettingsService.Get <bool>(SettingsKeys.HideSystemTray)) { SystemTrayManager.HideAsync().AsTask().Forget(); } else { SystemTrayManager.TryShowAsync().Forget(); } }; this.InitializeComponent(); ViewModel = new MainViewmodel(); this.DataContext = ViewModel; SizeChanged += MainPage_SizeChanged; //Listening for No Internet message Messenger.Default.Register <NoInternetMessageType>(this, ViewModel.RecieveNoInternetMessage); //Listening Internet available message Messenger.Default.Register <HasInternetMessageType>(this, ViewModel.RecieveInternetMessage); //Setting Header Text to the current page name Messenger.Default.Register(this, delegate(SetHeaderTextMessageType m) { setHeadertext(m.PageName); }); SimpleIoc.Default.Register <IAsyncNavigationService>(() => { return(new NavigationService(mainFrame)); }); NavigationCacheMode = NavigationCacheMode.Enabled; SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested; }
private void ShowFileCountNotification(Device connectedDevice) { if (System.Threading.Thread.CurrentThread.IsBackground) { Utility.LogMessage("[ShowFileCountNotification] [IsBackground]"); } else { Utility.LogMessage("[ShowFileCountNotification] [Foreground]"); } PortableDevice portableDevice = null; try { if (_connectedDeviceCollection != null && _connectedDeviceCollection.Count > 0) { //get the connect device of same Id portableDevice = _connectedDeviceCollection. SingleOrDefault(p => p.DeviceId.Equals(connectedDevice.Id)); if (portableDevice != null) { portableDevice.Connect(); //set active device to curren-device Utility.LogMessage(@"[ShowFileCountNotification] [Setting_ActiveDevice] [{0}]", connectedDevice.DisplayName); _activeDevice = connectedDevice; PortableDeviceFolder deviceFolder = portableDevice.GetContents(); var fileCount = EnumerateContents(portableDevice, deviceFolder); Utility.LogMessage("[ShowFileCountNotification] [Total number of files found -> {0}][Device::{1}]", fileCount, connectedDevice.DisplayName); if (_validFileCounter > 0) { SystemTrayManager.ShowBalloonTip(balloonTipText: string.Format("{0} files to be copied, found in - {1} " , _validFileCounter, connectedDevice.DisplayName)); Utility.LogMessage(string.Format("{0} files to be copied, found in - {1} " , _validFileCounter, connectedDevice.DisplayName)); } } } } catch (Exception) { throw; } finally { if (portableDevice != null) { portableDevice.Disconnect(); } Utility.LogMessage(@"[ShowFileCountNotification] [Finally] [Setting_ActiveDevice][NULL]"); _activeDevice = null; _validFileCounter = 0; _totalFileCounter = 0; } }