private Control AddChangesColumn(int lastRowPlusOne, int columnCount)
        {
            List <string> changesColumn = new List <string>()
            {
                "", "New"
            };

            topGrid.ColumnDefinitions.Add(new ColumnDefinition());
            ComboBox newCommonValuesBox = new ComboBox
            {
                FontSize   = 18,
                IsEditable = true,
                Background = BackgroundColorController.GetBackgroundColor()
            };

            newCommonValuesBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());

            newCommonValuesBox.AddToolTip("changes");
            newCommonValuesBox.DropDownClosed += NewCommonValuesBox_DropDownClosed;
            newCommonValuesBox.LostFocus      += NewCommonValuesBox_LostFocus;
            newCommonValuesBox.SetComboBox(changesColumn);
            Grid.SetRow(newCommonValuesBox, lastRowPlusOne);
            Grid.SetColumn(newCommonValuesBox, columnCount);
            topGrid.Children.Add(newCommonValuesBox);
            return(newCommonValuesBox);
        }
        private Control AddGameFileColumn(int lastRowPlusOne, int columnCount, string headerKey, LocalizationFileObject gameLocalizationFile)
        {
            SortedSet <string> allCommonValuesSorted = gameLocalizationFile.HeaderKeyToCommonValuesMap.GetValueOrDefault(headerKey);
            List <string>      allCommonValues       = new List <string>(allCommonValuesSorted);

            if (allCommonValues == null)
            {
                allCommonValues = new List <string>();
            }
            topGrid.ColumnDefinitions.Add(new ColumnDefinition());
            ComboBox newCommonValuesBox = new ComboBox
            {
                FontSize   = 18,
                IsEditable = true,
                Background = BackgroundColorController.GetBackgroundColor()
            };

            newCommonValuesBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
            newCommonValuesBox.AddToolTip(headerKey);
            newCommonValuesBox.DropDownClosed += NewCommonValuesBox_DropDownClosed;
            newCommonValuesBox.LostFocus      += NewCommonValuesBox_LostFocus;
            newCommonValuesBox.SetComboBox(allCommonValues);
            Grid.SetRow(newCommonValuesBox, lastRowPlusOne);
            Grid.SetColumn(newCommonValuesBox, columnCount);
            topGrid.Children.Add(newCommonValuesBox);
            return(newCommonValuesBox);
        }
示例#3
0
 private void SetBackgroundColor()
 {
     GameRecordScrollViewer.Background            = BackgroundColorController.GetBackgroundColor();
     LocalizationPreviewBox.Background            = BackgroundColorController.GetBackgroundColor();
     LocalizationOutputLabel.Background           = BackgroundColorController.GetBackgroundColor();
     GameLocalizationRecordOutputLabel.Background = BackgroundColorController.GetBackgroundColor();
     GameKeySelectionComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     ModSelectionComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
 }
 private void SetBackgroundForComboBoxes()
 {
     LoadedModFilesSearchViewComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     LoadedModsSearchViewComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     LoadedModsCenterViewComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     CurrentModFilesCenterViewComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     SearchTreeLoadedFilesComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     NewObjectViewLoadedFilesComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     CurrentGameFilesCenterViewComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
 }
 private void SetBackgroundFromSetting(bool removeExistingResources = false)
 {
     this.Background = BackgroundColorController.GetBackgroundColor();
     this.XmlOutputBox.Background = BackgroundColorController.GetBackgroundColor();
     if (removeExistingResources)
     {
         RemoveExistingColorFromComboBoxResource();
     }
     SetBackgroundForComboBoxes();
 }
        private void AddClearButton(int rowCount, int columnCount)
        {
            //Add the first column, the clear button
            topGrid.ColumnDefinitions.Add(new ColumnDefinition());
            Button clearRowButton = new Button {
                Content = "Clear row", FontSize = 18, Tag = rowCount, Background = BackgroundColorController.GetBackgroundColor()
            };

            clearRowButton.Click += ClearRowButton_Click;
            Grid.SetRow(clearRowButton, rowCount);
            Grid.SetColumn(clearRowButton, columnCount);
            topGrid.Children.Add(clearRowButton);
        }
        private void AddNumberColumn(int rowCount, int column)
        {
            int numberForColumn = rowCount + 1;

            //Need to increase the row count to make sure the numbers line up with the file
            topGrid.ColumnDefinitions.Add(new ColumnDefinition());
            TextBox clearRowButton = new TextBox {
                Text = numberForColumn + "", FontSize = 18, Background = BackgroundColorController.GetBackgroundColor()
            };

            Grid.SetRow(clearRowButton, rowCount);
            Grid.SetColumn(clearRowButton, column);
            topGrid.Children.Add(clearRowButton);
        }
        //Creates a ComboBox using a list object
        public static ComboBox CreateComboBoxFromList <T>(this IList <T> listToUse, string name = null, SolidColorBrush forgroundColor = null, bool isEditable = true)
        {
            ComboBox newBox = new ComboBox();

            if (forgroundColor != null)
            {
                newBox.Foreground = forgroundColor;
            }
            newBox.Background = BackgroundColorController.GetBackgroundColor();
            newBox.IsEditable = isEditable;
            newBox.SetComboBox(listToUse, true, name);
            newBox.SelectedIndex = 0;
            return(newBox);
        }
 private void SetBackgroundColor()
 {
     this.Background            = BackgroundColorController.GetBackgroundColor();
     AllTagsComboBox.Background = BackgroundColorController.GetBackgroundColor();
     AllTagsComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     ChangeNameAllTagsComboBox.Background = BackgroundColorController.GetBackgroundColor();
     ChangeNameAllTagsComboBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
     ModInfoNameBox.Background                = BackgroundColorController.GetBackgroundColor();
     ModInfoDescriptionBox.Background         = BackgroundColorController.GetBackgroundColor();
     ModInfoAuthorBox.Background              = BackgroundColorController.GetBackgroundColor();
     ModInfoVersionBox.Background             = BackgroundColorController.GetBackgroundColor();
     ModInfoXmlPreviewAvalonEditor.Background = BackgroundColorController.GetBackgroundColor();
     CurrentSelectedModTextBox.Background     = BackgroundColorController.GetBackgroundColor();
 }
        private void AddDummyColumn(int row, int columnCount, string textForTextBox = "", int fontSize = 18)
        {
            //Add a dummy column for the clear button.
            topGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            TextBox emptyTextBox = new TextBox()
            {
                Text = textForTextBox, FontSize = fontSize, Background = BackgroundColorController.GetBackgroundColor()
            };

            Grid.SetRow(emptyTextBox, row);
            Grid.SetColumn(emptyTextBox, columnCount);
            topGrid.Children.Add(emptyTextBox);
        }
示例#11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            var textBox = Template.FindName("PART_EditableTextBox", this) as TextBox;

            MyTextBox     = textBox;
            MyTextBox.Tag = this.Parent;
            MyTextBox.Uid = ObjectNode == null ? "" : ObjectNode.Name;
            XmlObjectsListWrapper wrapperToUse = MainWindowViewController.LoadedListWrappers.GetValueOrDefault(this.Uid);

            if (IsGameFileSearchTree)
            {
                TreeViewGenerator.AddTargetContextMenuToControl(MyTextBox, wrapperToUse);
            }
            MyTextBox.Background = BackgroundColorController.GetBackgroundColor();
            this.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
        }
        public static void SetComboBox <T>(this ComboBox comboBox, IList <T> listToUse, bool includeEmptyItem = false, string name = null)
        {
            comboBox.Background = BackgroundColorController.GetBackgroundColor();
            if (name != null)
            {
                comboBox.Name = name;
            }
            ObservableCollection <string> allItems = new ObservableCollection <string>();

            if (includeEmptyItem)
            {
                allItems.Add("              ");
            }
            foreach (var nextString in listToUse.OrderBy(i => i))
            {
                allItems.Add(nextString.ToString());
            }
            comboBox.ItemsSource = allItems;
        }
        private void AddFieldColumns(int rowCount, int startingColumn, List <string> record, List <Control> allBoxesInRow = null, int skipHeadersCount = 0)
        {
            if (allBoxesInRow == null)
            {
                allBoxesInRow = new List <Control>();
            }
            int columnCount = startingColumn;
            //Each field
            TextBox newRecordTextbox = null;

            foreach (string nextRecordField in record)
            {
                topGrid.ColumnDefinitions.Add(new ColumnDefinition());
                newRecordTextbox = new TextBox()
                {
                    Text       = nextRecordField,
                    Tag        = ",",
                    FontSize   = 18,
                    Background = BackgroundColorController.GetBackgroundColor()
                };
                if (skipHeadersCount < this.LocalizationFileObject.HeaderValues.Length)
                {
                    newRecordTextbox.AddToolTip((rowCount + 1) + " : " + this.LocalizationFileObject.HeaderValues[skipHeadersCount]);
                }
                newRecordTextbox.TextChanged += NewRecordTextbox_TextChanged;
                newRecordTextbox.LostFocus   += NewRecordTextbox_LostFocus;
                Grid.SetRow(newRecordTextbox, rowCount);
                Grid.SetColumn(newRecordTextbox, columnCount);
                topGrid.Children.Add(newRecordTextbox);
                allBoxesInRow.Add(newRecordTextbox);
                columnCount++;
                skipHeadersCount++;
            }
            if (newRecordTextbox != null)
            {
                newRecordTextbox.Tag = "\n";
            }
            if (allBoxesInRow.Count > 0)
            {
                TextBoxRowDictionary.Add(rowCount, allBoxesInRow);
            }
        }
        public static MyComboBox CreateMyComboBoxList <T>(this IList <T> listToUse, XmlNode objectNode, bool isGameFileSearchTree = true, string name = null)
        {
            MyComboBox newBox = new MyComboBox(objectNode, isGameFileSearchTree)
            {
                IsEditable = true,
                Background = BackgroundColorController.GetBackgroundColor()
            };

            if (name != null)
            {
                newBox.Name = name;
            }
            ObservableCollection <string> allItems = new ObservableCollection <string>();

            foreach (var nextString in listToUse.OrderBy(i => i))
            {
                allItems.Add(nextString.ToString());
            }
            newBox.ItemsSource = allItems;
            return(newBox);
        }
示例#15
0
        private Control AddModKeysColumn(int lastRowPlusOne, int columnCount, List <XmlObjectsListWrapper> xmlWrappersForGameKeys)
        {
            topGrid.ColumnDefinitions.Add(new ColumnDefinition());
            ComboBox newCommonValuesBox = new ComboBox
            {
                FontSize   = 18,
                Tag        = lastRowPlusOne,
                IsEditable = true,
                Background = BackgroundColorController.GetBackgroundColor()
            };

            newCommonValuesBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
            newCommonValuesBox.AddToolTip("key");
            newCommonValuesBox.DropDownClosed += NewCommonValuesBox_DropDownClosed;
            newCommonValuesBox.LostFocus      += NewCommonValuesBox_LostFocus;
            AddModAttributesFromWrappers(xmlWrappersForGameKeys, newCommonValuesBox);
            Grid.SetRow(newCommonValuesBox, lastRowPlusOne);
            Grid.SetColumn(newCommonValuesBox, columnCount);
            topGrid.Children.Add(newCommonValuesBox);
            return(newCommonValuesBox);
        }
        private Control AddModKeysColumn(int lastRowPlusOne, int columnCount, XmlObjectsListWrapper selectedModItemsWrapper, XmlObjectsListWrapper selectedModBlocksWrapper)
        {
            topGrid.ColumnDefinitions.Add(new ColumnDefinition());
            ComboBox newCommonValuesBox = new ComboBox
            {
                FontSize   = 18,
                IsEditable = true,
                Background = BackgroundColorController.GetBackgroundColor()
            };

            newCommonValuesBox.Resources.Add(SystemColors.WindowBrushKey, BackgroundColorController.GetBackgroundColor());
            newCommonValuesBox.AddToolTip("key");
            newCommonValuesBox.DropDownClosed += NewCommonValuesBox_DropDownClosed;
            newCommonValuesBox.LostFocus      += NewCommonValuesBox_LostFocus;
            if (selectedModItemsWrapper != null)
            {
                Dictionary <string, List <string> > attributeDictinaryForItems = selectedModItemsWrapper.ObjectNameToAttributeValuesMap.GetValueOrDefault("item");
                if (attributeDictinaryForItems != null)
                {
                    List <string> commonAttributes = attributeDictinaryForItems.GetValueOrDefault("name");
                    commonAttributes.Insert(0, "");
                    newCommonValuesBox.SetComboBox(commonAttributes);
                }
            }
            if (selectedModBlocksWrapper != null)
            {
                Dictionary <string, List <string> > attributeDictinaryForBlocks = selectedModBlocksWrapper.ObjectNameToAttributeValuesMap.GetValueOrDefault("block");
                if (attributeDictinaryForBlocks != null)
                {
                    List <string> commonAttributes = attributeDictinaryForBlocks.GetValueOrDefault("name");
                    newCommonValuesBox.SetComboBox(commonAttributes);
                }
            }
            Grid.SetRow(newCommonValuesBox, lastRowPlusOne);
            Grid.SetColumn(newCommonValuesBox, columnCount);
            topGrid.Children.Add(newCommonValuesBox);
            return(newCommonValuesBox);
        }
        private void CreateHeaderRow(int row)
        {
            //Go throh the keys for the header row
            RowDefinition rowDefinition = new RowDefinition();

            topGrid.RowDefinitions.Add(rowDefinition);

            int columnCount = 0;
            int numberForLineCountColumn = row + 1;

            AddDummyColumn(row, columnCount, numberForLineCountColumn + "");
            columnCount++;
            AddDummyColumn(row, columnCount);
            columnCount++;
            TextBox nextHeaderTextBox = null;

            foreach (string headerField in LocalizationFileObject.HeaderKeyToCommonValuesMap.Keys)
            {
                //Set the Headers
                topGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                nextHeaderTextBox = new TextBox()
                {
                    Text = headerField, FontSize = 22, Background = BackgroundColorController.GetBackgroundColor()
                };
                Grid.SetRow(nextHeaderTextBox, row);
                Grid.SetColumn(nextHeaderTextBox, columnCount);
                topGrid.Children.Add(nextHeaderTextBox);
                nextHeaderTextBox.Tag = ",";
                columnCount++;
            }
            if (nextHeaderTextBox != null)
            {
                nextHeaderTextBox.Tag = "\n";
            }
        }
        private void CreateSingleRecordGrid()
        {
            RowDefinition rowDefinition = new RowDefinition();
            int           row           = 0;

            topGrid.RowDefinitions.Add(rowDefinition);
            int numberForLineCountColumn = row + 1;
            int columnCount = 0;

            AddDummyColumn(row, columnCount, numberForLineCountColumn + "");
            columnCount++;
            AddDummyColumn(row, columnCount, "Header", 22);
            columnCount++;
            AddDummyColumn(row, columnCount, "Value", 22);
            List <string> record = null;

            if (this.LocalizationFileObject.RecordList.Count > 0)
            {
                record = this.LocalizationFileObject.RecordList[0];
            }
            TextBox nextHeaderTextBox = null;

            foreach (string headerField in LocalizationFileObject.HeaderKeyToCommonValuesMap.Keys)
            {
                columnCount = 0;
                //Go throh the keys for the header row
                rowDefinition = new RowDefinition();
                //Make sure the record is retrieved before increasing the row.
                string nextField = record[row];
                row++;
                topGrid.RowDefinitions.Add(rowDefinition);
                numberForLineCountColumn = row + 1;
                AddDummyColumn(row, columnCount, numberForLineCountColumn + "");
                columnCount++;
                //Set the Headers
                topGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                nextHeaderTextBox = new TextBox()
                {
                    Text = headerField, FontSize = 22, Tag = ",", Background = BackgroundColorController.GetBackgroundColor()
                };
                Grid.SetRow(nextHeaderTextBox, row);
                Grid.SetColumn(nextHeaderTextBox, columnCount);
                topGrid.Children.Add(nextHeaderTextBox);
                columnCount++;
                topGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                nextHeaderTextBox = new TextBox()
                {
                    Text = nextField, FontSize = 22, Tag = ",", Background = BackgroundColorController.GetBackgroundColor()
                };
                Grid.SetRow(nextHeaderTextBox, row);
                Grid.SetColumn(nextHeaderTextBox, columnCount);
                topGrid.Children.Add(nextHeaderTextBox);
            }
            if (nextHeaderTextBox != null)
            {
                nextHeaderTextBox.Tag = "\n";
            }
        }
 private void SetBackgroundColor()
 {
     this.XmlOutputBox.Background = BackgroundColorController.GetBackgroundColor();
 }
    private void LoadApiDictionary()
    {
        apiDictionary = new Dictionary <string, FunctionCaller>();

        FunctionCaller loginGuest = new FunctionCaller()
        {
        };

        loginGuest.functionNoParams = authentication.Login;
        apiDictionary.Add("Login as guest", loginGuest);

        FunctionCaller loginUser = new FunctionCaller();

        loginUser.function2Params = (username, password) => authentication.Login(username, password);
        loginUser.parameters.Add("Username");
        loginUser.parameters.Add("Password");
        apiDictionary.Add("Login user with id", loginUser);

        FunctionCaller createAccount = new FunctionCaller();

        createAccount.function3Params = (email, username, password) => authentication.CreateAccount(email, username, password);
        createAccount.parameters.Add("Email");
        createAccount.parameters.Add("Username");
        createAccount.parameters.Add("Password");
        apiDictionary.Add("Create account with email", createAccount);

        FunctionCaller changeBackgroundColor = new FunctionCaller();

        changeBackgroundColor.functionNoParams = () => backgroundColorChanger.ChangeBackgroundColor();
        apiDictionary.Add("Change background color", changeBackgroundColor);

        FunctionCaller saveBackgroundColor = new FunctionCaller();

        saveBackgroundColor.functionNoParams = () => backgroundColorChanger.SaveBackgroundColor();
        apiDictionary.Add("Save background color", saveBackgroundColor);

        FunctionCaller getBackgroundColor = new FunctionCaller();

        getBackgroundColor.functionNoParams = () => backgroundColorChanger.GetBackgroundColor();
        apiDictionary.Add("Get background color", getBackgroundColor);

        FunctionCaller createGroup = new FunctionCaller();

        createGroup.function3Params = (adminUsername, password, groupName) => groupController.CreateGroup(adminUsername, password, groupName);
        createGroup.parameters.Add("Admin Username");
        createGroup.parameters.Add("Password");
        createGroup.parameters.Add("Group Name");
        apiDictionary.Add("Create group", createGroup);

        FunctionCaller invitePlayerToGroup = new FunctionCaller();

        invitePlayerToGroup.function4Params =
            (adminUsername, password, groupName, usernameToInvite) =>
            groupController.InvitePlayerToGroup(adminUsername, password, groupName, usernameToInvite);
        invitePlayerToGroup.parameters.Add("Admin Username");
        invitePlayerToGroup.parameters.Add("Password");
        invitePlayerToGroup.parameters.Add("Group Name");
        invitePlayerToGroup.parameters.Add("Username To Invite");
        apiDictionary.Add("Invite player to group", invitePlayerToGroup);

        FunctionCaller acceptInvitationToGroup = new FunctionCaller();

        acceptInvitationToGroup.function3Params =
            (usernameToAccept, password, groupName) =>
            groupController.AcceptInvitationToGroup(usernameToAccept, password, groupName);
        acceptInvitationToGroup.parameters.Add("Username To Accept");
        acceptInvitationToGroup.parameters.Add("Password");
        acceptInvitationToGroup.parameters.Add("Group Name");
        apiDictionary.Add("Accept invitation to group", acceptInvitationToGroup);

        FunctionCaller fetchApiPolicy = new FunctionCaller();

        fetchApiPolicy.functionNoParams = () => apiAccessPolicyController.FetchApiPolicy();
        apiDictionary.Add("Fetch API access policy", fetchApiPolicy);

        FunctionCaller readDropTableData = new FunctionCaller();

        readDropTableData.function1Param = (tableId) => dropTableController.ReadDropTableData(tableId);
        readDropTableData.parameters.Add("Drop table id");
        apiDictionary.Add("Read drop table data", readDropTableData);

        FunctionCaller grantRandomItemToUser = new FunctionCaller();

        grantRandomItemToUser.function4Params =
            (adminUsername, password, usernameReceivingItem, dropTableId) =>
            dropTableController.GrantRandomItemToUser(adminUsername, password, usernameReceivingItem, dropTableId);
        grantRandomItemToUser.parameters.Add("Admin Username");
        grantRandomItemToUser.parameters.Add("Password");
        grantRandomItemToUser.parameters.Add("Username Receiving Item");
        grantRandomItemToUser.parameters.Add("Drop Table Id");
        apiDictionary.Add("Grant user random item", grantRandomItemToUser);

        FunctionCaller purchaseItem = new FunctionCaller();

        purchaseItem.function4Params =
            (username, password, itemId, price) =>
            playerInventoryController.PurchaseItem(username, password, itemId, price);
        purchaseItem.parameters.Add("Username");
        purchaseItem.parameters.Add("Password");
        purchaseItem.parameters.Add("Item Id");
        purchaseItem.parameters.Add("Price");
        apiDictionary.Add("Purchase item", purchaseItem);

        FunctionCaller getInventory = new FunctionCaller();

        getInventory.function2Params = (username, password) => playerInventoryController.GetInventory(username, password);
        getInventory.parameters.Add("Username");
        getInventory.parameters.Add("Password");
        apiDictionary.Add("Get inventory", getInventory);

        FunctionCaller consumeItem = new FunctionCaller();

        consumeItem.function3Params = (username, password, itemId) => playerInventoryController.ConsumeItem(username, password, itemId);
        consumeItem.parameters.Add("Username");
        consumeItem.parameters.Add("Password");
        consumeItem.parameters.Add("Item Id");
        apiDictionary.Add("Consume item", consumeItem);

        FunctionCaller redeemCoupon = new FunctionCaller();

        redeemCoupon.function3Params = (username, password, couponCode) => couponController.RedeemCoupon(username, password, couponCode);
        redeemCoupon.parameters.Add("Username");
        redeemCoupon.parameters.Add("Password");
        redeemCoupon.parameters.Add("Coupon Code");
        apiDictionary.Add("Redeem Coupon", redeemCoupon);

        FunctionCaller updatePlayerStatistic = new FunctionCaller();

        updatePlayerStatistic.function2Params = (username, password) => statisticsController.UpdatePlayerStatistics(username, password);
        updatePlayerStatistic.parameters.Add("Username");
        updatePlayerStatistic.parameters.Add("Password");
        apiDictionary.Add("Update player statistic", updatePlayerStatistic);
    }