Example #1
1
 public AutoScrollHandler(System.Windows.Controls.ListBox target)
 {
     Target = target;
     Binding B = new Binding("ItemsSource");
     B.Source = Target;
     BindingOperations.SetBinding(this, ItemsSourceProperty, B);
 }
        protected override FrameworkElement GetContent()
        {
            int totalHeight = 0;
            ListBox removeOptions = new ListBox();

            for(int i = 0 ; i < _tree.Items.Count; i ++)
            
                if (_tree.Items[i] is PatternBase)
                {
                    totalHeight += 25; //default height of an item
                    TextBlock pattern = new TextBlock() 
                    {
                        Text = (_tree.Items[i] as PatternBase).BioPatternName,
                        Name = i.ToString(), //store the id as name so we can remove it later...
                        Width = 150
                    };

                    pattern.MouseLeftButtonUp += new MouseButtonEventHandler(RemoveSelectedPattern);
                    removeOptions.Items.Add(pattern);
                }

            Grid grid = new Grid() 
            { 
                Height = totalHeight,
                Width = 170
            };
            grid.Children.Add(removeOptions);
            return grid;
        }
 private void fillList(ListBox listPlaylist)
 {
     if (!Directory.Exists(PathPlaylist))
         Directory.CreateDirectory(PathPlaylist);
     try
     {
         string[] listFiles = Directory.GetFiles(PathPlaylist, "*.pls");
         foreach (string fileName in listFiles)
         {
             try
             {
                 Playlist onePlaylist = new Playlist(fileName);
                 onePlaylist.ParsePlaylist();
                 listPlaylist.Items.Add(onePlaylist);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
 static void AddSelectionEvent(ListBox list)
 {
     list.SelectionChanged += delegate
     {
         MessageBox.Show("");
     };
 }
Example #5
0
        private static string GetInformationToSave(int cas, MainWindow mw)
        {
            ListBox listBox = new ListBox();

            switch (cas)
            {
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    listBox = mw.listBoxError_Test;
                    break;
            }

            string contents = "";
            foreach (string ligne in listBox.Items)
            {
                contents += ligne + "\r\n";
            }

            return contents;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.remoteClientList = ((System.Windows.Controls.ListBox)(target));
     return;
     case 2:
     
     #line 18 "..\..\AddAppDialog.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OKButton_Clicked);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 20 "..\..\AddAppDialog.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CancelButton_Clicked);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
        public override void OnApplyTemplate()
        {
            if (ResultsListBox != null)
                ResultsListBox.SelectionChanged -= ResultListBox_SelectionChanged;
            if (MapDetailsControl != null)
            {
                MapDetailsControl.MapDetailsChanged -= RaiseMapDetailsChanged;
                MapDetailsControl.MapSelectedForOpening -= RaiseMapSelectedForOpening;
            }
            base.OnApplyTemplate();
            MapDetailsControl = GetTemplateChild("MapDetailsControl") as MapDetailsControl;
            ResultsListBox = GetTemplateChild("ResultsListBox") as ListBox;

            if (ResultsListBox != null)
            {
                ResultsListBox.SelectionChanged += ResultListBox_SelectionChanged;
                ResultsListBox.Tag = this;
            }

            if (MapDetailsControl != null)
            {
                MapDetailsControl.MapDetailsChanged += RaiseMapDetailsChanged;
                MapDetailsControl.MapSelectedForOpening += RaiseMapSelectedForOpening;
            }
        }
        public ListColorNames()
        {
            Title = "List Color Names";

            ListBox lstbox = new ListBox();
            lstbox.Width = 150;   // ��
            lstbox.Height = 150;  //����
            lstbox.SelectionChanged += ListBoxOnSelectionChanged;   // �̺�Ʈ ���
            Content = lstbox;          //win�� ���(ȭ�鿡 ���)

            //1��
            /*
            //��������� ListBox�� ü���
            PropertyInfo[] props = typeof(Colors).GetProperties();
            //GetProperties �� Colors�� �ִ� ������Ƽ 141���� �迭�� �����´�.
            //������ PropertyInfo Ÿ���� �迭�� �ϳ��� ������ Name���� �̸��� ����Ʈ �ڽ��� �߰��Ѵ�.
            foreach (PropertyInfo prop in props)
                lstbox.Items.Add(prop.Name);
            */

            //2��

            PropertyInfo[] props = typeof(Colors).GetProperties();
            //����Ʈ �ڽ��� Color ������ ü���...
            foreach (PropertyInfo prop in props)
                lstbox.Items.Add(prop.GetValue(null, null));
        }
        private ListBox CreateAndInitListBox()
        {
            ListBox lst = new ListBox();

            lst.Margin = new Thickness(10, 10, 10, 10);
            return lst;
        }
 void worker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     var winFabSortedList = winFabInterest;
     ListBox lstBx = new ListBox();
     lstBx.Height = this.MainPanel.Height;
     lstBx.Width = this.MainPanel.Width;
     this.MainPanel.Children.Add(lstBx);
     if (winFabSortedList.Count == 0)
     {
         MessageBox.Show("No Records Found.Try changing the folder option.");
     }
     else
     {
         foreach (var itm in winFabSortedList)
         {
             EmailDataModel emailObj = new EmailDataModel();
             emailObj.SenderName = itm.SenderName;
             emailObj.SenderGroup = itm.SenderGroup;
             emailObj.SenderParticipation = itm.SenderParticipation;
             emailObj.SenderContact = itm.SenderContact;
             InterestControl intControl = new InterestControl();
             intControl.SetUI(emailObj);
             lstBx.Items.Add(intControl);
         }
     }
     this.EllipseAnimate.Visibility = Visibility.Collapsed;
     this.EllipseAnimate.Visibility = Visibility.Collapsed;
     this.UpdateLayout();
 }
        public static bool IsFirstItemVisible(ListBox listbox)
        {
            if (listbox.Items.Count == 0)
                return false;

            var listboxRectangle = new Rect(new Point(0, 0), listbox.RenderSize);

            double visiblePercent = 0;

            ListBoxItem item = listbox.ItemContainerGenerator.ContainerFromIndex(0) as ListBoxItem;
            if (item != null)
            {
                var itemTransform = item.TransformToVisual(listbox);
                var itemRectangle = itemTransform.TransformBounds(new Rect(new Point(0, 0), item.RenderSize));
                itemRectangle.Intersect(listboxRectangle);

                if (!itemRectangle.IsEmpty)
                {
                    visiblePercent = itemRectangle.Height / item.RenderSize.Height * 100;
                }
            }

            if (visiblePercent > 0)
                return true;
            else
                return false;
        }
Example #12
0
 public void AddItemToList(RecognitionResult speech, ListBox list, Color color)
 {
     ListBoxItem item = CreateDefaultListBoxItem();
     item.Content = "S:" + speech.Text + " C:" + speech.Confidence;
     item.Foreground = new SolidColorBrush(color);
     AddToList(list, item);
 }
        public ListColorsEvenElegantlier()
        {
            Title = "List Colors Even Elegantlier";

            DataTemplate template = new DataTemplate(typeof(NamedBrush));
            FrameworkElementFactory factoryStack = new FrameworkElementFactory(typeof(StackPanel));
            factoryStack.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
            template.VisualTree = factoryStack;

            FrameworkElementFactory factoryRectangle = new FrameworkElementFactory(typeof(Rectangle));
            factoryRectangle.SetValue(Rectangle.WidthProperty, 16.0);
            factoryRectangle.SetValue(Rectangle.HeightProperty, 16.0);
            factoryRectangle.SetValue(Rectangle.MarginProperty, new Thickness(2));
            factoryRectangle.SetValue(Rectangle.StrokeProperty, SystemColors.WindowTextBrush);
            factoryRectangle.SetBinding(Rectangle.FillProperty, new Binding("Brush"));
            factoryStack.AppendChild(factoryRectangle);

            FrameworkElementFactory factoryTextBlock = new FrameworkElementFactory(typeof(TextBlock));
            factoryTextBlock.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
            factoryTextBlock.SetValue(TextBlock.TextProperty, new Binding("Name"));
            factoryStack.AppendChild(factoryTextBlock);

            ListBox lstbox = new ListBox();
            lstbox.Width = 150;
            lstbox.Height = 150;
            Content = lstbox;

            lstbox.ItemTemplate = template;
            lstbox.ItemsSource = NamedBrush.All;

            lstbox.SelectedValuePath = "Brush";
            lstbox.SetBinding(ListBox.SelectedValueProperty, "Background");
            lstbox.DataContext = this;
        }
Example #14
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
                case 1:
                    this.syncMovies = (CheckBox) target;
                    return;

                case 2:
                    this.syncMoviesAll = (CheckBox) target;
                    return;

                case 3:
                    this.moviesListBox = (ListBox) target;
                    this.moviesListBox.PreviewKeyDown += new KeyEventHandler(this.listBox_PreviewKeyDown);
                    return;

                case 4:
                    this.drmMessage = (TextBlock) target;
                    return;

                case 5:
                    this.cancelButton = (Button) target;
                    return;

                case 6:
                    this.syncButton = (Button) target;
                    return;
            }
            this._contentLoaded = true;
        }
        public void show(MainWindow con, ListBox lb, string kto, string text, int tem)
        {
            if (!lb.CheckAccess())
            {
                con.Dispatcher.Invoke(DispatcherPriority.Send,
                (Action)delegate
                {
                    UserWiad itm = new UserWiad();
                    itm.Nick = kto;
                    itm.Wiad = text;
                    itm.Typ = tem;
                    lb.Items.Add(itm);
                    lb.ScrollIntoView(itm);
                });
            }
            else
            {
                UserWiad itm = new UserWiad();
                itm.Nick = kto;
                itm.Wiad = text;
                itm.Typ = tem;
                lb.Items.Add(itm);

                lb.ScrollIntoView(itm);
            }
        }
        public void WhenDataContextChanges_ThenItupdatesSelectedItems()
        {
            var behavior = new SynchronizeSelectedItems();
            BindingOperations.SetBinding(
                behavior,
                SynchronizeSelectedItems.SelectionsProperty,
                new Binding("ObservableSelections"));

            var listBox = new ListBox() { SelectionMode = SelectionMode.Multiple };
            BindingOperations.SetBinding(
                listBox, ListBox.ItemsSourceProperty,
                new Binding("Items"));

            listBox.DataContext =
                new ItemsHolder
                {
                    Items = { "a", "b", "c", "d" },
                    ObservableSelections = { "a", "c" }
                };

            var behaviors = Interaction.GetBehaviors(listBox);
            behaviors.Add(behavior);

            listBox.DataContext =
                new ItemsHolder
                {
                    Items = { "a", "b", "c", "d" },
                    ObservableSelections = { "b", "d" }
                };

            CollectionAssert.AreEquivalent(new[] { "b", "d" }, listBox.SelectedItems);
        }
 public void Test(int processId)
 {
     IEnumerable<string> fontFamilies = System.Drawing.FontFamily.Families.Select(f=>f.Name);
     ListBox listBox = new ListBox();
     ResourceDictionary dictionary = new ResourceDictionary();
     dictionary.Source = new Uri("/KSPE3Lib;component/Resources.xaml", UriKind.Relative);
     listBox.ItemTemplate = dictionary["FontItemTemplate"] as DataTemplate;
     listBox.ItemsSource = fontFamilies;
     listBox.Width = 250;
     listBox.Height = 300;
     listBox.SelectionChanged += listBox_SelectionChanged;
     Dictionary<int, Color> colorByCode = E3ColorTable.GetColorByCode(processId);
     ColorPicker colorPicker = new ColorPicker(colorByCode);
     colorPicker.VerticalAlignment = VerticalAlignment.Center;
     colorPicker.SelectedColorChanged += colorPicker_SelectedColorChanged;
     textBlockForeGroundBrush = new SolidColorBrush();
     textBlockForeGroundBrush.Color = colorPicker.SelectedColor;
     textBlock = new TextBlock();
     textBlock.Text = "Example";
     textBlock.Foreground = textBlockForeGroundBrush;
     StackPanel panel = new StackPanel();
     panel.Background = new SolidColorBrush(Colors.LightGray);
     panel.Children.Add(textBlock);
     panel.Children.Add(colorPicker.UIElement);
     panel.Children.Add(listBox);
     panel.Orientation = Orientation.Horizontal;
     Content = panel;
 }
 private static object GetDataFromListBox(ListBox source, Point point)
 {
     UIElement element = source.InputHitTest(point) as UIElement;
     if (element != null)
     {
         object data = DependencyProperty.UnsetValue;
         while (data == DependencyProperty.UnsetValue)
         {
             data = source.ItemContainerGenerator.ItemFromContainer(element);
             if (data == DependencyProperty.UnsetValue)
             {
                 element = VisualTreeHelper.GetParent(element) as UIElement;
             }
             if (element == source)
             {
                 return null;
             }
         }
         if (data != DependencyProperty.UnsetValue)
         {
             return data;
         }
     }
     return null;
 }
Example #19
0
        public void Setup_Board(Tuple<IEnumerable<Column>, IEnumerable<Task>> columns_and_tasks) {
            listboxes = new List<ListBox>();
            var columnIndex = 0;
            foreach (var column in columns_and_tasks.Item1) {
                var listbox = new ListBox();
                listbox.MinWidth = 64;
                panel.Children.Add(listbox);
                var col = columnIndex++;
                listbox.SelectionChanged += (o, e) => {
                    if (listbox.SelectedIndex == -1) {
                        return;
                    }
                    for (var i = 0; i < listboxes.Count; i++) {
                        if (i == col) {
                            continue;
                        }
                        listboxes[i].SelectedIndex = -1;
                    }
                    Show_Task(col, listbox.SelectedIndex);
                };
                listboxes.Add(listbox);
            }

            foreach (var task in columns_and_tasks.Item2) {
                Add_Task(task);
            }
        }
Example #20
0
 private void Discard(ListBox menu)
 {
     menu.IsEnabled = false;
     var duration = new Duration(TimeSpan.FromMilliseconds(400));
     DoubleAnimation
         posXAnimation = new DoubleAnimation { Duration = duration, To = -80 },
         posYAnimation = new DoubleAnimation { Duration = duration, To = -80 },
         scaleXAnimation = new DoubleAnimation { Duration = duration, To = 1.5 },
         scaleYAnimation = new DoubleAnimation { Duration = duration, To = 1.5 },
         opacityAnimation = new DoubleAnimation { Duration = duration, To = 0 }
     ;
     var translateTransform = ((TransformGroup)menu.RenderTransform).Children[0];
     var scaleTransform = ((TransformGroup)menu.RenderTransform).Children[1];
     translateTransform.BeginAnimation(TranslateTransform.XProperty, posXAnimation);
     translateTransform.BeginAnimation(TranslateTransform.YProperty, posYAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnimation);
     opacityAnimation.Completed += (object sender, EventArgs e) =>
     {
         menu.Visibility = Visibility.Collapsed;
         menu.IsEnabled = true;
         translateTransform.BeginAnimation(TranslateTransform.XProperty, null);
         translateTransform.BeginAnimation(TranslateTransform.YProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);
         menu.BeginAnimation(OpacityProperty, null);
     };
     menu.BeginAnimation(OpacityProperty, opacityAnimation);
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.numbersList = ((System.Windows.Controls.ListBox)(target));
     return;
     case 2:
     
     #line 56 "..\..\..\View\PersonViewWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 57 "..\..\..\View\PersonViewWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
 public ListBoxTextWriter()
 {
     // Get the static list box
     _listBox = ApplicationInterface._app.GetEventListBox();
     if (_listBox != null)
         _isOpen = true;
 }
Example #23
0
        //for creating a new terminal
        public PopUpTerminal(Airport airport)
        {
            this.Airport = airport;

            InitializeComponent();

            this.Uid = "1000";
            this.Title = Translator.GetInstance().GetString("PopUpTerminal", this.Uid);

            this.Width = 400;

            this.Height = 200;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);

            ListBox lbTerminal = new ListBox();
            lbTerminal.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbTerminal.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            mainPanel.Children.Add(lbTerminal);

            // chs 28-01-12: added for name of terminal
            txtName = new TextBox();
            txtName.Background = Brushes.Transparent;
            txtName.BorderBrush = Brushes.Black;
            txtName.IsEnabled = this.Terminal == null;
            txtName.Width = 100;
            txtName.Text = this.Terminal == null ? "Terminal" : this.Terminal.Name;
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal","1007"),txtName));

            // chs 11-09-11: added numericupdown for selecting number of gates
            nudGates = new ucNumericUpDown();
            nudGates.Height = 30;
            nudGates.MaxValue = 50;
            nudGates.ValueChanged+=new RoutedPropertyChangedEventHandler<decimal>(nudGates_ValueChanged);
            nudGates.MinValue = 1;

            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1001"), nudGates));
            /*
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalPrice()))));
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalGatePrice()))));
            */
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalPrice()).ToString())));
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalGatePrice()).ToString())));

            txtDaysToCreate = UICreator.CreateTextBlock("0 days");
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1004"), txtDaysToCreate));

            txtTotalPrice = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(0).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", 0));
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1005"), txtTotalPrice));

            mainPanel.Children.Add(createButtonsPanel());

            nudGates.Value = 1;

            this.Content = mainPanel;
        }
Example #24
0
	void FunctionSelectionWindow_Loaded (object sender, RoutedEventArgs e)
		{
		ListBox SelectionBox = new ListBox ();
		this.Content = SelectionBox;
		SelectionBox.ItemsSource = PossibleArguments;
		SelectionBox.MouseDoubleClick +=new System.Windows.Input.MouseButtonEventHandler(SelectionBox_MouseDoubleClick);
		}
 private void pasarListBox(ListBox origen, ListBox destino)
 {
     String text = origen.SelectedItem.ToString();
     text = text.Replace("System.Windows.Controls.ListBoxItem: ", "");
     destino.Items.Add(text);
     origen.Items.Remove(origen.SelectedItem);
 }
        public ListColoredLabels()
        {
            Title = "List Colored Labels";

            ListBox lstbox = new ListBox();
            lstbox.Height = 150;
            lstbox.Width = 150;
            lstbox.SelectionChanged += ListBoxOnSelectionChanged;
            Content = lstbox;

            //label ��Ʈ�ѷ� ����Ʈ�ڽ��� ä���....
            PropertyInfo[] props = typeof(Colors).GetProperties();

            foreach (PropertyInfo prop in props)
            {
                Color clr = (Color)prop.GetValue(null, null);
                bool isBlack = .222 * clr.R + .707 * clr.G + .071 * clr.B > 128;

                //--------------------------------------------------------------
                Label lbl = new Label();           //---->label ����....
                lbl.Content = prop.Name;
                lbl.Background = new SolidColorBrush(clr);
                lbl.Foreground = isBlack ? Brushes.Black : Brushes.White;
                lbl.Width = 100;
                lbl.Margin = new Thickness(15, 0, 0, 0);
                lbl.Tag = clr;
                //-------------------------------------------------------------

                lstbox.Items.Add(lbl);           //-->ListBox�� Label�� �߰�
            }
        }
    public override void OnApplyTemplate()
    {
        if (MapDetailsControl != null)
        {
            MapDetailsControl.MapDetailsChanged -= RaiseMapDetailsChanged;
            MapDetailsControl.MapSelectedForOpening -= RaiseMapSelectedForOpening;
        }

        if (ResultsListBox != null)
            ResultsListBox.SelectionChanged -= ResultListBox_SelectionChanged;

        base.OnApplyTemplate();

        MapDetailsControl = GetTemplateChild("MapDetailsControl") as MapDetailsControl;
        ResultsListBox = GetTemplateChild("ResultsListBox") as ListBox;
        SearchResultsTextBlock = GetTemplateChild("SearchResultsTextBlock") as TextBlock;
        DataPager = GetTemplateChild("DataPager") as DataPager;

        if (MapDetailsControl != null)
        {
            MapDetailsControl.MapDetailsChanged += RaiseMapDetailsChanged;
            MapDetailsControl.MapSelectedForOpening += RaiseMapSelectedForOpening;
        }

        if (ResultsListBox != null)
        {
            ResultsListBox.SelectionChanged += ResultListBox_SelectionChanged;
            ResultsListBox.DataContext = this;
        }
        if (_isDirty)
            GenerateResults();
    }
 public SelectedItemsBehavior(ListBox listBox, IList boundList)
 {
     _boundList = boundList;
     _listBox = listBox;
     _listBox.Loaded += ListBoxLoaded;
     AddCollectionChangedHandler();
 }
 object Edit()
 {
     ListBox lb = new ListBox();
     lb.SelectionChanged+=(sender,e) => {
         ListBoxItem item = e.AddedItems[0] as ListBoxItem;
         Grid grid = item.Content as Grid;
         TextBox tb = grid.Children[1] as TextBox;
         tb.SelectAll();
         tb.Focus();
     };
     lb.HorizontalContentAlignment=HorizontalAlignment.Stretch;
     if(dics.Count==0&&output.Exists) {
         using(StreamReader sr = output.OpenText()) {
             while(!sr.EndOfStream) {
                 string line = sr.ReadLine();
                 string[] cols = line.Trim().Split(' ');
                 if(cols.Length>=4) {
                     KeyValuePair<TimeSpan,TimeSpan> pair;
                     lb.Items.Add(Edit(cols,out pair));
                     dics.Add(pair.Key,pair.Value);
                 }
             }
         }
     } else {
         int i = 1;
         foreach(KeyValuePair<TimeSpan,TimeSpan> dic in dics) {
             lb.Items.Add(Edit(i,dic));
             ++i;
         }
         lb.SelectedIndex=0;
     }
     return lb;
 }
 public override void ActionSheet(ActionSheetConfig config) {
     var sheet = new CustomMessageBox {
         Caption = config.Title,
         IsLeftButtonEnabled = false,
         IsRightButtonEnabled = false
     };
     var list = new ListBox {
         FontSize = 36,
         Margin = new Thickness(12.0),
         SelectionMode = SelectionMode.Single,
         ItemsSource = config.Options
             .Select(x => new TextBlock {
                 Text = x.Text,
                 Margin = new Thickness(0.0, 12.0, 0.0, 12.0),
                 DataContext = x
             })
     };
     list.SelectionChanged += (sender, args) => sheet.Dismiss();
     sheet.Content = list;
     sheet.Dismissed += (sender, args) => {
         var txt = (TextBlock)list.SelectedValue;
         var action = (ActionSheetOption)txt.DataContext;
         if (action.Action != null)
             action.Action();
     };
     this.Dispatch(sheet.Show);
 }