Esempio n. 1
0
        private void activityDataListView_SizeChanged(object sender, EventArgs e)
        {
            if (!resizing)
            {
                // Set the resizing flag
                resizing = true;

                DataListView listView = sender as DataListView;
                if (listView != null)
                {
                    float totalColumnWidth = 0;

                    // Get the sum of all column tags
                    for (int i = 0; i < listView.Columns.Count; i++)
                    {
                        totalColumnWidth += Convert.ToInt32(listView.Columns[i].Tag);
                    }

                    // Calculate the percentage of space each column should
                    // occupy in reference to the other columns and then set the
                    // width of the column to that percentage of the visible space.
                    for (int i = 0; i < listView.Columns.Count; i++)
                    {
                        float colPercentage = (Convert.ToInt32(listView.Columns[i].Tag) / totalColumnWidth);
                        listView.Columns[i].Width = (int)(colPercentage * listView.ClientRectangle.Width);
                    }
                }
            }

            // Clear the resizing flag
            resizing = false;
        }
        /// <summary>
        /// Configura un dataListView
        /// </summary>
        /// <param name="dataListView">DataListView objetivo</param>
        /// <param name="dimension">Número de columnas que no se editan</param>
        /// <param name="headers">Título de las columnas</param>
        private void ConfigurarDataObjectList(DataListView dataListView, int dimension, List <string> headers)
        {
            dataListView.ClearObjects();
            dataListView.Groups.Clear();
            dataListView.DataSource = null;
            dataListView.DataMember = null;

            for (int i = 0; i < dataListView.AllColumns.Count; i++)
            {
                if (i < headers.Count)
                {
                    dataListView.AllColumns[i].Text       = headers[i];
                    dataListView.AllColumns[i].AspectName = headers[i];
                }
                else
                {
                    dataListView.AllColumns[i].Text       = "(Vacía)";
                    dataListView.AllColumns[i].AspectName = "Column" + (i + 1);
                }
                dataListView.AllColumns[i].IsEditable = !(i < dimension);
                dataListView.AllColumns[i].IsVisible  = (i < headers.Count);
            }
            dataListView.RebuildColumns();
            dataListView.Refresh();
        }
Esempio n. 3
0
 public static void SetDataSource(DataListView dataListView, UIPresentationProfile uiPresentationProfile, DataTableLoaderView dataTableLoaderView)
 {
     if (dataListView == null)
     {
         throw new ArgumentNullException("dataListView");
     }
     if (!WinformsHelper.CheckDataSource(dataListView.DataSource))
     {
         throw new ArgumentException("dataListView");
     }
     if (dataListView.DataSource != null)
     {
         DataTableLoaderView dataTableLoaderView2 = (dataListView.DataSource as AdvancedBindingSource).DataSource as DataTableLoaderView;
         dataListView.DataSource = null;
         if (dataTableLoaderView2 != null)
         {
             dataTableLoaderView2.Dispose();
         }
     }
     if (dataTableLoaderView != null)
     {
         WinformsHelper.SyncSortSupportDescriptions(dataListView, uiPresentationProfile, dataTableLoaderView);
         dataListView.DataSource = new AdvancedBindingSource
         {
             DataSource = dataTableLoaderView
         };
     }
 }
Esempio n. 4
0
        public static FilteredDataTableLoaderView SetFilteredDataSource(DataListView dataListView, UIPresentationProfile uiPresentationProfile, DataTableLoader dataTableLoader)
        {
            FilteredDataTableLoaderView filteredDataTableLoaderView = (dataTableLoader == null) ? null : FilteredDataTableLoaderView.Create(dataTableLoader);

            WinformsHelper.SetDataSource(dataListView, uiPresentationProfile, filteredDataTableLoaderView);
            return(filteredDataTableLoaderView);
        }
Esempio n. 5
0
 internal static void ShowExportDialog(IWin32Window owner, DataListView listControl, IUIService uiService)
 {
     using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog())
     {
         saveFileDialog.OverwritePrompt = true;
         saveFileDialog.Title           = Strings.ExportListFileDialogTitle;
         saveFileDialog.Filter          = string.Format("{0}|*.txt|{1}|*.csv|{2}|*.txt|{3}|*.csv", new object[]
         {
             Strings.ExportListFileFilterTextTab,
             Strings.ExportListFileFilterTextComma,
             Strings.ExportListFileFilterUnicodeTab,
             Strings.ExportListFileFilterUnicodeComma
         });
         if (DialogResult.OK == saveFileDialog.ShowDialog(owner))
         {
             Encoding fileEncoding = (saveFileDialog.FilterIndex <= 2) ? Encoding.Default : Encoding.Unicode;
             char     separator    = (saveFileDialog.FilterIndex % 2 == 1) ? '\t' : ',';
             try
             {
                 listControl.ExportListToFile(saveFileDialog.FileName, fileEncoding, separator);
             }
             catch (IOException ex)
             {
                 uiService.ShowError(Strings.ExportListFileIOError(ex.Message));
             }
             catch (UnauthorizedAccessException ex2)
             {
                 uiService.ShowError(Strings.ExportListFileIOError(ex2.Message));
             }
         }
     }
 }
 private void RecreateChildItems()
 {
     if (this.ListView != null && this.DataSource != null && this.childDataSources.Count > 0)
     {
         this.ApplySort();
         if (this.ListView.InvokeRequired)
         {
             this.ListView.Invoke(new MethodInvoker(this.RecreateChildItems));
             return;
         }
         this.ListView.BeginUpdate();
         try
         {
             if (this.ChildrenItems.Count > 0)
             {
                 if (this.ChildrenItems[0].IsInListView)
                 {
                     this.ListView.BackupItemsStates();
                 }
                 this.ChildrenItems.Clear();
             }
             foreach (object obj in this.childDataSources)
             {
                 BindingSource bindingSource = (BindingSource)obj;
                 foreach (object obj2 in bindingSource)
                 {
                     DataTreeListViewItem dataTreeListViewItem = this.ListView.InternalCreateListViewItemForRow(obj2);
                     dataTreeListViewItem.ColumnMapping = (DataTreeListViewColumnMapping)this.dataSource2ColumnMapping[bindingSource];
                     dataTreeListViewItem.UpdateItem();
                     if (dataTreeListViewItem.ColumnMapping.ImageIndex < 0)
                     {
                         if (!string.IsNullOrEmpty(this.ListView.ImagePropertyName))
                         {
                             PropertyDescriptorCollection properties         = TypeDescriptor.GetProperties(obj2);
                             PropertyDescriptor           propertyDescriptor = properties[this.ListView.ImagePropertyName];
                             if (propertyDescriptor != null)
                             {
                                 dataTreeListViewItem.ImageKey = DataListView.GetPropertyValue(obj2, propertyDescriptor).ToString();
                             }
                         }
                     }
                     else
                     {
                         dataTreeListViewItem.ImageIndex = dataTreeListViewItem.ColumnMapping.ImageIndex;
                     }
                     this.ChildrenItems.Add(dataTreeListViewItem);
                 }
             }
             this.ListView.RaiseItemsForRowsCreated(EventArgs.Empty);
         }
         finally
         {
             this.ListView.EndUpdate();
         }
         this.ListView.TrySelectItemBySpecifiedIdentity();
     }
 }
Esempio n. 7
0
        static void Main()
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += ApplicationOnThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var container = new WindsorContainer();

            container.Install(FromAssembly.This());

            var validateAssignmentService = container.Resolve <IValidateAssignment>();
            var systemInformationService  = container.Resolve <ISystemInformationService>();
            var taskService         = container.Resolve <IService <Task> >();
            var employeeService     = container.Resolve <IService <Employee> >();
            var assignedTaskService = container.Resolve <IService <AssignedTask> >();

            var mainForm                  = new MainForm();
            var dialogForm                = new DialogForm();
            var employeesDataListView     = new DataListView();
            var tasksDataListView         = new DataListView();
            var assignedTasksDataListView = new DataListView();
            var taskDialogView            = new TaskDialogView();
            var employeeDialogView        = new EmployeeDialogView();
            var assignedTaskDialogView    = new AssignedTaskDialogView();

            var commands = new IMenuCommand[]
            {
                new LoadTasksCommand(mainForm, taskService),
                new LoadEmployeesCommand(mainForm, employeeService),
                new LoadAssignedTasksCommand(mainForm, dialogForm, assignedTaskDialogView,
                                             taskService, employeeService, assignedTaskService),
                new AddCommand(dialogForm, taskService, employeeService, assignedTaskService),
                new EditCommand(dialogForm, taskService, employeeService, assignedTaskService),
                new RemoveCommand(mainForm, taskService, employeeService, assignedTaskService),
            };

            var mainFormPresenter = new MainFormPresenter(
                mainForm,
                employeesDataListView,
                tasksDataListView,
                assignedTasksDataListView,
                systemInformationService,
                commands);

            var dialogFormPresenter = new DialogFormPresenter(
                dialogForm,
                taskService,
                employeeService,
                assignedTaskService,
                systemInformationService,
                validateAssignmentService,
                commands);

            Application.Run(mainForm);
        }
Esempio n. 8
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DataListView != null && DataListView.DataSource == null)
            {
                DataListView.DataSource = SurveyRulesList;
                DataListView.DataBind();
            }
        }
Esempio n. 9
0
        public DataListView <ProfileListingView> GetProfiles([FromBody] ProfileFilterView filter)
        {
            var list       = BusinessFacade.GetBSO <ProfileBSO>().GetProfiles(filter, filter.Page, filter.PageSize);
            var totalCount = BusinessFacade.GetBSO <ProfileBSO>().GetProfilesTotalCount(filter);
            var result     = new DataListView <ProfileListingView>()
            {
                DataList   = GetProfileListingView(list),
                TotalCount = totalCount
            };

            return(result);
        }
Esempio n. 10
0
        private void ParseRules(string xml)
        {
            var survey       = SenseNet.ContentRepository.Content.Create(PortalContext.Current.ContextNode);
            var customFields = survey.Fields["FieldSettingContents"] as ReferenceField;
            var questions    = customFields.OriginalValue as List <Node>;
            var pageBreaks   = (from q in questions where q.NodeType.Name == "PageBreakFieldSetting" select q).Count();

            var doc = new XmlDocument();

            try
            {
                doc.LoadXml(xml);
            }
            catch
            {
                return;
            }

            _selectedQuestion = doc.DocumentElement.GetAttribute("Question");

            if (_selectedQuestion == "-100")
            {
                DataListView.DataSource = null;
                DataListView.DataBind();
                return;
            }

            foreach (XPathNavigator node in doc.DocumentElement.CreateNavigator().SelectChildren(XPathNodeType.Element))
            {
                var answer     = node.GetAttribute("Answer", "");
                var answerId   = node.GetAttribute("AnswerId", "");
                var jumpToPage = node.Value;
                SurveyRulesList.Add(new SurveyRule(answer, answerId, jumpToPage, pageBreaks));
            }

            var chfs       = ChoiceFieldSettings.FirstOrDefault(fs => fs.Name == _selectedQuestion);
            var allowExtra = chfs != null && chfs.AllowExtraValue.HasValue && chfs.AllowExtraValue.Value;

            if (allowExtra && !SurveyRulesList.Any(sr => sr.AnswerId == SurveyRule.EXTRAVALUEID))
            {
                SurveyRulesList.Add(new SurveyRule(SurveyRule.GetExtraValueText(), SurveyRule.EXTRAVALUEID, "", pageBreaks));
            }
            else if (!allowExtra)
            {
                SurveyRulesList.RemoveAll(sr => sr.AnswerId == SurveyRule.EXTRAVALUEID);
            }

            DdlSurveyQuestions.SelectedValue = _selectedQuestion;

            DataListView.DataSource = SurveyRulesList;
            DataListView.DataBind();
        }
        public static void SetupForFeature()
        {
            Utils.SetupResourceDictionary();
            var   mockEventAggregator           = new Mock <IEventAggregator>();
            IView manageVariableListViewControl = new DataListView();
            var   viewModel = new DataListViewModel(mockEventAggregator.Object);

            viewModel.InitializeDataListViewModel(new Mock <IResourceModel>().Object);
            manageVariableListViewControl.DataContext = viewModel;

            Utils.ShowTheViewForTesting(manageVariableListViewControl);
            FeatureContext.Current.Add(Utils.ViewNameKey, manageVariableListViewControl);
            FeatureContext.Current.Add(Utils.ViewModelNameKey, viewModel);
            FeatureContext.Current.Add("eventAggregator", mockEventAggregator);
        }
Esempio n. 12
0
        private void CenterItem()
        {
            if (DataListView.SelectedIndex < 0)
            {
                return;
            }

            var panel = DataListView.ItemsPanelRoot as LoopItemsPanel;
            var item  = DataListView.ContainerFromIndex(DataListView.SelectedIndex) as ListViewItem;

            if (panel != null && item != null)
            {
                panel.ScrollToItem(item);
            }
        }
Esempio n. 13
0
        private void DataListView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var item = DataListView.GetItemAt(e.X, e.Y);

            if (item == null)
            {
                return;
            }

            var obj = objList[item.Index] as TabularNamedObject;

            if (obj != null)
            {
                UI.UIController.Current.Goto(obj);
            }
        }
Esempio n. 14
0
 private void OnCheckClearClick(DataListView dataListView, CheckBox chk)
 {
     if (dataListView.SelectedItems.Count == 0)
     {
         foreach (OLVListItem selectedObject in dataListView.Items)
         {
             selectedObject.Checked = chk.Checked;
         }
     }
     else
     {
         foreach (OLVListItem selectedObject in dataListView.SelectedItems)
         {
             selectedObject.Checked = chk.Checked;
         }
     }
 }
Esempio n. 15
0
        /// <summary>
        /// Sets bounds and figures out how much information to display on-screen
        /// </summary>
        private void SizeControls()
        {
            ////////////////
            //Assembly list view resize
            ////////////////

            AssemblyListView.Width = this.ClientSize.Width;

            ////////////////
            //Data list view resize
            ////////////////

            //Fit to bounds (docking property manages other bounds)

            DataListView.Width = this.ClientSize.Width;
            DataListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

            int ColumnsWidth = DataListView.Columns[0].Width + DataListView.Columns[1].Width + DataListView.Columns[2].Width;

            if (ColumnsWidth >= this.ClientSize.Width && DisplayPanels > 1)
            {
                DisplayPanels--;
                PanelSizes[DisplayPanels] = ColumnsWidth;

                SetAddressTotal();
                UpdateAddresses(0, TotalAddresses); //TODO make function to use readarray to recompute rather than reread
                DataListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }
            else if (PanelSizes[DisplayPanels - 1] <= this.ClientSize.Width && DisplayPanels < 4)
            {
                DisplayPanels++;

                SetAddressTotal();
                UpdateAddresses(0, TotalAddresses); //here too
                DataListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }

            ////////////////
            //Mouse Grabber resize
            ////////////////
            GrabMouse.SetBounds(DataListView.Bounds.X,                                                                       // + DataListView.Items[0].SubItems[1].Bounds.X,
                                DataListView.Bounds.Y + 0,
                                DataListView.Items[0].SubItems[2].Bounds.X + DataListView.Items[0].SubItems[2].Bounds.Width, // - DataListView.Items[0].SubItems[1].Bounds.X,
                                DataListView.Bounds.Height);
        }
Esempio n. 16
0
        public MainForm()
        {
            InitializeComponent();

            DoubleBuffered        = true;
            employeesDataListView = new DataListView()
            {
                Dock = DockStyle.Fill
            };
            tasksDataListView = new DataListView()
            {
                Dock = DockStyle.Fill
            };
            assignedTasksDataListView = new DataListView()
            {
                Dock = DockStyle.Fill
            };
        }
Esempio n. 17
0
        public ObjectPickerForm()
        {
            base.Name = "ObjectPickerForm";
            base.SupportModifyResultSize = false;
            DataListView dataListView = new DataListView();

            dataListView.AutoGenerateColumns = false;
            dataListView.Cursor        = Cursors.Default;
            dataListView.Dock          = DockStyle.Fill;
            dataListView.Location      = new Point(0, 0);
            dataListView.Name          = "resultListView";
            dataListView.Size          = new Size(498, 333);
            dataListView.TabIndex      = 2;
            dataListView.VirtualMode   = true;
            dataListView.ItemActivate += this.resultListView_ItemActivate;
            base.ListControlPanel.Controls.Add(dataListView);
            base.ResultListView = dataListView;
        }
Esempio n. 18
0
        public void SaveDataListViewSettings(DataListView listView)
        {
            if (listView == null)
            {
                throw new ArgumentNullException();
            }
            int count = listView.Columns.Count;

            DataListViewSettings.SerializableColumnInfo[] array = new DataListViewSettings.SerializableColumnInfo[count];
            for (int i = 0; i < count; i++)
            {
                array[listView.Columns[i].DisplayIndex] = new DataListViewSettings.SerializableColumnInfo(listView.Columns[i].Name, listView.Columns[i].Width, listView.Columns[i].DisplayIndex);
            }
            if (this.DataListViewInfo == null)
            {
                this.DataListViewInfo = new Hashtable();
            }
            this.DataListViewInfo[listView.Name] = new DataListViewSettings.SerializableDataListViewInfo(array, listView.SortDirection, listView.SortProperty, listView.IsColumnsWidthDirty);
        }
Esempio n. 19
0
        public void SetArchiveDumpData(FetchData data)
        {
            DataListView.Items.Clear();
            DataListView.BeginUpdate();
            DateTime[] dates = data.getDateTimestamps();
            int        count = dates.Length;

            double[] values = data.getValues()[0];
            for (var i = 0; i < count; i++)
            {
                if (double.IsNaN(data.getValues()[0][i]))
                {
                    continue;
                }
                ListViewItem lvi = DataListView.Items.Add(dates[i].ToString());
                lvi.SubItems.Add(values[i].ToString());
            }
            DataListView.EndUpdate();
        }
Esempio n. 20
0
 public void LoadDataListViewSettings(DataListView listView)
 {
     if (listView == null)
     {
         throw new ArgumentNullException();
     }
     listView.BeginUpdate();
     DataListViewSettings.SerializableDataListViewInfo serializableDataListViewInfo = this.FindSuitableSetting(listView);
     if (serializableDataListViewInfo == null)
     {
         listView.SortDirection = ListSortDirection.Ascending;
     }
     else
     {
         listView.SortDirection       = serializableDataListViewInfo.SortDirection;
         listView.SortProperty        = serializableDataListViewInfo.SortProperty;
         listView.IsColumnsWidthDirty = serializableDataListViewInfo.IsColumnsWidthDirty;
         int       length    = serializableDataListViewInfo.Columns.GetLength(0);
         ArrayList arrayList = new ArrayList(length);
         int       num       = 0;
         for (int i = 0; i < length; i++)
         {
             if (!string.IsNullOrEmpty(serializableDataListViewInfo.Columns[i].ColumnName))
             {
                 ExchangeColumnHeader exchangeColumnHeader = listView.AvailableColumns[serializableDataListViewInfo.Columns[i].ColumnName];
                 exchangeColumnHeader.Visible      = true;
                 exchangeColumnHeader.Width        = serializableDataListViewInfo.Columns[i].ColumnWidth;
                 exchangeColumnHeader.DisplayIndex = num++;
                 arrayList.Add(exchangeColumnHeader);
             }
         }
         if (arrayList.Count > 0)
         {
             foreach (ExchangeColumnHeader exchangeColumnHeader2 in listView.AvailableColumns)
             {
                 exchangeColumnHeader2.Visible = arrayList.Contains(exchangeColumnHeader2);
             }
         }
     }
     listView.EndUpdate();
 }
        private void UpdateItem()
        {
            if (this.ListView != null)
            {
                this.ListView.InternalUpdateItem(this);
            }
            DataTreeListViewColumnMapping dataTreeListViewColumnMapping = this.ColumnMapping;

            if (dataTreeListViewColumnMapping != null)
            {
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this.DataSource);
                for (int i = 0; i < dataTreeListViewColumnMapping.PropertyNames.Count; i++)
                {
                    PropertyDescriptor propertyDescriptor;
                    if (!string.IsNullOrEmpty(dataTreeListViewColumnMapping.PropertyNames[i]) && (propertyDescriptor = properties[dataTreeListViewColumnMapping.PropertyNames[i]]) != null && i < base.SubItems.Count)
                    {
                        base.SubItems[i].Text = this.ListView.FormatRawValueByColumn(DataListView.GetPropertyValue(this.DataSource, propertyDescriptor), this.ListView.Columns[i]);
                    }
                }
            }
        }
Esempio n. 22
0
        private void DataStartSelection(object sender, MouseEventArgs e)
        {
            //Figure out where the user is clicking on the data listview
            int Row      = (e.Y - ColumnHeight) / ItemHeight;
            int RowIndex = 0;

            if (e.X > DataListView.Items[0].SubItems[1].Bounds.X && e.X < DataListView.Items[0].SubItems[1].Bounds.X + DataListView.Items[0].SubItems[1].Bounds.Width)
            {
                RowIndex = (int)((e.X - DataListView.Items[0].SubItems[1].Bounds.X) / FontWidth);
            }

            //Update the range (including end position since were selecting one character so far)
            DataSelection.StartIndex = RowIndex;
            DataSelection.EndIndex   = RowIndex;

            DataSelection.StartRow = Row;
            DataSelection.EndRow   = DataSelection.StartRow;

            //Force a redraw
            DataListView.Refresh();
        }
Esempio n. 23
0
        private void ParseRules(string xml)
        {
            var survey       = SenseNet.ContentRepository.Content.Create(PortalContext.Current.ContextNode);
            var customFields = survey.Fields["FieldSettingContents"] as ReferenceField;
            var questions    = customFields.OriginalValue as List <SenseNet.ContentRepository.Storage.Node>;
            var pageBreaks   = from q in questions where q.NodeType.Name == "PageBreakFieldSetting" select q;

            var doc = new XmlDocument();

            try
            {
                doc.LoadXml(xml);
            }
            catch
            {
                return;
            }

            _selectedQuestion = doc.DocumentElement.GetAttribute("Question");

            if (_selectedQuestion == "-100")
            {
                DataListView.DataSource = null;
                DataListView.DataBind();
                return;
            }

            foreach (XPathNavigator node in doc.DocumentElement.CreateNavigator().SelectChildren(XPathNodeType.Element))
            {
                var answer     = node.GetAttribute("Answer", "");
                var answerId   = node.GetAttribute("AnswerId", "");
                var jumpToPage = node.Value;
                SurveyRulesList.Add(new SurveyRule(answer, answerId, jumpToPage, pageBreaks.Count()));
            }

            DdlSurveyQuestions.SelectedValue = _selectedQuestion;

            DataListView.DataSource = SurveyRulesList;
            DataListView.DataBind();
        }
Esempio n. 24
0
        private void DataMouseCapture(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                int Row      = (e.Y - ColumnHeight) / ItemHeight;
                int RowIndex = 0;

                //Check if selecting hex section
                if (e.X > DataListView.Items[0].SubItems[1].Bounds.X && e.X < DataListView.Items[0].SubItems[1].Bounds.X + DataListView.Items[0].SubItems[1].Bounds.Width)
                {
                    RowIndex = (int)((e.X - DataListView.Items[0].SubItems[1].Bounds.X) / FontWidth) + 1;
                }

                //Check if row or index has changed for selection
                if (DataSelection.EndRow != Row || DataSelection.EndIndex != RowIndex)
                {
                    //Update with new values and refresh
                    DataSelection.EndRow   = Row;
                    DataSelection.EndIndex = RowIndex;
                    DataListView.Refresh();
                }
            }
        }
Esempio n. 25
0
 protected override void OnExecuting(out bool cancelled)
 {
     base.OnExecuting(ref cancelled);
     if (this.DataListViewResultPane != null && this.Setting.IsSelectionCommand && this.Setting.Operation == CommandOperation.Delete)
     {
         DataListView listControl = this.DataListViewResultPane.ListControl;
         if (listControl.SelectedIndices.Count > 0 && listControl.SelectedIndices.Count != listControl.Items.Count)
         {
             int num = (listControl.FocusedItem != null) ? listControl.FocusedItem.Index : -1;
             if (num < 0)
             {
                 num = listControl.SelectedIndices[listControl.SelectedIndices.Count - 1];
             }
             int num2 = num;
             if (listControl.SelectedIndices.Contains(num))
             {
                 num2 = num + 1;
                 while (num2 < listControl.Items.Count && listControl.SelectedIndices.Contains(num2))
                 {
                     num2++;
                 }
             }
             if (num2 >= listControl.Items.Count)
             {
                 num2 = num - 1;
                 while (num2 >= 0 && listControl.SelectedIndices.Contains(num2))
                 {
                     num2--;
                 }
             }
             if (num2 >= 0 && num2 < listControl.Items.Count)
             {
                 this.rowIdToSelectAfterDelete = listControl.GetRowIdentity(listControl.GetRowFromItem(listControl.Items[num2]));
             }
         }
     }
 }
        private void GetSAPData(string oDataQuery)
        {
            // Always ensure there is a valid cached access token before querying GWM.
            // Pass this page object as the parameter.
            AADAuthHelper.EnsureValidAccessToken(this);

            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.Accept]        = "application/json";
                client.Headers[HttpRequestHeader.Authorization] = "Bearer " + AADAuthHelper.AccessToken.Item1;
                var jsonString = client.DownloadString(SAP_ODATA_URL + oDataQuery);
                var jsonValue  = JObject.Parse(jsonString)["d"]["results"];
                var dataCol    = jsonValue.ToObject <List <DataModel> >();

                var dataList = dataCol.Select((item) =>
                {
                    // replace the property names with names that match your data model class.
                    return(item.Name + " " + item.Date + " " + item.Location);
                }).ToArray();

                DataListView.DataSource = dataList;
                DataListView.DataBind();
            }
        }
Esempio n. 27
0
 private static void SyncSortSupportDescriptions(DataListView dataListView, UIPresentationProfile uiPresentationProfile, DataTableLoaderView dataTableLoaderView)
 {
     if (uiPresentationProfile != null)
     {
         foreach (ResultsColumnProfile resultsColumnProfile in uiPresentationProfile.DisplayedColumnCollection)
         {
             dataTableLoaderView.SortSupportDescriptions.Add(new SortSupportDescription(resultsColumnProfile.Name, resultsColumnProfile.SortMode, resultsColumnProfile.CustomComparer, resultsColumnProfile.CustomFormatter, resultsColumnProfile.FormatProvider, resultsColumnProfile.FormatString, resultsColumnProfile.DefaultEmptyText));
         }
     }
     using (IEnumerator <ExchangeColumnHeader> enumerator = dataListView.AvailableColumns.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ExchangeColumnHeader columnHeader = enumerator.Current;
             if (columnHeader.IsSortable)
             {
                 if (!dataTableLoaderView.SortSupportDescriptions.Any((SortSupportDescription obj) => string.Compare(obj.ColumnName, columnHeader.Name, StringComparison.OrdinalIgnoreCase) == 0))
                 {
                     dataTableLoaderView.SortSupportDescriptions.Add(new SortSupportDescription(columnHeader.Name, SortMode.NotSpecified, null, columnHeader.CustomFormatter, columnHeader.FormatProvider, columnHeader.FormatString, columnHeader.DefaultEmptyText));
                 }
             }
         }
     }
 }
Esempio n. 28
0
        private DataListViewSettings.SerializableDataListViewInfo FindSuitableSetting(DataListView listView)
        {
            if (this.DataListViewInfo == null || this.DataListViewInfo[listView.Name] == null)
            {
                return(null);
            }
            DataListViewSettings.SerializableDataListViewInfo serializableDataListViewInfo = (DataListViewSettings.SerializableDataListViewInfo) this.DataListViewInfo[listView.Name];
            if (listView.AvailableColumns[serializableDataListViewInfo.SortProperty] == null)
            {
                return(null);
            }
            int length = serializableDataListViewInfo.Columns.GetLength(0);

            if (length > listView.AvailableColumns.Count)
            {
                return(null);
            }
            for (int i = 0; i < length; i++)
            {
                if (!string.IsNullOrEmpty(serializableDataListViewInfo.Columns[i].ColumnName) && listView.AvailableColumns[serializableDataListViewInfo.Columns[i].ColumnName] == null)
                {
                    return(null);
                }
            }
            return(serializableDataListViewInfo);
        }
Esempio n. 29
0
 public ColumnPickerDialog(DataListView owner) : this()
 {
     this.list = owner;
     this.InitializeLists();
 }
Esempio n. 30
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.btnFill       = new System.Windows.Forms.Button();
     this.dataListView1 = new CRC.Controls.DataListView();
     this.btnClear      = new System.Windows.Forms.Button();
     this.btnToXML      = new System.Windows.Forms.Button();
     this.btnFromXML    = new System.Windows.Forms.Button();
     this.SuspendLayout();
     //
     // btnFill
     //
     this.btnFill.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnFill.BackColor = System.Drawing.Color.DeepSkyBlue;
     this.btnFill.Cursor    = System.Windows.Forms.Cursors.Hand;
     this.btnFill.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
     this.btnFill.ForeColor = System.Drawing.Color.Navy;
     this.btnFill.Location  = new System.Drawing.Point(33, 169);
     this.btnFill.Name      = "btnFill";
     this.btnFill.Size      = new System.Drawing.Size(75, 23);
     this.btnFill.TabIndex  = 4;
     this.btnFill.Text      = "Fill";
     this.btnFill.UseVisualStyleBackColor = false;
     this.btnFill.Click += new System.EventHandler(this.btnFill_Click);
     //
     // dataListView1
     //
     this.dataListView1.AutoDiscovery            = true;
     this.dataListView1.BackColor                = System.Drawing.SystemColors.Control;
     this.dataListView1.BorderStyle              = System.Windows.Forms.BorderStyle.FixedSingle;
     this.dataListView1.Cursor                   = System.Windows.Forms.Cursors.Hand;
     this.dataListView1.DataBindThreading        = true;
     this.dataListView1.DataMember               = "";
     this.dataListView1.DataSource               = null;
     this.dataListView1.DeSerializationThreading = true;
     this.dataListView1.ForeColor                = System.Drawing.Color.Blue;
     this.dataListView1.FullRowSelect            = true;
     this.dataListView1.HeaderStyle              = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
     this.dataListView1.Location                 = new System.Drawing.Point(23, 32);
     this.dataListView1.MultiSelect              = false;
     this.dataListView1.Name = "dataListView1";
     this.dataListView1.SerializationThreading = true;
     this.dataListView1.Size     = new System.Drawing.Size(336, 173);
     this.dataListView1.TabIndex = 5;
     this.dataListView1.UnavailableDataMessage          = "No data available.";
     this.dataListView1.UseCompatibleStateImageBehavior = false;
     this.dataListView1.View          = System.Windows.Forms.View.Details;
     this.dataListView1.ItemActivate += new System.EventHandler(this.dataListView1_ItemActivate);
     //
     // btnClear
     //
     this.btnClear.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnClear.BackColor = System.Drawing.Color.CadetBlue;
     this.btnClear.Cursor    = System.Windows.Forms.Cursors.Hand;
     this.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
     this.btnClear.ForeColor = System.Drawing.Color.PowderBlue;
     this.btnClear.Location  = new System.Drawing.Point(110, 169);
     this.btnClear.Name      = "btnClear";
     this.btnClear.Size      = new System.Drawing.Size(75, 23);
     this.btnClear.TabIndex  = 6;
     this.btnClear.Text      = "Clear";
     this.btnClear.UseVisualStyleBackColor = false;
     this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
     //
     // btnToXML
     //
     this.btnToXML.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnToXML.BackColor = System.Drawing.Color.Gainsboro;
     this.btnToXML.Cursor    = System.Windows.Forms.Cursors.Hand;
     this.btnToXML.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.btnToXML.ForeColor = System.Drawing.SystemColors.Desktop;
     this.btnToXML.Location  = new System.Drawing.Point(191, 169);
     this.btnToXML.Name      = "btnToXML";
     this.btnToXML.Size      = new System.Drawing.Size(75, 23);
     this.btnToXML.TabIndex  = 7;
     this.btnToXML.Text      = "> Disk";
     this.btnToXML.UseVisualStyleBackColor = false;
     this.btnToXML.Click += new System.EventHandler(this.btnToXML_Click);
     //
     // btnFromXML
     //
     this.btnFromXML.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnFromXML.BackColor = System.Drawing.Color.Gainsboro;
     this.btnFromXML.Cursor    = System.Windows.Forms.Cursors.Hand;
     this.btnFromXML.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.btnFromXML.ForeColor = System.Drawing.SystemColors.Desktop;
     this.btnFromXML.Location  = new System.Drawing.Point(271, 169);
     this.btnFromXML.Name      = "btnFromXML";
     this.btnFromXML.Size      = new System.Drawing.Size(75, 23);
     this.btnFromXML.TabIndex  = 8;
     this.btnFromXML.Text      = "< Disk";
     this.btnFromXML.UseVisualStyleBackColor = false;
     this.btnFromXML.Click += new System.EventHandler(this.btnFromXML_Click);
     //
     // FrmDataListView
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(7, 16);
     this.ClientSize        = new System.Drawing.Size(497, 305);
     this.Controls.Add(this.btnFromXML);
     this.Controls.Add(this.btnToXML);
     this.Controls.Add(this.btnClear);
     this.Controls.Add(this.btnFill);
     this.Controls.Add(this.dataListView1);
     this.Font        = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.MinimumSize = new System.Drawing.Size(344, 200);
     this.Name        = "FrmDataListView";
     this.Text        = "DataListView Demo";
     this.ResumeLayout(false);
 }