Ejemplo n.º 1
0
        /// <summary>
        /// See base docs.
        /// </summary>
        protected override void CreateBindings()
        {
            base.CreateBindings();

            AddControlBinder(new MasterListToListBinder <Configuration, MergedFeed>(SettingsView.Configuration, listMergedFeeds, r => r.MergedFeeds)
            {
                FetchColumns = (mergedFeed, e) => {
                    e.Checked = mergedFeed.Enabled;
                    e.ColumnTexts.Add(mergedFeed.Name);
                    e.ColumnTexts.Add(mergedFeed.ReceiverIds.Count.ToString());
                    e.ColumnTexts.Add((((double)mergedFeed.IcaoTimeout) / 1000.0).ToString("N2"));
                    e.ColumnTexts.Add(mergedFeed.IgnoreAircraftWithNoPosition ? Strings.Yes : Strings.No);
                },
                GetSortValue = (mergedFeed, header, defaultValue) => {
                    IComparable result = defaultValue;
                    if (header == columnHeaderReceivers)
                    {
                        result = mergedFeed.ReceiverIds.Count;
                    }
                    else if (header == columnHeaderIcaoTimeout)
                    {
                        result = mergedFeed.IcaoTimeout;
                    }

                    return(result);
                },
                AddHandler            = () => SettingsView.CreateMergedFeed(),
                DeleteHandler         = (r) => SettingsView.RemoveMergedFeeds(r),
                EditHandler           = (mergedFeed) => SettingsView.DisplayPageForPageObject(mergedFeed),
                CheckedChangedHandler = (mergedFeed, isChecked) => mergedFeed.Enabled = isChecked,
            });
        }