public ImportJobViewModelBack(IUnityContainer container, ICatalogEntityFactory entityFactory, ImportJob item)
     : this(container, entityFactory, item, null, true)
 {
     ViewTitle = new ViewTitleBase()
     {
         Title = "Import job", SubTitle = DisplayName.ToUpper()
     };
 }
Example #2
0
        private void load()
        {
            anchorPosition = Anchor;

            float xPositionBox = anchorPosition != Anchor.Centre ?
                                 anchorPosition == Anchor.CentreLeft ?
                                 -1 * (800 / 2) : (800 / 2) : 0;
            float xSize = 801 / 3;

            AddInternal(
                ItemBox = new Box
            {
                Size     = new osuTK.Vector2(x: xSize, y: 111),
                Anchor   = Anchor.Centre,
                Origin   = anchorPosition,
                Position = new osuTK.Vector2(x: xPositionBox, y: 0),
                Colour   = DisplayColour,
            }
                );



            AddInternal(
                PackSpriteText = new SpriteText
            {
                Text   = DisplayName.ToUpper(),
                Font   = TCCFont.GetFont(weight: FontWeight.Medium, size: 49),
                Anchor = anchorPosition,
                Origin = Anchor.Centre,
            }
                );

            AddInternal(
                PackSizeSpriteText = new SpriteText
            {
                Text   = SizeConvert.SizeSuffix(PackSize),
                Font   = TCCFont.GetFont(weight: FontWeight.Thin, size: 49),
                Anchor = anchorPosition,
                Origin = Anchor.Centre,
            }
                );
            // Positions, since the only way to make sure it's in the middle of the box,
            // is to calculate the draw width, which is after the entire shape is loaded.
            PackSpriteText.Position =
                new osuTK.Vector2(
                    x: (ItemBox.DrawWidth / 2) * (anchorPosition == Anchor.Centre ? 0 : anchorPosition == Anchor.CentreLeft ? 1 : -1),
                    y: PackSizeSpriteText.DrawHeight / 2 * -1);
            PackSizeSpriteText.Position =
                new osuTK.Vector2(
                    x: (ItemBox.DrawWidth / 2) * (anchorPosition == Anchor.Centre ? 0 : anchorPosition == Anchor.CentreLeft ? 1 : -1),
                    y: PackSpriteText.DrawHeight / 2);
        }
Example #3
0
        private void DrawConnection(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 scale)
        {
            string text = DisplayName.ToUpper();

            //nasty
            if (GUI.Style.GetComponentStyle("ConnectionPanelLabel")?.Sprites.Values.First().First() is UISprite labelSprite)
            {
                Rectangle labelArea = GetLabelArea(labelPos, text, scale);
                labelSprite.Draw(spriteBatch, labelArea, IsPower ? GUI.Style.Red : Color.SteelBlue);
            }

            GUI.DrawString(spriteBatch, labelPos + Vector2.UnitY, text, Color.Black * 0.8f, font: GUI.SmallFont);
            GUI.DrawString(spriteBatch, labelPos, text, GUI.Style.TextColorBright, font: GUI.SmallFont);

            float connectorSpriteScale = (35.0f / connectionSprite.SourceRect.Width) * panel.Scale;

            connectionSprite.Draw(spriteBatch, position, scale: connectorSpriteScale);
        }
        private void DrawConnection(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 scale)
        {
            string  text     = DisplayName.ToUpper();
            Vector2 textSize = GUI.SmallFont.MeasureString(text);

            //nasty
            var labelSprite = GUI.Style.GetComponentStyle("ConnectionPanelLabel")?.Sprites.Values.First().First();

            if (labelSprite != null)
            {
                Rectangle labelArea = new Rectangle(labelPos.ToPoint(), textSize.ToPoint());
                labelArea.Inflate(10 * scale.X, 3 * scale.Y);
                labelSprite.Draw(spriteBatch, labelArea, IsPower ? GUI.Style.Red : Color.SteelBlue);
            }

            GUI.DrawString(spriteBatch, labelPos + Vector2.UnitY, text, Color.Black * 0.8f, font: GUI.SmallFont);
            GUI.DrawString(spriteBatch, labelPos, text, GUI.Style.TextColorBright, font: GUI.SmallFont);

            float connectorSpriteScale = (35.0f / connectionSprite.SourceRect.Width) * panel.Scale;

            connectionSprite.Draw(spriteBatch, position, scale: connectorSpriteScale);
        }
Example #5
0
        protected override void ExecuteTool(IDSFDataObject dataObject, int update)
        {
            var allErrors = new ErrorResultTO();
            var errors    = new ErrorResultTO();

            _executionResult = new List <string>();
            allErrors.MergeErrors(errors);
            InitializeDebug(dataObject);
            // Process if no errors
            try
            {
                TryExecute(dataObject, update, allErrors, errors);
            }
            catch (Exception ex)
            {
                Dev2Logger.Error(string.Format("{0} Exception", DisplayName), ex, GlobalConstants.WarewolfError);
                allErrors.AddError(ex.Message);
            }
            finally
            {
                // Handle Errors
                var hasErrors = allErrors.HasErrors();
                if (hasErrors)
                {
                    DisplayAndWriteError(DisplayName, allErrors);
                    var errorList = allErrors.MakeDataListReady();
                    dataObject.Environment.AddError(errorList);
                    dataObject.Environment.Assign(Result, DisplayName.ToUpper().Contains("Dropbox".ToUpper()) ? GlobalConstants.DropBoxFailure : null, update);
                }
                if (dataObject.IsDebugMode())
                {
                    DispatchDebugState(dataObject, StateType.Before, update);
                    DispatchDebugState(dataObject, StateType.After, update);
                }
            }
        }
        public ImportJobViewModelNew(
            NavigationManager navManager,
            ICatalogEntityFactory entityFactory,
            ICatalogRepository catalogRepository,
            IImportRepository importRepository,
            ImportJob item,
            WizardViewModelBare parentVM,
            IColumnMappingEditViewModel mappingEditVM,
            IColumnMappingViewModel columnMappingVM,
            IImportService importService,
            IPickAssetViewModel pickAssetVM,
            bool isSingleDialogEditing)
        {
            _entityFactory        = entityFactory;
            InnerItem             = _originalItem = item;
            _parentViewModel      = parentVM;
            IsSingleDialogEditing = isSingleDialogEditing;
            _itemRepository       = importRepository;
            _mappingEditVM        = mappingEditVM;
            _columnMappingVM      = columnMappingVM;
            _pickAssetVM          = pickAssetVM;
            _importService        = importService;
            _catalogRepository    = catalogRepository;

            ViewTitle = new ViewTitleBase()
            {
                Title = "Import job", SubTitle = DisplayName.ToUpper()
            };

            if (isSingleDialogEditing)
            {
                _originalItem = InnerItem;

                OpenItemCommand = new DelegateCommand(() =>
                {
                    NavigationData = new NavigationItem(InnerItem.ImportJobId, NavigationNames.HomeName, NavigationNames.MenuName, this);
                    navManager.Navigate(NavigationData);
                });

                CancelCommand      = new DelegateCommand <object>(OnCancelCommand);
                SaveChangesCommand = new DelegateCommand <object>((x) => OnSaveChangesCommand(), (x) => { return(IsModified); });
                MinimizeCommand    = new DelegateCommand(() => MinimizableViewRequestedEvent(this, null));
            }
            else
            {
                InitializePropertiesForViewing();
            }

            FilePickCommand       = new DelegateCommand(RaiseFilePickInteractionRequest);
            CreateMappingCommand  = new DelegateCommand(RaiseCreateMappingInteractionRequest);
            CancelConfirmRequest  = new InteractionRequest <Confirmation>();
            CommonConfirmRequest  = new InteractionRequest <Confirmation>();
            CommonConfirmRequest2 = new InteractionRequest <Confirmation>();

            UpdateImporterCommand    = new DelegateCommand <EntityImporterBase>((x) => OnImporterChangesCommand(x));
            UpdatePropertySetCommand = new DelegateCommand <PropertySet>((x) => OnPropertySetChangesCommand(x));

            CatalogChangedCommand = new DelegateCommand <CatalogBase>((x) => OnCatalogChangesCommand(x));

            ItemEditCommand  = new DelegateCommand <MappingItem>((x) => RaiseItemEditInteractionRequest(x), x => x != null);
            ItemClearCommand = new DelegateCommand <MappingItem>((x) => RaiseItemClearInteractionRequest(x), x => x != null);
        }
Example #7
0
        protected override void ExecuteTool(IDSFDataObject dataObject, int update)
        {
            ErrorResultTO allErrors = new ErrorResultTO();
            ErrorResultTO errors    = new ErrorResultTO();

            _executionResult = new List <string>();
            allErrors.MergeErrors(errors);
            InitializeDebug(dataObject);
            // Process if no errors
            try
            {
                IsSingleValueRule.ApplyIsSingleValueRule(Result, allErrors);

                var colItr = new WarewolfListIterator();
                var iteratorPropertyDictionary = new Dictionary <string, IWarewolfIterator>();
                foreach (var propertyInfo in GetType().GetProperties().Where(info => info.IsDefined(typeof(Inputs))))
                {
                    var attributes    = (Inputs[])propertyInfo.GetCustomAttributes(typeof(Inputs), false);
                    var variableValue = propertyInfo.GetValue(this) as string;
                    if (!string.IsNullOrEmpty(variableValue))
                    {
                        if (dataObject.IsDebugMode())
                        {
                            AddDebugInputItem(new DebugEvalResult(variableValue, attributes[0].UserVisibleName, dataObject.Environment, update));
                        }

                        var dtItr = CreateDataListEvaluateIterator(variableValue, dataObject.Environment, update);
                        colItr.AddVariableToIterateOn(dtItr);
                        iteratorPropertyDictionary.Add(propertyInfo.Name, dtItr);
                    }
                }
                if (colItr.FieldCount <= 0)
                {
                    var evaluatedValues = new Dictionary <string, string>();
                    _executionResult = PerformExecution(evaluatedValues);
                    AssignResult(dataObject, update);
                }
                else
                {
                    while (colItr.HasMoreData())
                    {
                        var evaluatedValues = new Dictionary <string, string>();
                        foreach (var dev2DataListEvaluateIterator in iteratorPropertyDictionary)
                        {
                            var binaryDataListItem = colItr.FetchNextValue(dev2DataListEvaluateIterator.Value);
                            evaluatedValues.Add(dev2DataListEvaluateIterator.Key, binaryDataListItem);
                        }
                        _executionResult = PerformExecution(evaluatedValues);
                        AssignResult(dataObject, update);
                    }
                }

                if (dataObject.IsDebugMode() && !allErrors.HasErrors() && !string.IsNullOrWhiteSpace(Result))
                {
                    if (dataObject.IsDebugMode() && !allErrors.HasErrors())
                    {
                        if (!string.IsNullOrEmpty(Result))
                        {
                            AddDebugOutputItem(new DebugEvalResult(Result, "", dataObject.Environment, update));
                        }
                    }
                }
                allErrors.MergeErrors(errors);
            }
            catch (Exception ex)
            {
                Dev2Logger.Error(string.Format("{0} Exception", DisplayName), ex);
                allErrors.AddError(ex.Message);
            }
            finally
            {
                // Handle Errors
                var hasErrors = allErrors.HasErrors();
                if (hasErrors)
                {
                    DisplayAndWriteError(DisplayName, allErrors);
                    var errorList = allErrors.MakeDataListReady();
                    dataObject.Environment.AddError(errorList);
                    dataObject.Environment.Assign(Result, DisplayName.ToUpper().Contains("Dropbox".ToUpper()) ? GlobalConstants.DropBoxFailure : null, update);
                }
                if (dataObject.IsDebugMode())
                {
                    DispatchDebugState(dataObject, StateType.Before, update);
                    DispatchDebugState(dataObject, StateType.After, update);
                }
            }
        }
 private void SetKeywordStrings(params string[] keywords)
 {
     KeywordStrings = keywords == null && !string.IsNullOrEmpty(DisplayName)
         ? new[] { DisplayName.ToUpper(), DisplayName.ToLower() }
         : keywords;
 }
Example #9
0
        protected override void OnAction(Microsoft.ManagementConsole.Action action, AsyncStatus status)
        {
            string a;

            if ((a = (string)action.Tag) != null)
            {
                if (a == "Delete")
                {
                    ScopeNode scopeNode = new ScopeNode();
                    scopeNode.DisplayName = base.DisplayName;
                    bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                    sSO.GetApplications();
                    int index = 0;
                    for (int i = 0; i < base.Parent.Children.Count; i++)
                    {
                        if (Parent.Children[i].DisplayName.ToUpper() == DisplayName.ToUpper())
                        {
                            index = i;
                        }
                    }
                    sSO.DeleteApplication(base.DisplayName);
                    Parent.Children.RemoveAt(index);
                    return;
                }
                if (a == "Add_KeyValue")
                {
                    if (DisplayName.ToUpper() == "_NewApplication".ToUpper())
                    {
                        EnabledStandardVerbs = StandardVerbs.None;
                    }
                    _hasKeyValuePropertyPage = true;
                    ShowPropertySheet("Add Key/Value Pair");
                    OnRefresh(status);
                    base.OnRefresh(status);
                    return;
                }
                if (a == "Add_Application")
                {
                    string[] array  = new string[1];
                    string[] array2 = new string[1];
                    array[0]  = "";
                    array2[0] = "";
                    string text = "_NewApplication";
                    bool   flag = false;
                    bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                    string[] applications        = sSO.GetApplications();
                    for (int j = 0; j < applications.Length; j++)
                    {
                        if (applications[j].ToUpper() == text.ToUpper())
                        {
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                        messageBoxParameters.Text    = "This application already exists";
                        messageBoxParameters.Caption = "Add New Application";
                        messageBoxParameters.Icon    = MessageBoxIcon.Exclamation;
                        SnapIn.Console.ShowDialog(messageBoxParameters);
                    }
                    else
                    {
                        ScopeNode scopeNode2 = new ScopeNode();
                        scopeNode2.DisplayName = "_NewApplication";
                        ScopeNode scopeNode3 = new ScopeNode();
                        Children.Add(scopeNode2);
                        int count = Children.Count;
                        sSO.CreateApplicationFieldsValues("_NewApplication", array, array2);
                        Children[count - 1] = new ApplicationScopeNode("_NewApplication");
                    }
                    base.OnRefresh(status);
                    return;
                }
                if (!(a == "Export"))
                {
                    if (!(a == "Import"))
                    {
                        return;
                    }
                    DialogResult dialogResult = SSOHelper.OpenSSOImportFile(
                        out _applicationFileName,
                        out _encryptedText,
                        this);
                    if (dialogResult != DialogResult.Cancel)
                    {
                        EncryptionKey_PropertyPage encryptionKey_PropertyPage =
                            new EncryptionKey_PropertyPage("Import", _applicationFileName, _encryptedText);
                        encryptionKey_PropertyPage.EncryptionKeyEnteredForImport +=
                            new EventHandler <EventArgs <bool, string> >(propertyPage_EncryptionKeyEnteredForImport);
                        AcceptKeyForImportForm form =
                            new AcceptKeyForImportForm(encryptionKey_PropertyPage);
                        base.SnapIn.Console.ShowDialog(form);
                    }
                    base.OnRefresh(status);
                }
                else
                {
                    EncryptionKey_PropertyPage encryptionKey_PropertyPage2 =
                        new EncryptionKey_PropertyPage("Export", base.DisplayName);
                    AcceptKeyForImportForm form2 = new AcceptKeyForImportForm(encryptionKey_PropertyPage2);
                    base.SnapIn.Console.ShowDialog(form2);
                    if (encryptionKey_PropertyPage2.EncryptionKey != null && encryptionKey_PropertyPage2.EncryptionKey.Length != 0)
                    {
                        if (!SSOHelper.ExportSSOApplication(base.DisplayName, encryptionKey_PropertyPage2.EncryptionKey, this))
                        {
                            MessageBoxParameters messageBoxParameters2 = new MessageBoxParameters();
                            messageBoxParameters2.Text    = "Error exporting the application.  Please check the event log for further information";
                            messageBoxParameters2.Caption = "Export Application Error";
                            messageBoxParameters2.Icon    = MessageBoxIcon.Hand;
                            base.SnapIn.Console.ShowDialog(messageBoxParameters2);
                            return;
                        }
                    }
                }
            }
        }