예제 #1
0
        public App()
        {
            InitializeComponent();

            //XXX: Fix xamarin linking bug
            new FFImageLoading.Transformations.CircleTransformation();

            //Set view model bindings
            viewModel           = new ViewModel.Cloud();
            this.BindingContext = viewModel;

            //Load UI
            var postLoad = new PostLoad()
            {
                BindingContext = viewModel
            };

            MainPage = new NavigationPage(postLoad)
            {
                BarTextColor       = Color.White,
                BarBackgroundColor = Color.FromHex("#303030")
            };

            //Keyboard shown notification
            KeyboardHelperService.KeyboardChanged += KeyboardHelper_KeyboardChanged;
        }
예제 #2
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            ViewModel.Cloud cloud = (BindingContext as ViewModel.Cloud);

            if (!isLastDeviceOrientationInit && (cloud != null))
            {
                lastDeviceOrientation       = cloud.DeviceOrientation;
                isLastDeviceOrientationInit = true;
            }

            if ((cloud != null) && (lastDeviceOrientation != cloud.DeviceOrientation))
            {
                lastDeviceOrientation = cloud.DeviceOrientation;
                invalidateNotificationsList();
                currentSelectedElement = null;
            }
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!string.IsNullOrWhiteSpace(value?.ToString()))
            {
                try
                {
                    string breadcrumbs = value.ToString();

                    if ((parameter == null) || string.IsNullOrWhiteSpace(parameter.ToString()))
                    {
                        ViewModel.Cloud cloud = App.Current?.BindingContext as ViewModel.Cloud;
                        if (!string.IsNullOrWhiteSpace(cloud?.MediaContent?.SelectedFolder?.Name))
                        {
                            string selectedFolderName = (cloud.MediaContent.SelectedFolder.IsFromSearch) ?
                                                        string.Format("Search results for \"{0}\"", cloud.MediaContent.SelectedFolder.Name) :
                                                        cloud.MediaContent.SelectedFolder.Name;

                            int currentFolderNameIndex = breadcrumbs.LastIndexOf(" > " + selectedFolderName);
                            if (currentFolderNameIndex > -1)
                            {
                                return(breadcrumbs.Remove(currentFolderNameIndex));
                            }
                        }
                    }
                    else if (parameter.Equals("GetOnlyLastName"))
                    {
                        string[] breadcrumbsElements = breadcrumbs.Split(new string[] { " > " }, StringSplitOptions.RemoveEmptyEntries);
                        if (breadcrumbsElements?.Length > 0)
                        {
                            return(breadcrumbsElements[breadcrumbsElements.Length - 1]);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LoggerService.Instance.Log("ERROR: NameBreadcrumbsConverter.Convert: " + ex.Message);
                }
            }

            return(value);
        }