Beispiel #1
0
        private Cursor GetDragCursor(Image image)
        {
            if (image == null)
            {
                return(Cursors.Default);
            }
            image = ResizeImage(imageListView.ThumbnailSize.Width, image);
            var imageBounds    = new Rectangle(new Point(0, 0), image.Size);
            var result         = new Bitmap(imageBounds.Width, imageBounds.Height);
            var resultGraphics = Graphics.FromImage(result);

            float[][] matrixItems =
            {
                new float[] { 1, 0, 0,    0, 0 },
                new float[] { 0, 1, 0,    0, 0 },
                new float[] { 0, 0, 1,    0, 0 },
                new[]       { 0, 0, 0, 0.7f, 0 },
                new float[] { 0, 0, 0,    0, 1 }
            };
            var colorMatrix     = new ColorMatrix(matrixItems);
            var imageAttributes = new ImageAttributes();

            imageAttributes.SetColorMatrix(
                colorMatrix,
                ColorMatrixFlag.Default,
                ColorAdjustType.Bitmap);
            resultGraphics.DrawImage(image, imageBounds, imageBounds.X, imageBounds.Y, imageBounds.Width, imageBounds.Height, GraphicsUnit.Pixel, imageAttributes);
            var offset = new Point(imageBounds.Width / 2, imageBounds.Height / 2);

            return(GridDragDropHelper.CreateCursor(result, offset));
        }
Beispiel #2
0
 private void InitDargDropHelper()
 {
     if (_dragDropHelper != null || !_digitalInfo.Records.Any())
     {
         return;
     }
     _dragDropHelper            = new GridDragDropHelper(advBandedGridView, true, handledColumns: new[] { bandedGridColumnId, bandedGridColumnLogo });
     _dragDropHelper.AfterDrop += OnGridControlAfterDrop;
 }
Beispiel #3
0
        public void UpdateData(
            DigitalProductsContent content,
            IDigitalScheduleSettings scheduleSettings,
            Action onDataChanged)
        {
            Content          = content;
            ScheduleSettings = scheduleSettings;
            _onDataChanged   = onDataChanged;

            gridControl.DataSource = new BindingList <DigitalProduct>(Content.DigitalProducts);

            if (ListManager.Instance.ProductSources.All(productSource => String.IsNullOrEmpty(productSource.SubCategory)))
            {
                gridColumnCategory.RowCount   = 2;
                gridColumnSubCategory.Visible = false;
            }

            if (ListManager.Instance.LockedMode)
            {
                gridColumnWidth.OptionsColumn.ReadOnly          = true;
                gridColumnWidth.OptionsColumn.AllowEdit         = false;
                gridColumnHeight.OptionsColumn.ReadOnly         = true;
                gridColumnHeight.OptionsColumn.AllowEdit        = false;
                repositoryItemComboBoxProductName.TextEditStyle = TextEditStyles.DisableTextEditor;
            }

            repositoryItemComboBoxRateType.Items.Clear();
            repositoryItemComboBoxRateType.Items.AddRange(ListManager.Instance.PricingStrategies);
            repositoryItemComboBoxLocation.Items.Clear();
            repositoryItemComboBoxLocation.Items.AddRange(ListManager.Instance.ColumnPositions);

            if (_dragDropHelper == null)
            {
                _dragDropHelper            = new GridDragDropHelper(advBandedGridView, true, handledColumns: new[] { gridColumnPosition });
                _dragDropHelper.AfterDrop += DigitalProductsAfterDrop;
            }
        }
		public void LoadSchedule(bool quickLoad)
		{
			_allowToSave = false;
			_localSchedule = BusinessObjects.Instance.ScheduleManager.GetLocalSchedule();
			gridControlPrintProducts.DataSource = new BindingList<PrintProduct>(_localSchedule.PrintProducts);
			digitalProductListControl.UpdateData(_localSchedule,
				() =>
				{
					UpdateProductsCount();
					Controller.Instance.UpdateDigitalProductTab(_localSchedule.DigitalProducts.Any(p => !String.IsNullOrEmpty(p.Name)));
					if (_allowToSave)
						SettingsNotSaved = true;
				},
				activity =>
				{
					var propertyEditActivity = activity as PropertyEditActivity;
					if (propertyEditActivity != null)
						propertyEditActivity.Advertiser = Controller.Instance.HomeBusinessName.EditValue as String;
					BusinessObjects.Instance.ActivityManager.AddActivity(activity);
				});
			if (_dragDropHelper == null)
			{
				_dragDropHelper = new GridDragDropHelper(gridViewPrintProducts, true);
				_dragDropHelper.AfterDrop += PrintProductsAfterDrop;
			}
			if (!quickLoad)
			{
				LoadView();

				#region Print Products
				repositoryItemComboBox.Items.Clear();
				repositoryItemComboBox.Items.AddRange(Core.AdSchedule.ListManager.Instance.PublicationSources.Where(x => !x.Name.Equals("Default")).Select(x => x.Name).Distinct().ToArray());
				Controller.Instance.HomeClientType.Properties.Items.Clear();
				Controller.Instance.HomeClientType.Properties.Items.AddRange(Core.AdSchedule.ListManager.Instance.ClientTypes.ToArray());

				Controller.Instance.HomeBusinessName.EditValue = _localSchedule.BusinessName;
				Controller.Instance.HomeDecisionMaker.EditValue = _localSchedule.DecisionMaker;

				if (!string.IsNullOrEmpty(_localSchedule.ClientType))
					Controller.Instance.HomeClientType.SelectedIndex = Controller.Instance.HomeClientType.Properties.Items.IndexOf(_localSchedule.ClientType);

				Controller.Instance.HomeAccountNumberCheck.Checked = !string.IsNullOrEmpty(_localSchedule.AccountNumber);
				Controller.Instance.HomeAccountNumberText.EditValue = _localSchedule.AccountNumber;

				Controller.Instance.HomePresentationDate.EditValue = _localSchedule.PresentationDate;
				Controller.Instance.HomeFlightDatesStart.EditValue = _localSchedule.FlightDateStart;
				Controller.Instance.HomeFlightDatesEnd.EditValue = _localSchedule.FlightDateEnd;
				Controller.Instance.UpdatePrintProductTab(_localSchedule.PrintProducts.Any(p => !String.IsNullOrEmpty(p.Name)));
				#endregion

				CalcWeeksOnFlightDatesChange(null, EventArgs.Empty);
				Controller.Instance.UpdateOutputTabs(_localSchedule.PrintProducts.Select(x => x.Inserts.Count).Sum() > 0);
				xtraTabControlProducts_SelectedPageChanged(xtraTabControlProducts, new TabPageChangedEventArgs(null, xtraTabControlProducts.SelectedTabPage));
			}
			SettingsNotSaved = false;
			_allowToSave = true;
		}
Beispiel #5
0
        public void LoadSchedule(bool quickLoad)
        {
            _allowToSave   = false;
            _localSchedule = BusinessObjects.Instance.ScheduleManager.GetLocalSchedule();
            gridControlPrintProducts.DataSource = new BindingList <PrintProduct>(_localSchedule.PrintProducts);
            digitalProductListControl.UpdateData(_localSchedule,
                                                 () =>
            {
                UpdateProductsCount();
                Controller.Instance.UpdateDigitalProductTab(_localSchedule.DigitalProducts.Any(p => !String.IsNullOrEmpty(p.Name)));
                if (_allowToSave)
                {
                    SettingsNotSaved = true;
                }
            },
                                                 activity =>
            {
                var propertyEditActivity = activity as PropertyEditActivity;
                if (propertyEditActivity != null)
                {
                    propertyEditActivity.Advertiser = Controller.Instance.HomeBusinessName.EditValue as String;
                }
                BusinessObjects.Instance.ActivityManager.AddActivity(activity);
            });
            if (_dragDropHelper == null)
            {
                _dragDropHelper            = new GridDragDropHelper(gridViewPrintProducts, true);
                _dragDropHelper.AfterDrop += PrintProductsAfterDrop;
            }
            if (!quickLoad)
            {
                LoadView();

                #region Print Products
                repositoryItemComboBox.Items.Clear();
                repositoryItemComboBox.Items.AddRange(Core.AdSchedule.ListManager.Instance.PublicationSources.Where(x => !x.Name.Equals("Default")).Select(x => x.Name).Distinct().ToArray());
                Controller.Instance.HomeClientType.Properties.Items.Clear();
                Controller.Instance.HomeClientType.Properties.Items.AddRange(Core.AdSchedule.ListManager.Instance.ClientTypes.ToArray());

                Controller.Instance.HomeBusinessName.EditValue  = _localSchedule.BusinessName;
                Controller.Instance.HomeDecisionMaker.EditValue = _localSchedule.DecisionMaker;

                if (!string.IsNullOrEmpty(_localSchedule.ClientType))
                {
                    Controller.Instance.HomeClientType.SelectedIndex = Controller.Instance.HomeClientType.Properties.Items.IndexOf(_localSchedule.ClientType);
                }

                Controller.Instance.HomeAccountNumberCheck.Checked  = !string.IsNullOrEmpty(_localSchedule.AccountNumber);
                Controller.Instance.HomeAccountNumberText.EditValue = _localSchedule.AccountNumber;

                Controller.Instance.HomePresentationDate.EditValue = _localSchedule.PresentationDate;
                Controller.Instance.HomeFlightDatesStart.EditValue = _localSchedule.FlightDateStart;
                Controller.Instance.HomeFlightDatesEnd.EditValue   = _localSchedule.FlightDateEnd;
                Controller.Instance.UpdatePrintProductTab(_localSchedule.PrintProducts.Any(p => !String.IsNullOrEmpty(p.Name)));
                #endregion

                CalcWeeksOnFlightDatesChange(null, EventArgs.Empty);
                Controller.Instance.UpdateOutputTabs(_localSchedule.PrintProducts.Select(x => x.Inserts.Count).Sum() > 0);
                xtraTabControlProducts_SelectedPageChanged(xtraTabControlProducts, new TabPageChangedEventArgs(null, xtraTabControlProducts.SelectedTabPage));
            }
            SettingsNotSaved = false;
            _allowToSave     = true;
        }