コード例 #1
0
        private void ExecuteButton_Click(object sender, RoutedEventArgs e)
        {
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();

            FindTask findTask = new FindTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer");

            findTask.Failed += FindTask_Failed;

            FindParameters findParameters = new FindParameters();

            // Layer ids to search
            findParameters.LayerIds.AddRange(new int[] { 0, 1, 2 });
            // Fields in layers to search
            findParameters.SearchFields.AddRange(new string[] { "CITY_NAME", "NAME", "SYSTEM", "STATE_ABBR", "STATE_NAME" });

            // Bind data grid to find results.  Bind to the LastResult property which returns a list
            // of FindResult instances.  When LastResult is updated, the ItemsSource property on the
            // will update.
            Binding resultFeaturesBinding = new Binding("LastResult");

            resultFeaturesBinding.Source = findTask;
            DataListBox.SetBinding(ListBox.ItemsSourceProperty, resultFeaturesBinding);

            findParameters.SearchText = FindText.Text;
            findTask.ExecuteAsync(findParameters);

            // Since binding to DataGrid, handling the ExecuteComplete event is not necessary.
        }
コード例 #2
0
        private void ClosingStoryboard_Completed(object sender, EventArgs e)
        {
            Hide();
            _isDisplayed = false;
            _actionOnHidding();
            _closingStoryboard.Remove();
            _openingStoryboard.Remove();

            var dataContext = (PasteBarWindowViewModel)DataContext;

            if (dataContext.DataEntries.Any(item => item.IsMoreInfoDisplayed))
            {
                foreach (var dataContextDataEntry in dataContext.DataEntries.Where(item => item.IsMoreInfoDisplayed))
                {
                    dataContextDataEntry.IsMoreInfoDisplayed = false;
                }
                DataListBox.Items.Refresh();
            }

            if (DataListBox.Items.Count > 0)
            {
                DataListBox.ScrollIntoView(DataListBox.Items[0]);
            }

            DataListBox.SelectedItem  = null;
            DataListBox.SelectedIndex = 0;
        }
コード例 #3
0
ファイル: Information.cs プロジェクト: anhnh14/Instagram
        /// <summary>
        /// Load comment from image
        /// </summary>
        private async void loadComments()
        {
            List <Comment> listComment = new List <Comment>();

            try
            {
                Task <List <Comment> > getListComment = _endPoint.LoadComments(lbPictureId.Text);
                listComment = await getListComment;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


            List <DataListBox> listData = new List <DataListBox>();

            foreach (var item in listComment)
            {
                DataListBox data = new DataListBox();
                data.id      = item.id;
                data.content = item.from.username + ": " + item.text;
                listData.Add(data);
            }

            lbComment.DataSource    = listData;
            lbComment.DisplayMember = "content";
            lbComment.ValueMember   = "id";
            lbComment.SelectedIndex = lbComment.Items.Count - 1;
        }
コード例 #4
0
ファイル: PasteTips.xaml.cs プロジェクト: metaseed/Metakey
        internal void Previous()
        {
            var view     = ViewModel.CollectionView;
            var position = view.CurrentPosition;

            if (position <= 0)
            {
                return;
            }
            var r = view.MoveCurrentToPosition(position - 1);

            if (r)
            {
                DataListBox.ScrollIntoView(view.CurrentItem);
            }
        }
コード例 #5
0
ファイル: PasteTips.xaml.cs プロジェクト: metaseed/Metakey
        internal void Next()
        {
            var view     = ViewModel.CollectionView;
            var position = view.CurrentPosition;

            if (position >= view.Count - 1)
            {
                return;
            }
            var r = view.MoveCurrentToPosition(position + 1);

            if (r)
            {
                DataListBox.ScrollIntoView(view.CurrentItem);
            }
        }
コード例 #6
0
        public object Render(T obj, EditorField <T> editorField, Action preview)
        {
            object value = editorField.GetValue(obj);

            var labelText = value?.ToString() ?? "";

            _dataListBox = new DataListBox(_options)
            {
                Text = labelText
            };

            _dataListBox.TextInput += (sender, args) => preview();

            _dataListBox.Enabled = editorField.Enabled;

            return(_field = new Field(editorField.Label, _dataListBox, editorField.Description, editorField.Helper, editorField.Required));
        }
コード例 #7
0
        /// <summary>
        /// 批量下载 - 操控线程
        /// </summary>
        private void AutoDownload()
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Send, (ThreadStart) delegate()
            {
                DataListBox.IsEnabled          = false;
                Button_SaveSong.IsEnabled      = false;
                Image_Album_Previous.IsEnabled = false;
                Image_Album_Next.IsEnabled     = false;
            });
            for (int i = 0; i < SongList.Count; i++)
            {
                AutoDownloading = true;

                //设置进度
                this.Dispatcher.BeginInvoke(DispatcherPriority.Send, (ThreadStart) delegate()
                {
                    DataListBox.SelectedIndex = i;
                    DataListBox.ScrollIntoView(DataListBox.SelectedItem);
                    double d = ((double)(i + 1) / (double)SongList.Count * 100);

                    Label_ProcessBar.Content  = Math.Truncate(d).ToString() + "%";
                    ProcessBar_Download.Value = d;
                });

                while (AutoDownloading)
                {
                    Thread.Sleep(100);
                }

                this.Dispatcher.BeginInvoke(DispatcherPriority.Send, (ThreadStart) delegate()
                {
                    Button_SaveSong_Click(null, null);
                });
            }
            this.Dispatcher.BeginInvoke(DispatcherPriority.Send, (ThreadStart) delegate()
            {
                DataListBox.IsEnabled          = true;
                Button_SaveSong.IsEnabled      = true;
                Image_Album_Previous.IsEnabled = true;
                Image_Album_Next.IsEnabled     = true;
                Sb3.Begin();
            });
        }
コード例 #8
0
 private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     DataListBox.Focus();
     DataListBox.SelectedItem = e.Graphic;
     DataListBox.ScrollIntoView(DataListBox.SelectedItem);
 }