Example #1
0
        private bool ProportionalPromptProportion(bool isForSameShapes = false)
        {
            var noOfShapes = GetSelectedShapes()?.Count;

            if (!noOfShapes.HasValue || noOfShapes < 2)
            {
                _errorHandler.ProcessErrorCode(ResizeLabErrorHandler.ErrorCodeInvalidSelection, ResizeLabMain.AdjustProportionally_ErrorParameters);
                return(false);
            }
            if (isForSameShapes)
            {
                var errorCode = IsValidShapes(GetSelectedShapes());

                if (errorCode != -1)
                {
                    _errorHandler.ProcessErrorCode(errorCode);
                    return(false);
                }
            }
            if (_adjustProportionallySettingsDialog == null || !_adjustProportionallySettingsDialog.IsOpen)
            {
                _adjustProportionallySettingsDialog = new AdjustProportionallySettingsDialog(_resizeLab, noOfShapes.GetValueOrDefault());
                _adjustProportionallySettingsDialog.ShowDialog();
            }
            else
            {
                _adjustProportionallySettingsDialog.Activate();
            }

            if (_resizeLab.AdjustProportionallyProportionList?.Count != noOfShapes.Value) // User probably closed the dialog
            {
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// Check if the selection is of shape type.
        /// </summary>
        /// <param name="selection"></param>
        /// <param name="handleError"></param>
        /// <param name="optionalParameters"></param>
        /// <returns></returns>
        internal bool IsSelectionValid(PowerPoint.Selection selection, bool handleError = true, string[] optionalParameters = null)
        {
            if (selection.Type != PowerPoint.PpSelectionType.ppSelectionShapes)
            {
                if (handleError)
                {
                    _errorHandler.ProcessErrorCode(ResizeLabErrorHandler.ErrorCodeInvalidSelection, optionalParameters);
                }

                return(false);
            }
            return(true);
        }