Exemple #1
0
        private void ListView_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e)
        {
            if (prevSelectedItem != null && prevSelectedItem == e.ItemData)
            {
                return;
            }

            prevSelectedItem = e.ItemData as SampleModel;

            if (isSettingsOpen)
            {
                ClosePropertyView();
            }

            if (e.ItemData != null)
            {
                var currentSample = e.ItemData as SampleModel;
                if (previousSample.Name != currentSample.Name)
                {
                    foreach (var child in chartTypesGrid.Children.Reverse())
                    {
                        var childTypeName = child.GetType().Name;
                        if (childTypeName == previousSample.Name)
                        {
                            (child as SampleView).OnDisappearing();
                            chartTypesGrid.Children.Remove(child);
                        }
                    }

                    var type = DependencyService.Get <ISampleBrowserService>().GetAssembliesType("SampleBrowser.SfChart", currentSample.Name);
                    selectedSample = currentSample.Name;
                    if (type != null)
                    {
                        previousSample = type;
                        var instance = AllControlsSamplePage.CreateInstance(type);
                        SetRowColumn(instance);
                        chartTypesGrid.Children.Add(instance);
                        (instance as SampleView).OnAppearing();

                        if (instance.PropertyView != null)
                        {
                            this.chartSamplePage.IsPropertyWindowVisible = true;
                            settingsButton.Icon     = "Option.png";
                            settingsButton.Clicked -= OptionsButton_Clicked;
                            settingsButton.Clicked += OptionsButton_Clicked;
                            propertyContent.Content = instance.PropertyView;
                            isSettingsOpen          = false;
                        }
                        else
                        {
                            this.chartSamplePage.IsPropertyWindowVisible = false;
                            settingsButton.Icon = string.Empty;
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void UpdateSettingIcon(string sample)
        {
            var sampleName = string.IsNullOrEmpty(sample) ? IsTypeView ? typesView.SelectedSample : featuresView.SelectedSample : sample;
            var type       = DependencyService.Get <ISampleBrowserService>().GetAssembliesType("SampleBrowser.SfChart", sampleName);
            var instance   = AllControlsSamplePage.CreateInstance(type);

            if (instance.PropertyView != null)
            {
                IsPropertyWindowVisible = true;
                settingsButton.Icon     = "Option.png";
            }
            else
            {
                IsPropertyWindowVisible = false;
                settingsButton.Icon     = string.Empty;
            }
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SampleBrowser"/> class.
        /// </summary>
        public static NavigationPage GetMainPage(object controlsList, string assemblyName)
        {
            IsIndividualSB = true;

            ContentPage contentPage;
            bool        isUpdated = false;
            var         controls  = controlsList as ControlModel;
            var         samples   = GetSamplesData(assemblyName + ".SamplesList.SamplesList.xml", assemblyName, ref isUpdated);

            if (samples != null && !string.IsNullOrEmpty(assemblyName))
            {
                if (assemblyName == "SampleBrowser.SfChart")
                {
                    contentPage = new ChartSamplesPage(samples, 0);
                }
                else
                {
                    if (controls != null)
                    {
                        contentPage = new AllControlsSamplePage(controls, samples, controls.Title, 0);
                    }
                    else
                    {
                        contentPage = new AllControlsSamplePage(controlsList, samples, controlsList.ToString(), 0);
                    }
                }
            }
            else
            {
                contentPage = new ContentPage();
            }

            return(new NavigationPage(contentPage)
            {
                BarTextColor = Color.White,
                BarBackgroundColor = Color.FromHex("007DE6")
            });
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChartSampleView"/> class.
        /// </summary>
        public ChartSampleView(object sampleList, ToolbarItem settingsBtn, ChartSamplesPage chartSamplePage, int index)
        {
            InitializeComponent();
            this.chartSamplePage = chartSamplePage;
            if (Device.RuntimePlatform == Device.UWP && Device.Idiom != TargetIdiom.Phone)
            {
                listView.ItemTemplate            = new LabelColorSelector();
                closeButton.MinimumHeightRequest = 10;
                closeButton.MinimumWidthRequest  = 10;
                closeButton.HeightRequest        = 40;
                closeButton.WidthRequest         = 40;
                closeButton.Margin = new Thickness(0, 0, 5, 0);
                boxRowDef.Height   = 0;
            }
            else
            {
                boxRowDef.Height = 1;
            }

            if (Device.Idiom == TargetIdiom.Phone)
            {
                optionsHeight = (float)(0.5 * samplesHeight);
                propertyView.HeightRequest = optionsHeight;
            }

            settingsButton = settingsBtn;
            if (sampleList != null)
            {
                var samples = sampleList as ObservableCollection <SampleModel>;
                var type    = DependencyService.Get <ISampleBrowserService>().GetAssembliesType("SampleBrowser.SfChart", samples[index].Name);

                listView.ItemsSource  = samples;
                listView.SelectedItem = samples[index];
                selectedSample        = samples[index].Name;
                previousSample        = type;

                listView.BackgroundColor = Device.Idiom == TargetIdiom.Desktop ? Color.FromHex("343435") : Color.FromHex("F2F2F2");

                if (type != null)
                {
                    var instance = AllControlsSamplePage.CreateInstance(type);
                    SetRowColumn(instance);
                    chartTypesGrid.Children.Add(instance);
                    if (instance.PropertyView != null)
                    {
                        this.chartSamplePage.IsPropertyWindowVisible = true;
                        settingsButton.Icon     = "Option.png";
                        propertyContent.Content = instance.PropertyView;
                        settingsButton.Clicked -= OptionsButton_Clicked;
                        settingsButton.Clicked += OptionsButton_Clicked;
                    }
                    else
                    {
                        this.chartSamplePage.IsPropertyWindowVisible = false;
                        settingsButton.Icon = string.Empty;
                    }
                }
            }

            if (listView != null)
            {
                listView.ItemTapped += ListView_ItemTapped;
            }
        }