コード例 #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            string role  = string.Empty;
            bool   input = true;

            while (input)
            {
                if (DialogUtilities.InputBox("Add Role", "Role Name: ", ref role) == DialogResult.OK)
                {
                    if (!RoleExists(role))
                    {
                        Role r = new Role(role, string.Empty);

                        r.AssignedPermissions = new List <string>().ToArray();
                        AddRole(r);
                        _RolesToAdd.Add(r.Name.ToLower(), r);
                        comboBoxRoles.SelectedItem = r;
                        comboBoxRoles_SelectionChangeCommitted(comboBoxRoles, EventArgs.Empty);
                        OnSettingsChanged();
                        input = false;
                    }
                    else
                    {
                        Messager.Show(this, string.Format("Role {0} already exists. Please choose another name.", role), MessageBoxIcon.Error, MessageBoxButtons.OK);
                    }
                }
                else
                {
                    input = false;
                }
            }
        }
コード例 #2
0
        public static MapCustomPositionAngleObject Create()
        {
            string        text     = DialogUtilities.GetStringFromDialog(labelText: "Enter a PositionAngle.");
            PositionAngle posAngle = PositionAngle.FromString(text);

            return(posAngle != null ? new MapCustomPositionAngleObject(posAngle) : null);
        }
コード例 #3
0
ファイル: MapArrowObject.cs プロジェクト: chaosBrick/STROOP
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                _itemRecommendedArrowLength        = new ToolStripMenuItem("Use Recommended Arrow Size");
                _itemRecommendedArrowLength.Click += (sender, e) => _itemRecommendedArrowLength.Checked = !_itemRecommendedArrowLength.Checked;

                ToolStripMenuItem itemSetArrowHeadSideLength = new ToolStripMenuItem("Set Arrow Head Side Length");
                itemSetArrowHeadSideLength.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the side length of the arrow head:");
                    float? arrowHeadSideLength = ParsingUtilities.ParseFloatNullable(text);
                    if (arrowHeadSideLength.HasValue)
                    {
                        _arrowHeadSideLength = arrowHeadSideLength.Value;
                    }
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemRecommendedArrowLength);
                _contextMenuStrip.Items.Add(itemSetArrowHeadSideLength);
            }

            return(_contextMenuStrip);
        }
コード例 #4
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                string suffix = string.Format(" ({0})", _radius);
                _itemSetRadius        = new ToolStripMenuItem(SET_RADIUS_TEXT + suffix);
                _itemSetRadius.Click += (sender, e) =>
                {
                    string text   = DialogUtilities.GetStringFromDialog(labelText: "Enter the radius.");
                    double?radius = ParsingUtilities.ParseDoubleNullable(text);
                    if (!radius.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeCameraViewRadius: true, newCameraViewRadius: radius.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemSetRadius);
            }

            return(_contextMenuStrip);
        }
コード例 #5
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                _itemSetCustomWallTriangle        = new ToolStripMenuItem(SET_CUSTOM_WALL_TRIANGLE_TEXT);
                _itemSetCustomWallTriangle.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter wall triangle as hex uint.");
                    uint?  wallTriangleNullable = ParsingUtilities.ParseHexNullable(text);
                    if (!wallTriangleNullable.HasValue)
                    {
                        return;
                    }
                    uint wallTriangle          = wallTriangleNullable.Value;
                    MapObjectSettings settings = new MapObjectSettings(
                        changeTriangle: true, newTriangle: wallTriangle);
                    GetParentMapTracker().ApplySettings(settings);
                };

                ToolStripMenuItem itemClearCustomWallTriangle = new ToolStripMenuItem("Clear Custom Wall Triangle");
                itemClearCustomWallTriangle.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeTriangle: true, newTriangle: null);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemSetCustomWallTriangle);
                _contextMenuStrip.Items.Add(itemClearCustomWallTriangle);
            }

            return(_contextMenuStrip);
        }
コード例 #6
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                string suffix = string.Format(" ({0})", _angleRadius);
                _itemSetAngleRadius        = new ToolStripMenuItem(SET_ANGLE_RADIUS_TEXT + suffix);
                _itemSetAngleRadius.Click += (sender, e) =>
                {
                    string text        = DialogUtilities.GetStringFromDialog(labelText: "Enter the angle radius for sector:");
                    float? angleRadius = ParsingUtilities.ParseFloatNullable(text);
                    if (!angleRadius.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeSectorAngleRadius: true, newSectorAngleRadius: angleRadius.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemSetAngleRadius);
            }

            return(_contextMenuStrip);
        }
コード例 #7
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                _itemUseRelativeAngles        = new ToolStripMenuItem("Use Relative Angles");
                _itemUseRelativeAngles.Click += (sender, e) => _itemUseRelativeAngles.Checked = !_itemUseRelativeAngles.Checked;

                ToolStripMenuItem itemSetAngleDiff = new ToolStripMenuItem("Set Angle Diff");
                itemSetAngleDiff.Click += (sender, e) =>
                {
                    string text      = DialogUtilities.GetStringFromDialog(labelText: "Enter angle diff.");
                    int?   angleDiff = ParsingUtilities.ParseIntNullable(text);
                    if (angleDiff.HasValue && angleDiff.Value > 0)
                    {
                        _angleDiff = angleDiff.Value;
                    }
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemUseRelativeAngles);
                _contextMenuStrip.Items.Add(itemSetAngleDiff);
            }

            return(_contextMenuStrip);
        }
コード例 #8
0
        protected List <ToolStripMenuItem> GetGridlinesToolStripMenuItems()
        {
            string suffix = string.Format(" ({0})", _imageSize);

            _itemSetIconSize        = new ToolStripMenuItem(SET_ICON_SIZE_TEXT + suffix);
            _itemSetIconSize.Click += (sender, e) =>
            {
                string text         = DialogUtilities.GetStringFromDialog(labelText: "Enter icon size.");
                float? sizeNullable = ParsingUtilities.ParseFloatNullable(text);
                if (!sizeNullable.HasValue)
                {
                    return;
                }
                MapObjectSettings settings = new MapObjectSettings(
                    changeIconSize: true, newIconSize: sizeNullable.Value);
                GetParentMapTracker().ApplySettings(settings);
            };

            _itemUseExtendedLevelBoundaries        = new ToolStripMenuItem("Use Extended Level Boundaries");
            _itemUseExtendedLevelBoundaries.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    changeUseExtendedLevelBoundaries: true,
                    newUseExtendedLevelBoundaries: !_useExtendedLevelBoundaries);
                GetParentMapTracker().ApplySettings(settings);
            };

            return(new List <ToolStripMenuItem>()
            {
                _itemSetIconSize,
                _itemUseExtendedLevelBoundaries,
            });
        }
コード例 #9
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                string suffix = string.Format(" ({0})", _iconSize);
                _itemSetIconSize        = new ToolStripMenuItem(SET_ICON_SIZE_TEXT + suffix);
                _itemSetIconSize.Click += (sender, e) =>
                {
                    string text         = DialogUtilities.GetStringFromDialog(labelText: "Enter icon size.");
                    float? sizeNullable = ParsingUtilities.ParseFloatNullable(text);
                    if (!sizeNullable.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeIconSize: true, newIconSize: sizeNullable.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemSetIconSize);
            }

            return(_contextMenuStrip);
        }
コード例 #10
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem addMoreTrisItem = new ToolStripMenuItem("Add More Tris");
                addMoreTrisItem.Click += (sender, e) =>
                {
                    string      text           = DialogUtilities.GetStringFromDialog(labelText: "Enter triangle addresses as hex uints.");
                    List <uint> triAddressList = MapUtilities.ParseCustomTris(text, TriangleClassification.Wall);
                    if (triAddressList == null)
                    {
                        return;
                    }
                    _triList.AddRange(triAddressList.ConvertAll(address => TriangleDataModel.CreateLazy(address)));
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(addMoreTrisItem);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetWallToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetTriangleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
コード例 #11
0
        private void SaveAs()
        {
            SaveFileDialog saveFileDialog = DialogUtilities.CreateSaveFileDialog(FileType.MupenMovie);
            DialogResult   dialogResult   = saveFileDialog.ShowDialog();

            if (dialogResult != DialogResult.OK)
            {
                return;
            }

            string filePath = saveFileDialog.FileName;
            string fileName = new FileInfo(filePath).Name;
            bool   success  = _m64File.Save(filePath, fileName);

            if (!success)
            {
                MessageBox.Show(
                    "Could not save file.\n" +
                    "Perhaps Mupen is currently editing it.\n" +
                    "Try closing Mupen and trying again.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }
コード例 #12
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                _itemUseSpeedForArrowLength        = new ToolStripMenuItem("Use Recommended Arrow Size");
                _itemUseSpeedForArrowLength.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        arrowChangeUseRecommendedLength: true,
                        arrowNewUseRecommendedLength: !_useRecommendedArrowLength);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemUseSpeedForArrowLength.Checked = _useRecommendedArrowLength;

                ToolStripMenuItem itemSetArrowHeadSideLength = new ToolStripMenuItem("Set Arrow Head Side Length");
                itemSetArrowHeadSideLength.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the side length of the arrow head:");
                    float? arrowHeadSideLength = ParsingUtilities.ParseFloatNullable(text);
                    if (!arrowHeadSideLength.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        arrowChangeHeadSideLength: true, arrowNewHeadSideLength: arrowHeadSideLength.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemUseSpeedForArrowLength);
                _contextMenuStrip.Items.Add(itemSetArrowHeadSideLength);
            }

            return(_contextMenuStrip);
        }
コード例 #13
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemUseFixedSize = new ToolStripMenuItem("Use Fixed Size");
                itemUseFixedSize.Click += (sender, e) =>
                {
                    _useFixedSize            = !_useFixedSize;
                    itemUseFixedSize.Checked = _useFixedSize;
                };

                ToolStripMenuItem itemSetBackwardsSize = new ToolStripMenuItem("Set Backwards Size...");
                itemSetBackwardsSize.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter backwards size.");
                    double?backwardsSizeNullable = ParsingUtilities.ParseDoubleNullable(text);
                    if (!backwardsSizeNullable.HasValue)
                    {
                        return;
                    }
                    _backwardsSize = (float)backwardsSizeNullable.Value;
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemUseFixedSize);
                _contextMenuStrip.Items.Add(itemSetBackwardsSize);
            }

            return(_contextMenuStrip);
        }
コード例 #14
0
ファイル: M64File.cs プロジェクト: sticks-stuff/STROOP
        public bool OpenFile(string filePath, string fileName)
        {
            if (!File.Exists(filePath))
            {
                return(false);
            }

            byte[] movieBytes;
            try
            {
                movieBytes = DialogUtilities.ReadFileBytes(filePath);
            }
            catch (IOException)
            {
                return(false);
            }

            bool loadedSuccessfully = LoadBytes(movieBytes);

            if (loadedSuccessfully)
            {
                CurrentFilePath = filePath;
                CurrentFileName = fileName;
            }

            return(true);
        }
コード例 #15
0
        public static bool TryFetchAvailableOCRLanguagesFromPassportPDF(out string[] availableLanguages, IWin32Window owner = null)
        {
            using (frmFetchingInfoFromServer fetchWindow = new frmFetchingInfoFromServer())
            {
                fetchWindow._passportPdfRequestWorker.RunWorkerAsync(BackgroundOperationType.FetchOCRSupportedLanguages);
                fetchWindow.SetFormFetchingMessageAndShowUntilWorkCompletion(owner, FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_ocr_languages", FrameworkGlobals.ApplicationLanguage));

                if (fetchWindow._apiCallException != null)
                {
                    // An exception occured when calling the API
                    DialogUtilities.ShowErrorMessage(LogMessagesUtils.ReplaceMessageSequencesAndReferences(FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_ocr_languages_failure", FrameworkGlobals.ApplicationLanguage),
                                                                                                           additionalMessage: fetchWindow._apiCallException.Message), FrameworkGlobals.MessagesLocalizer.GetString("caption_error", FrameworkGlobals.ApplicationLanguage));
                    availableLanguages = null;
                    return(false);
                }
                else
                {
                    if (fetchWindow._getAvailableOCRLanguagesResponse.Error == null)
                    {
                        availableLanguages = fetchWindow._getAvailableOCRLanguagesResponse.Value.ToArray();
                        return(true);
                    }
                    else
                    {
                        DialogUtilities.ShowErrorMessage(LogMessagesUtils.ReplaceMessageSequencesAndReferences(FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_ocr_languages_failure", FrameworkGlobals.ApplicationLanguage),
                                                                                                               additionalMessage: PassportPDFErrorUtilities.GetMessageFromResultCode(fetchWindow._getAvailableOCRLanguagesResponse.Error.ResultCode)), FrameworkGlobals.MessagesLocalizer.GetString("caption_error", FrameworkGlobals.ApplicationLanguage));
                        availableLanguages = null;
                        return(false);
                    }
                }
            }
        }
コード例 #16
0
        public static Dictionary <uint, string> GetMappingDictionary(string filePath)
        {
            Dictionary <uint, string> dictionary = new Dictionary <uint, string>();
            List <string>             lines      = DialogUtilities.ReadFileLines(filePath);

            foreach (string line in lines)
            {
                List <string> parts = ParsingUtilities.ParseStringList(line, false);
                if (parts.Count != 2)
                {
                    continue;
                }
                string part1 = parts[0];
                string part2 = parts[1];
                if (!part1.StartsWith("0x00000000"))
                {
                    continue;
                }
                string addressString   = "0x" + part1.Substring(10);
                uint?  addressNullable = ParsingUtilities.ParseHexNullable(addressString);
                if (!addressNullable.HasValue)
                {
                    continue;
                }
                uint address = addressNullable.Value;
                dictionary[address] = part2;
            }
            return(dictionary);
        }
コード例 #17
0
        protected static List <uint> GetTrianglesFromDialog(uint defaultTriangle)
        {
            string text = DialogUtilities.GetStringFromDialog(labelText: "Enter triangle addresses as hex uints.");

            if (text == null)
            {
                return(null);
            }
            if (text == "")
            {
                if (defaultTriangle == 0)
                {
                    return(null);
                }
                return(new List <uint>()
                {
                    defaultTriangle
                });
            }
            List <uint?> nullableUIntList = ParsingUtilities.ParseStringList(text)
                                            .ConvertAll(word => ParsingUtilities.ParseHexNullable(word));

            if (nullableUIntList.Any(nullableUInt => !nullableUInt.HasValue))
            {
                return(null);
            }
            return(nullableUIntList.ConvertAll(nullableUInt => nullableUInt.Value));
        }
コード例 #18
0
ファイル: PDFDPIOptions.cs プロジェクト: sakpung/webstudy
        private void _btnOK_Click(object sender, System.EventArgs e)
        {
            int nXResolution = 0;
            int nYResolution = 0;

            if (!DialogUtilities.ParseInteger(_tbXResolution, "XResolution", 10, true, 1000, true, true, out nXResolution))
            {
                return;
            }
            else
            {
                _xResolution = nXResolution;
            }

            if (!DialogUtilities.ParseInteger(_tbYResolution, "YResolution", 10, true, 1000, true, true, out nYResolution))
            {
                return;
            }
            else
            {
                _yResolution = nYResolution;
            }

            DialogResult = DialogResult.OK;
        }
コード例 #19
0
ファイル: MapObjectWall.cs プロジェクト: SM64-TAS-ABC/STROOP
        protected List <ToolStripMenuItem> GetWallToolStripMenuItems()
        {
            _itemSetRelativeHeight        = new ToolStripMenuItem(SET_RELATIVE_HEIGHT_TEXT);
            _itemSetRelativeHeight.Click += (sender, e) =>
            {
                string text = DialogUtilities.GetStringFromDialog(labelText: "Enter relative height of wall hitbox compared to wall triangle.");
                float? relativeHeightNullable = ParsingUtilities.ParseFloatNullable(text);
                if (!relativeHeightNullable.HasValue)
                {
                    return;
                }
                MapObjectSettings settings = new MapObjectSettings(
                    changeWallRelativeHeight: true, newWallRelativeHeight: relativeHeightNullable.Value);
                GetParentMapTracker().ApplySettings(settings);
            };

            ToolStripMenuItem itemClearRelativeHeight = new ToolStripMenuItem("Clear Relative Height");

            itemClearRelativeHeight.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    changeWallRelativeHeight: true, newWallRelativeHeight: null);
                GetParentMapTracker().ApplySettings(settings);
            };

            _itemSetAbsoluteHeight        = new ToolStripMenuItem(SET_ABSOLUTE_HEIGHT_TEXT);
            _itemSetAbsoluteHeight.Click += (sender, e) =>
            {
                string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the height at which you want to see the wall triangles.");
                float? absoluteHeightNullable =
                    text == "" ?
                    Config.Stream.GetFloat(MarioConfig.StructAddress + MarioConfig.YOffset) :
                    ParsingUtilities.ParseFloatNullable(text);
                if (!absoluteHeightNullable.HasValue)
                {
                    return;
                }
                MapObjectSettings settings = new MapObjectSettings(
                    changeWallAbsoluteHeight: true, newWallAbsoluteHeight: absoluteHeightNullable.Value);
                GetParentMapTracker().ApplySettings(settings);
            };

            ToolStripMenuItem itemClearAbsoluteHeight = new ToolStripMenuItem("Clear Absolute Height");

            itemClearAbsoluteHeight.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    changeWallAbsoluteHeight: true, newWallAbsoluteHeight: null);
                GetParentMapTracker().ApplySettings(settings);
            };

            return(new List <ToolStripMenuItem>()
            {
                _itemSetRelativeHeight,
                itemClearRelativeHeight,
                _itemSetAbsoluteHeight,
                itemClearAbsoluteHeight,
            });
        }
コード例 #20
0
ファイル: M64File.cs プロジェクト: sticks-stuff/STROOP
        public void Paste(M64CopiedData copiedData, int index, bool insert, int multiplicity)
        {
            if (RawBytes == null)
            {
                return;
            }
            index = MoreMath.Clamp(index, 0, Inputs.Count);
            int  pasteCount = copiedData.TotalFrames * multiplicity;
            bool bigPaste   = pasteCount > M64Config.PasteWarningLimit;

            if (bigPaste)
            {
                if (!DialogUtilities.AskQuestionAboutM64Pasting(pasteCount))
                {
                    return;
                }
                SetPasteProgressCount(0, pasteCount);
                SetPasteProgressVisibility(true);
            }

            if (insert)
            {
                int currentPosition = _gui.DataGridViewInputs.FirstDisplayedScrollingRowIndex;
                _gui.DataGridViewInputs.DataSource = null;
                for (int i = 0; i < pasteCount; i++)
                {
                    int           insertionIndex = index + i;
                    M64InputFrame newInput       = new M64InputFrame(
                        insertionIndex, copiedData.GetRawValue(i), false, this, _gui.DataGridViewInputs);
                    Inputs.Insert(insertionIndex, newInput);
                    ModifiedFrames.Add(newInput);

                    if (bigPaste)
                    {
                        SetPasteProgressCount(i + 1, pasteCount);
                    }
                }
                RefreshInputFrames(index);
                _gui.DataGridViewInputs.DataSource = Inputs;
                Config.M64Manager.UpdateTableSettings(ModifiedFrames);
                ControlUtilities.TableGoTo(_gui.DataGridViewInputs, currentPosition);
            }
            else
            {
                List <M64InputFrame> inputsToOverwrite = Inputs.Skip(index).Take(pasteCount).ToList();
                copiedData.Apply(inputsToOverwrite);
            }

            if (bigPaste)
            {
                SetPasteProgressVisibility(false);
            }

            IsModified       = true;
            Header.NumInputs = Inputs.Count;
            RefreshInputFrames(index);
            _gui.DataGridViewInputs.Refresh();
            Config.M64Manager.UpdateSelectionTextboxes();
        }
コード例 #21
0
 private void _numAngleResolution_Leave(object sender, EventArgs e)
 {
     DialogUtilities.NumericOnLeave(sender);
     if (_numAngleResolution.Value > Convert.ToInt32(_txbAngleRange.Text))
     {
         _numAngleResolution.Value = Convert.ToInt32(_txbAngleRange.Text);
     }
 }
コード例 #22
0
 private void _numBlue_Leave(object sender, EventArgs e)
 {
     DialogUtilities.NumericOnLeave(sender);
     if (_numBlue.Value != _numBlue.Maximum)
     {
         _numBlue.Value = _numBlue.Value + 1;
         _numBlue.Value = _numBlue.Value - 1;
     }
 }
コード例 #23
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                _itemUseColoredMarios        = new ToolStripMenuItem("Use Colored Marios");
                _itemUseColoredMarios.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeNextPositionsUseColoredMarios: true, newNextPositionsUseColoredMarios: !_useColoredMarios);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemUseColoredMarios.Checked = _useColoredMarios;

                _itemShowQuarterSteps        = new ToolStripMenuItem("Show Quarter Steps");
                _itemShowQuarterSteps.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeShowQuarterSteps: true, newShowQuarterSteps: !_showQuarterSteps);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemShowQuarterSteps.Checked = _showQuarterSteps;

                string suffix = string.Format(" ({0})", _numFrames);
                _itemSetNumFrames        = new ToolStripMenuItem(SET_NUM_FRAMES_TEXT + suffix);
                _itemSetNumFrames.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter num frames to the nearest 1/4th.");
                    double?numFramesNullable = ParsingUtilities.ParseDoubleNullable(text);
                    if (!numFramesNullable.HasValue)
                    {
                        return;
                    }
                    double            numFrames = numFramesNullable.Value;
                    MapObjectSettings settings  = new MapObjectSettings(
                        changeNextPositionsNumFrames: true, newNextPositionsNumFrames: numFrames);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _itemUsePitch        = new ToolStripMenuItem("Use Pitch");
                _itemUsePitch.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeUsePitch: true, newUsePitch: !_usePitch);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemUsePitch.Checked = _usePitch;

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemUseColoredMarios);
                _contextMenuStrip.Items.Add(_itemShowQuarterSteps);
                _contextMenuStrip.Items.Add(_itemSetNumFrames);
                _contextMenuStrip.Items.Add(_itemUsePitch);
            }

            return(_contextMenuStrip);
        }
コード例 #24
0
 public void ShowWarningMessage(string warningMessage, string caption)
 {
     if (InvokeRequired)
     {
         Invoke(_showWarningMessageHandler, warningMessage, caption);
     }
     else
     {
         DialogUtilities.ShowWarningMessage(warningMessage, caption);
     }
 }
コード例 #25
0
ファイル: ValueDialog.cs プロジェクト: sakpung/webstudy
        private void ValueDialog_Load(object sender, System.EventArgs e)
        {
            TypeProp prop = _typeProp[(int)_type];

            Text                  = prop.CaptionName;
            _gbOptions.Text       = string.Format("{0} ({1}..{2})", prop.ValueName, prop.Min, prop.Max);
            _numericValue.Minimum = prop.Min;
            _numericValue.Maximum = prop.Max;

            DialogUtilities.SetNumericValue(_numericValue, Value);
        }
コード例 #26
0
        public void OpenVariables()
        {
            List <XElement>         elements          = DialogUtilities.OpenXmlElements(FileType.StroopVarHackVariables);
            List <VarHackContainer> varHackContainers =
                elements.ConvertAll(element => VarHackContainer.CreateFromXml(this, element));

            lock (_objectLock)
            {
                varHackContainers.ForEach(varHackContainer => Controls.Add(varHackContainer));
            }
        }
コード例 #27
0
 public void ShowInformationMessage(string informationMessage, string caption)
 {
     if (InvokeRequired)
     {
         Invoke(_showInformationMessageHandler, informationMessage, caption);
     }
     else
     {
         DialogUtilities.ShowInformationMessage(informationMessage, caption);
     }
 }
コード例 #28
0
 public void ShowErrorMessage(string errorMessage, string caption)
 {
     if (InvokeRequired)
     {
         Invoke(_showErrorMessageHandler, errorMessage, caption);
     }
     else
     {
         DialogUtilities.ShowErrorMessage(errorMessage, caption);
     }
 }
コード例 #29
0
 public bool PromptCancellableInformationMessage(string informationMessage, string caption)
 {
     if (InvokeRequired)
     {
         return((bool)Invoke(_promptCancellableInformationMessageHandler, informationMessage, caption));
     }
     else
     {
         return(DialogUtilities.PromptCancellableInformationMessage(informationMessage, caption));
     }
 }
コード例 #30
0
 public bool PromptCancellableWarningMessage(string warningMessage, string caption)
 {
     if (InvokeRequired)
     {
         return((bool)Invoke(_promptCancellableWarningMessageHandler, warningMessage, caption));
     }
     else
     {
         return(DialogUtilities.PromptCancellableWarningMessage(warningMessage, caption));
     }
 }