예제 #1
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs e)
        {
            e.Cancel = true;

            GRViewSource GVS = ( GRViewSource )WidgetList.SelectedItem;
            WidgetView   SW  = new WidgetView(GVS);

            await SW.ConfigureAsync();

            string NName  = NewName.Text.Trim();
            string NQuery = QueryStr.Text.Trim();

            SW.Conf.Enable   = true;
            SW.Conf.Name     = string.IsNullOrEmpty(NName) ? GVS.ItemTitle : NName;
            SW.Conf.Template = WidgetTemplateList.SelectedValue as string ?? "HorzThumbnailList";

            if (SW.DataSource.Searchable)
            {
                if (SW.SearchRequired && string.IsNullOrEmpty(NQuery))
                {
                    QueryStr.BorderBrush     = new SolidColorBrush(Colors.Red);
                    QueryStr.BorderThickness = new Thickness(1);
                    return;
                }

                SW.Conf.Query        = NQuery;
                SW.DataSource.Search = NQuery;
            }

            SelectedWidget = SW;
            this.Hide();
        }
예제 #2
0
        public void NavigateToDataSource(Type TDataSource, Action <GRViewSource> VSAction = null)
        {
            GRViewSource VS = SearchDataSource(NavTree, TDataSource);

            if (VS != null)
            {
                NavigateToViewSource(VS);
                VSAction?.Invoke(VS);
            }
        }
예제 #3
0
        public async void LoadWidgets()
        {
            WidgetConfig[] WCs;
            using (SettingsContext Db = new SettingsContext())
            {
                WCs = Db.WidgetConfigs.OrderBy(x => x.Id).ToList().Select(x => x.Conf).ToArray();
            }

            Widgets.Clear();
            MainContents.ItemsSource = Widgets;

            if (WCs.Any())
            {
                foreach (WidgetConfig WC in WCs)
                {
                    GRViewSource GVS = AvailableWidgets.FirstOrDefault(x => x.DataSource.ConfigId == WC.TargetType);
                    if (GVS != null)
                    {
                        WidgetView WView = new WidgetView(GVS);
                        await WView.ConfigureAsync(WC);

                        _AddWidget(WView);
                    }
                }
            }
            else
            {
                foreach (GRViewSource GVS in AvailableWidgets)
                {
                    WidgetView WView = new WidgetView(GVS);
                    await WView.ConfigureAsync();

                    _AddWidget(WView);
                }
            }
        }
예제 #4
0
 public void NavigateToViewSource(GRViewSource Payload) => NavigateToViewSource(Payload, true);