Example #1
0
        private void ToggleDetailControlAnimation()
        {
            DetailControl.CurrentImage = _clickedImg;

            var currentPos    = _clickedContainer.TransformToVisual(ListControl).TransformPoint(new Point(0, 0));
            var targetPos     = GetTargetPosition();
            var targetRatio   = GetTargetSize().X / _clickedContainer.ActualWidth;
            var targetOffsetX = targetPos.X - currentPos.X;
            var targetOffsetY = targetPos.Y - currentPos.Y;

            ListControl.MoveItemAnimation(new Vector3((float)targetOffsetX, (float)targetOffsetY, 0f), (float)targetRatio);
            DetailControl.ToggleDetailGridAnimation(true);

            NavigationService.HistoryOperationsBeyondFrame.Push(() =>
            {
                var content = Frame.Content;
                if (content.GetType() == typeof(MainPage))
                {
                    DetailControl.HideDetailControl();
                    return(true);
                }
                else
                {
                    return(false);
                }
            });
        }
Example #2
0
        private void ToggleDetailControlAnimation()
        {
            var currentPos    = _clickedContainer.TransformToVisual(ListControl).TransformPoint(new Point(0, 0));
            var targetPos     = GetTargetPosition();
            var targetRatio   = GetTargetSize().X / _clickedContainer.ActualWidth;
            var targetOffsetX = targetPos.X - currentPos.X;
            var targetOffsetY = targetPos.Y - currentPos.Y;

            if (_titleStackVisual.Offset.Y == 0)
            {
                _restoreTitleStackStatus = true;
            }
            ToggleTitleStackAnimation(false);
            ToggleRefreshBtnAnimation(false);

            ListControl.MoveItemAnimation(new Vector3((float)targetOffsetX, (float)targetOffsetY, 0f), (float)targetRatio);
            DetailControl.CurrentImage = _clickedImg;
            DetailControl.ToggleDetailGridAnimation(true);

            NavigationService.AddOperation(() =>
            {
                DetailControl.HideDetailControl();
                return(true);
            });
        }
Example #3
0
        public async System.Threading.Tasks.Task ReStoreViewSettingDetailControlAsync()
        {
            using (var dt = UnitTestStatic.GetDataTable())
            {
                using (var dc = new DetailControl())
                {
                    dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle;
                    dc.DataTable = dt;
                    await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token);

                    var columnFilters = new List <ToolStripDataGridViewColumnFilter>
                    {
                        new ToolStripDataGridViewColumnFilter(dc.FilteredDataGridView.Columns[0])
                    };

                    columnFilters[0].ColumnFilterLogic.Operator  = "=";
                    columnFilters[0].ColumnFilterLogic.ValueText = "Halloween";
                    columnFilters[0].ColumnFilterLogic.Active    = true;

                    var text = ViewSetting.StoreViewSetting(dc.FilteredDataGridView, columnFilters);

                    var fn = System.IO.Path.Combine(FileSystemUtils.ExecutableDirectoryName(), "test.delete");
                    FileSystemUtils.FileDelete(fn);
                    FileSystemUtils.WriteAllText(fn, text);
                    dc.ReStoreViewSetting(fn);
                    FileSystemUtils.FileDelete(fn);
                }
            }
        }
Example #4
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="FormDetail" /> class.
        /// </summary>
        /// <param name="dataTable">The data table.</param>
        /// <param name="uniqueFieldName">Name of the unique field.</param>
        /// <param name="setting">a FileSetting</param>
        /// <param name="readOnly">if set to <c>true</c> the data will not be editable</param>
        /// <param name="onlyErrors">if set to <c>true</c> non error will be hidden</param>
        /// <param name="frozenColumns">The frozen columns.</param>
        /// <param name="cancellationToken">The cancellation token</param>
        ///
        public FormDetail(DataTable dataTable, IEnumerable <string> uniqueFieldName, IFileSetting setting, bool readOnly,
                          bool onlyErrors, int frozenColumns, CancellationToken cancellationToken = default(CancellationToken))
        {
            Contract.Requires(dataTable != null);

            SuspendLayout();
            DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle
            {
                BackColor = System.Drawing.Color.Gainsboro
            };

            DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle
            {
                Alignment          = DataGridViewContentAlignment.MiddleLeft,
                BackColor          = System.Drawing.SystemColors.Window,
                Font               = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))),
                ForeColor          = System.Drawing.Color.Black,
                SelectionBackColor = System.Drawing.SystemColors.Highlight,
                SelectionForeColor = System.Drawing.SystemColors.HighlightText,
                WrapMode           = System.Windows.Forms.DataGridViewTriState.False
            };

            detailControl = new DetailControl
            {
                CancellationToken             = cancellationToken,
                AlternatingRowDefaultCellSyle = dataGridViewCellStyle1,
                DefaultCellStyle = dataGridViewCellStyle2,
                Dock             = DockStyle.Fill,
                Location         = new System.Drawing.Point(0, 0),
                Name             = "detailControl",
                ReadOnly         = readOnly,
                Size             = new System.Drawing.Size(767, 394),
                TabIndex         = 0,
                FileSetting      = setting
            };

            AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            ClientSize          = new System.Drawing.Size(767, 394);
            MinimumSize         = new System.Drawing.Size(100, 100);
            Controls.Add(this.detailControl);
            Icon       = global::CsvToolLib.Resources.SubFormIcon;
            KeyPreview = true;
            Name       = "FormDetail";
            ResumeLayout(false);

            detailControl.DataTable = dataTable;

            // Need to set UniqueFieldName last
            detailControl.UniqueFieldName = uniqueFieldName;
            if (frozenColumns > 0)
            {
                detailControl.FrozenColumns = frozenColumns;
            }
            if (onlyErrors)
            {
                detailControl.OnlyShowErrors();
            }
        }
        private void ToggleDetailControlAnimation()
        {
            DetailControl.CurrentImage = _clickedImg;
            DetailControl.Show(_clickedContainer);

            NavigationService.AddOperation(() =>
            {
                DetailControl.Hide();
                return(true);
            });
        }
Example #6
0
        public void DetailControlTest()
        {
            using (var dt = new DataTable())
            {
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "ID",
                    DataType   = typeof(int)
                });
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "Text",
                    DataType   = typeof(string)
                });
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "Date",
                    DataType   = typeof(DateTime)
                });
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "Bool",
                    DataType   = typeof(bool)
                });
                for (var line = 1; line < 5000; line++)
                {
                    var row = dt.NewRow();
                    row[0] = line;
                    row[1] = $"This is text {line / 2}";
                    row[2] = new DateTime(2001, 6, 6).AddHours(line * 3);
                    row[3] = line % 3 == 0;
                    if (SecureString.Random.Next(1, 10) == 5)
                    {
                        row.SetColumnError(SecureString.Random.Next(0, 3), "Error");
                    }
                    if (SecureString.Random.Next(1, 50) == 5)
                    {
                        row.RowError = "Row Error";
                    }
                    dt.Rows.Add(row);
                }

                using (var dc = new DetailControl())
                {
                    dc.Show();
                    dc.DataTable = dt;
                    dc.OnlyShowErrors();
                    dc.MoveMenu();
                }
            }
        }
        public async System.Threading.Tasks.Task DetailControlTestAsync()
        {
            using (var dt = new DataTable())
            {
                dt.Columns.Add(new DataColumn {
                    ColumnName = "ID", DataType = typeof(int)
                });
                dt.Columns.Add(new DataColumn {
                    ColumnName = "Text", DataType = typeof(string)
                });
                dt.Columns.Add(new DataColumn {
                    ColumnName = "Date", DataType = typeof(DateTime)
                });
                dt.Columns.Add(new DataColumn {
                    ColumnName = "Bool", DataType = typeof(bool)
                });
                for (var line = 1; line < 5000; line++)
                {
                    var row = dt.NewRow();
                    row[0] = line;
                    row[1] = $"This is text {line / 2}";
                    row[2] = new DateTime(2001, 6, 6).AddHours(line * 3);
                    row[3] = line % 3 == 0;
                    if (random.Next(1, 10) == 5)
                    {
                        row.SetColumnError(random.Next(0, 3), "Error");
                    }
                    if (random.Next(1, 50) == 5)
                    {
                        row.RowError = "Row Error";
                    }
                    dt.Rows.Add(row);
                }

                using (var dc = new DetailControl())
                {
                    dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle;
                    dc.Show();
                    dc.DataTable = dt;

                    await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token);

                    dc.OnlyShowErrors = true;
                    dc.MoveMenu();
                }
            }
        }
 public DetailControlLoader(DetailControl detailControl) : base(
         table => detailControl.DataTable = table,
         () => detailControl.DataTable, detailControl.RefreshDisplayAsync,
         func => detailControl.LoadNextBatchAsync        = func,
         () => detailControl.ToolStripButtonNext.Enabled = false,
         wrapper =>
 {
     detailControl.EndOfFile = () =>
                               wrapper?.EndOfFile ?? true;
     detailControl.SafeBeginInvoke(() =>
     {
         detailControl.ToolStripButtonNext.Visible = wrapper != null;
         detailControl.ToolStripButtonNext.Enabled = wrapper != null;
     });
 })
 {
 }
Example #9
0
        private void ToggleDetailControlAnimation()
        {
            DetailControl.CurrentImage = _clickedImg;
            DetailControl.Show(_clickedContainer);

            var key = (string)App.Current.Resources["GestureKey"];

            if (!LocalSettingHelper.HasValue(key))
            {
                ToggleGestureTipsControlAnimation(true, 500);
            }

            NavigationService.AddOperation(() =>
            {
                DetailControl.Hide();
                return(true);
            });
        }
Example #10
0
        /// <summary>
        /// Handles the cascaded filter internal logic.
        /// </summary>
        /// <remarks>
        /// This method should be called in your custom dialog control that supports data filtering.
        /// Call it when the value in your control is changed.
        /// </remarks>
        protected void OnFilterChanged()
        {
            if (DetailControl != null)
            {
                ResetFilter();
                if (Enabled)
                {
                    FilterData();
                }

                DetailControl.ResetFilter();
                if (DetailControl.Enabled)
                {
                    DetailControl.FillData(this);
                    DetailControl.OnFilterChanged();
                }
            }
        }
Example #11
0
        private void ToggleDetailControlAnimation()
        {
            var currentPos    = _clickedContainer.TransformToVisual(ListControl).TransformPoint(new Point(0, 0));
            var targetPos     = GetTargetPosition();
            var targetRatio   = GetTargetSize().X / _clickedContainer.ActualWidth;
            var targetOffsetX = targetPos.X - currentPos.X;
            var targetOffsetY = targetPos.Y - currentPos.Y;

            if (targetPos.Y <= TITLE_GRID_HEIGHT)
            {
                if (ListControl.GetScrollViewer().VerticalOffset > 70 && !_hideTitleBarForDetail)
                {
                    _hideTitleBarForDetail = true;
                    ToggleTitleBarAnimation(false);
                }
                else
                {
                    Canvas.SetZIndex(TitleGrid, 1);
                    Canvas.SetZIndex(LoadingGrid, 0);
                    Canvas.SetZIndex(ContentGrid, 2);
                    Canvas.SetZIndex(DetailControl, 3);
                }
            }

            ListControl.MoveItemAnimation(new Vector3((float)targetOffsetX, (float)targetOffsetY, 0f), (float)targetRatio);
            DetailControl.CurrentImage = _clickedImg;
            DetailControl.ToggleDetailGridAnimation(true);

            NavigationService.HistoryOperationsBeyondFrame.Push(() =>
            {
                var content = Frame.Content;
                if (content.GetType() == typeof(MainPage))
                {
                    DetailControl.HideDetailControl();
                    return(true);
                }
                else
                {
                    return(false);
                }
            });
        }
Example #12
0
        public void SortTest()
        {
            using (var dt = new DataTable())
            {
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "ID",
                    DataType   = typeof(int)
                });
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "Text",
                    DataType   = typeof(string)
                });
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "Date",
                    DataType   = typeof(DateTime)
                });
                dt.Columns.Add(new DataColumn
                {
                    ColumnName = "Bool",
                    DataType   = typeof(bool)
                });
                for (var line = 1; line < 5000; line++)
                {
                    var row = dt.NewRow();
                    row[0] = SecureString.Random.Next(1, 5000);
                    row[1] = $"This is text {line / 2}";
                    row[2] = new DateTime(2001, 6, 6).AddHours(line * 3);
                    row[3] = line % 3 == 0;
                    dt.Rows.Add(row);
                }

                using (var dc = new DetailControl())
                {
                    dc.Show();
                    dc.DataTable = dt;
                    dc.Sort("ID", ListSortDirection.Ascending);
                }
            }
        }
        public async System.Threading.Tasks.Task SortTestAsync()
        {
            using (var dt = new DataTable())
            {
                dt.Columns.Add(new DataColumn {
                    ColumnName = "ID", DataType = typeof(int)
                });
                dt.Columns.Add(new DataColumn {
                    ColumnName = "Text", DataType = typeof(string)
                });
                dt.Columns.Add(new DataColumn {
                    ColumnName = "Date", DataType = typeof(DateTime)
                });
                dt.Columns.Add(new DataColumn {
                    ColumnName = "Bool", DataType = typeof(bool)
                });
                for (var line = 1; line < 5000; line++)
                {
                    var row = dt.NewRow();
                    row[0] = random.Next(1, 5000);
                    row[1] = $"This is text {line / 2}";
                    row[2] = new DateTime(2001, 6, 6).AddHours(line * 3);
                    row[3] = line % 3 == 0;
                    dt.Rows.Add(row);
                }

                using (var dc = new DetailControl())
                {
                    dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle;
                    dc.Show();
                    dc.DataTable = dt;
                    await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token);

                    dc.Sort("ID", ListSortDirection.Ascending);
                }
            }
        }
Example #14
0
        private void ToggleDetailControlAnimation()
        {
            var position  = DetailControl.GetTargetPosition();
            var titleRect = TitleStack.TransformToVisual(Window.Current.Content)
                            .TransformBounds(new Rect(0, 0, TitleStack.ActualWidth, TitleStack.ActualHeight));
            var clickedItemRect = _clickedContainer.TransformToVisual(Window.Current.Content)
                                  .TransformBounds(new Rect(0, 0, _clickedContainer.ActualWidth, _clickedContainer.ActualHeight));

            titleRect.Intersect(clickedItemRect);
            if (!titleRect.IsEmpty)
            {
                _restoreTitleStackStatus = true;
                ToggleTitleStackAnimation(false);
            }

            DetailControl.CurrentImage = _clickedImg;
            DetailControl.Show(_clickedContainer);

            NavigationService.AddOperation(() =>
            {
                DetailControl.Hide();
                return(true);
            });
        }
Example #15
0
 private void GalleryGridViewControl_OnClickItemStarted(ImageViewModel imageViewModel)
 {
     DetailControl.PhotoDetailImageViewModel = imageViewModel;
     DetailControl.Visibility = Visibility.Visible;
     DetailControl.Show();
 }