コード例 #1
0
        protected void Create(bool insertMode, params string[] lines)
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _factory.DefaultValue = DefaultValue.Mock;
            _textView             = CreateTextView(lines);
            _textBuffer           = _textView.TextBuffer;
            _vim               = _factory.Create <IVim>(MockBehavior.Loose);
            _editorOptions     = _factory.Create <IEditorOptions>(MockBehavior.Loose);
            _textChangeTracker = _factory.Create <ITextChangeTracker>(MockBehavior.Loose);
            _textChangeTracker.SetupGet(x => x.CurrentChange).Returns(FSharpOption <TextChange> .None);
            _undoRedoOperations = new UndoRedoOperations(VimHost, new StatusUtil(), FSharpOption <ITextUndoHistory> .None, null);
            _wordCompletionSessionFactoryService = _factory.Create <IWordCompletionSessionFactoryService>();

            var localSettings = new LocalSettings(Vim.GlobalSettings);

            _vimBuffer      = Vim.CreateVimBuffer(_textView);
            _globalSettings = _vimBuffer.GlobalSettings;
            var vimTextBuffer = Vim.GetOrCreateVimTextBuffer(_textView.TextBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);

            _operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            _broker     = _factory.Create <IDisplayWindowBroker>();
            _broker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _broker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
            _broker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _broker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);
            _insertUtil  = _factory.Create <IInsertUtil>();
            _motionUtil  = _factory.Create <IMotionUtil>();
            _commandUtil = _factory.Create <ICommandUtil>();
            _capture     = _factory.Create <IMotionCapture>();

            // Setup the mouse.  By default we say it has no buttons down as that's the normal state
            _mouseDevice = _factory.Create <IMouseDevice>();
            _mouseDevice.SetupGet(x => x.IsLeftButtonPressed).Returns(false);

            // Setup the keyboard.  By default we don't say that any button is pressed.  Insert mode is usually
            // only concerned with arrow keys and we will set those up as appropriate for the typing tests
            _keyboardDevice = _factory.Create <IKeyboardDevice>();
            _keyboardDevice.Setup(x => x.IsArrowKeyDown).Returns(false);

            _modeRaw = new global::Vim.Modes.Insert.InsertMode(
                _vimBuffer,
                _operations,
                _broker.Object,
                _editorOptions.Object,
                _undoRedoOperations,
                _textChangeTracker.Object,
                _insertUtil.Object,
                _motionUtil.Object,
                _commandUtil.Object,
                _capture.Object,
                !insertMode,
                _keyboardDevice.Object,
                _mouseDevice.Object,
                WordUtil,
                _wordCompletionSessionFactoryService.Object);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
            _mode.CommandRan += (sender, e) => { _lastCommandRan = e.CommandRunData; };
        }
コード例 #2
0
ファイル: SQLite.cs プロジェクト: nokia6102/jasily.cologler
        public string GetString(InsertMode insert)
        {
            switch (insert)
            {
            case InsertMode.Insert:
                return("INSERT");

            case InsertMode.Replace:
                return("REPLACE");

            case InsertMode.InsertOrReplace:
                return("INSERT OR REPLACE");

            case InsertMode.InsertOrRollback:
                return("INSERT OR ROLLBACK");

            case InsertMode.InsetOrAbort:
                return("INSERT OR ABORT");

            case InsertMode.InsertOrFail:
                return("INSERT OR FAIL");

            case InsertMode.InsertOrIgnore:
                return("INSERT OR IGNORE");

            default:
                throw new ArgumentOutOfRangeException("insert", insert, null);
            }
        }
コード例 #3
0
ファイル: RecordListDialog.cs プロジェクト: jg-maon/gpe
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="insertMode">追加モード</param>
 /// <param name="idList">ID一覧</param>
 public RecordListDialog(InsertMode insertMode = InsertMode.ADD, List<Parameter.ParameterBase> idList = null)
 {
     InitializeComponent();
     m_mode = insertMode;
     IdList = idList;
     _ChangedMode(insertMode);
 }
コード例 #4
0
        /// <summary>
        /// Will register a specified type to a value. This will depending on the mode change the registry.
        /// </summary>
        /// <param name="bin"></param>
        /// <param name="type"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentException"></exception>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public bool Register(TBin bin, Type type, InsertMode mode = InsertMode.Insert)
        {
            switch (mode)
            {
            case InsertMode.Insert:
                goto Insert;

            case InsertMode.DupleReturn:
                if (HasBinBinding(bin) || HasObjBinding(type))
                {
                    return(false);
                }
                goto Insert;

            case InsertMode.DupleThrows:
                if (HasBinBinding(bin) || HasObjBinding(type))
                {
                    throw new ArgumentException($"Trying to add duplicate binding {bin} for {type}");
                }
                goto Insert;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

Insert:
            mapBinToObj[bin]  = type;
            mapObjToBin[type] = bin;
            return(true);
        }
コード例 #5
0
        /// <summary>
        /// 生成Flash的Html的代码
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="width">宽</param>
        /// <param name="height">高</param>
        /// <param name="vspace"></param>
        /// <param name="hspace"></param>
        /// <param name="title">标题</param>
        /// <param name="accessKey">访问键</param>
        /// <param name="tabIndex">索引</param>
        /// <param name="align">显示方式</param>
        /// <param name="quality">显示质量</param>
        /// <param name="isLoopPlay">循环播放</param>
        /// <param name="isAutoPlay">自动播放</param>
        /// <returns>返回字符串</returns>
        public string FlashHtml(
            InsertMode insertMode,
            string path,
            string width,
            string height,
            string vspace,
            string hspace,
            string title,
            string accessKey,
            string tabIndex,
            Align align,
            Quality quality,
            bool isLoopPlay,
            bool isAutoPlay,
            string scale,
            string mediaID
            )
        {
            string flashCode = "";
            string pathStr   = "";

            if (insertMode == InsertMode.Id)
            {
                pathStr = "${srs_" + mediaID + "}";
            }
            else
            {
                pathStr = path;
            }
            XmlDocument flashDoc = new XmlDocument();

            flashCode  = "<noscript>";
            flashCode += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  ";
            flashCode += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" ";
            flashCode += "style=\"WIDTH: " + width + "; HEIGHT: " + height + "\" hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
            flashCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
            flashCode += "title=\"" + title + "\" accesskey=\"" + accessKey + "\" tabindex=\"" + tabIndex + "\" align=\"" + align + "\">";
            flashCode += "<param name=\"movie\" value=\"" + pathStr + "\" />";

            flashCode += "<param name=\"loop\" value=\"" + Convert.ToInt32(isLoopPlay) + "\" />";
            flashCode += "<param name=\"play\" value=\"" + Convert.ToInt32(isAutoPlay) + "\" />";
            flashCode += "<param name=\"scale\" value=\"" + scale + "\" />";
            flashCode += "<param name=\"src\" value=\"${srs_" + mediaID + "}\" />";
            flashCode += "<param name=\"quality\" value=\"" + quality.ToString() + "\" />";
            flashCode += "<param name=\"SCALE\" value=\"" + scale + "\" />";

            flashCode += "<embed width=\"" + width + "\" height=\"" + height + "\" ";
            flashCode += "src=\"${srs_" + mediaID + "}\" ";
            flashCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\"";
            flashCode += "align=\"" + align.ToString() + "\" quality=" + quality.ToString() + " ";
            flashCode += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" ";
            flashCode += "scale=\"" + scale + "\"></embed>";

            flashCode += "</object>";
            flashCode += "</noscript>";


            return(flashCode);
        }
コード例 #6
0
 public InsertStatement(InsertMode mode, bool ignore, Identifier table,
                        IList <Identifier> columnList, IQueryExpression select,
                        IDictionary <Identifier, IExpression> duplicateUpdate)
     : base(table, columnList, select)
 {
     this.Mode            = mode;
     this.Ignore          = ignore;
     this.DuplicateUpdate = duplicateUpdate;
 }
コード例 #7
0
 public override void Reset()
 {
     base.Reset();
     GameObject = null;
     Index      = -1;
     Points     = new FsmVector3[1];
     Space      = Space.Self;
     Mode       = InsertMode.After;
 }
コード例 #8
0
        public override InsertResult InsertOne(T entity, InsertMode insertMode)
        {
            CheckOpenedConnection();

            var entitydomain = entity;

            NoSQLRepoHelper.SetIds(entitydomain);

            var updateddate = NoSQLRepoHelper.DateTimeUtcNow();
            var createdDate = NoSQLRepoHelper.DateTimeUtcNow();

            if (!string.IsNullOrEmpty(entity.Id) && localDb.ContainsKey(entity.Id))
            {
                // Document already exists
                switch (insertMode)
                {
                case InsertMode.error_if_key_exists:
                    throw new DupplicateKeyNoSQLException();

                case InsertMode.erase_existing:
                    createdDate = localDb[entity.Id].SystemCreationDate;
                    localDb.Remove(entity.Id);
                    break;

                case InsertMode.do_nothing_if_key_exists:
                    return(InsertResult.not_affected);

                default:
                    break;
                }
            }

            if (AutoGeneratedEntityDate)
            {
                entitydomain.SystemCreationDate   = createdDate;
                entitydomain.SystemLastUpdateDate = updateddate;
            }

            // Clone to not shared reference between App instance and repository persisted value
            // UTC : Ensure to store only utc datetime
            var entityToStore = NewtonJsonHelper.CloneJson(entitydomain, DateTimeZoneHandling.Utc);

            if (localDb.ContainsKey(entity.Id))
            {
                localDb[entity.Id] = entityToStore;
            }
            else
            {
                localDb.Add(entity.Id, entityToStore);
            }

            config.ExpireAt(entity.Id, null);

            SaveJSONFile();

            return(InsertResult.inserted);
        }
コード例 #9
0
 public Insert Begin(InsertMode mode, ConflictMode?conflictMode = null)
 {
     if (conflictMode.HasValue)
     {
         _components.Add(new InsertComponent(conflictMode.Value));
         return(this);
     }
     _components.Add(new InsertComponent(mode));
     return(this);
 }
コード例 #10
0
        public override InsertResult InsertOne(T entity, InsertMode insertMode)
        {
            CheckOpenedConnection();

            var createdDate = NoSQLRepoHelper.DateTimeUtcNow();
            var updateddate = NoSQLRepoHelper.DateTimeUtcNow();

            MutableDocument mutabledocument;

            if (!string.IsNullOrEmpty(entity.Id))
            {
                // Get an existing document or return a new one if not exists
                var document = database.GetDocument(entity.Id);
                if (document != null)
                {
                    // Document already exists
                    switch (insertMode)
                    {
                    case InsertMode.error_if_key_exists:
                        throw new DupplicateKeyNoSQLException();

                    case InsertMode.erase_existing:
                        createdDate = document.GetDate("SystemCreationDate");
                        database.Delete(document);
                        break;

                    case InsertMode.do_nothing_if_key_exists:
                        return(InsertResult.not_affected);

                    default:
                        break;
                    }
                }

                mutabledocument = new MutableDocument(entity.Id);
            }
            else
            {
                mutabledocument = new MutableDocument();
            }

            // Normally, at this point, the document is deleted from database or an exception occured.
            // We can insert the new document :
            mutabledocument.SetString("collection", CollectionName);

            entity.SystemCreationDate   = createdDate;
            entity.SystemLastUpdateDate = updateddate;
            entity.Id = mutabledocument.Id;

            SetDocument(entity, mutabledocument);

            database.Save(mutabledocument);

            return(InsertResult.inserted);
        }
コード例 #11
0
        private void Create(bool insertMode, params string[] lines)
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _factory.DefaultValue = DefaultValue.Mock;
            _textView             = CreateTextView(lines);
            _textBuffer           = _textView.TextBuffer;
            _vim               = _factory.Create <IVim>(MockBehavior.Loose);
            _editorOptions     = _factory.Create <IEditorOptions>(MockBehavior.Loose);
            _textChangeTracker = _factory.Create <ITextChangeTracker>(MockBehavior.Loose);
            _textChangeTracker.SetupGet(x => x.CurrentChange).Returns(FSharpOption <TextChange> .None);
            _undoRedoOperations = _factory.Create <IUndoRedoOperations>();
            _wordCompletionSessionFactoryService = _factory.Create <IWordCompletionSessionFactoryService>();

            var localSettings = new LocalSettings(Vim.GlobalSettings);

            _vimBuffer = MockObjectFactory.CreateVimBuffer(
                _textView,
                localSettings: localSettings,
                vim: _vim.Object,
                factory: _factory);
            _vimBuffer.SetupGet(x => x.ModeKind).Returns(ModeKind.Insert);
            _operations = _factory.Create <ICommonOperations>();
            _operations.SetupGet(x => x.EditorOperations).Returns(EditorOperationsFactoryService.GetEditorOperations(_textView));
            _broker = _factory.Create <IDisplayWindowBroker>();
            _broker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _broker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
            _broker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _insertUtil = _factory.Create <IInsertUtil>();

            // Setup the mouse.  By default we say it has no buttons down as that's the normal state
            _mouseDevice = _factory.Create <IMouseDevice>();
            _mouseDevice.SetupGet(x => x.IsLeftButtonPressed).Returns(false);

            // Setup the keyboard.  By default we don't say that any button is pressed.  Insert mode is usually
            // only concerned with arrow keys and we will set those up as appropriate for the typing tests
            _keyboardDevice = _factory.Create <IKeyboardDevice>();
            _keyboardDevice.Setup(x => x.IsKeyDown(It.IsAny <VimKey>())).Returns(false);

            _modeRaw = new global::Vim.Modes.Insert.InsertMode(
                _vimBuffer.Object,
                _operations.Object,
                _broker.Object,
                _editorOptions.Object,
                _undoRedoOperations.Object,
                _textChangeTracker.Object,
                _insertUtil.Object,
                !insertMode,
                _keyboardDevice.Object,
                _mouseDevice.Object,
                WordUtilFactory.GetWordUtil(_textView.TextBuffer),
                _wordCompletionSessionFactoryService.Object);
            _mode             = _modeRaw;
            _mode.CommandRan += (sender, e) => { _lastCommandRan = e.CommandRunData; };
        }
コード例 #12
0
        private void ActoinList_InsertPose(InsertMode mode)
        {
            int actionId;

            if ((actionId = GetSelectedActionId()) < 0)
            {
                return;
            }
            ;
            data.ActionInfo ai = UBT.actionTable.action[actionId];
            if (ai.actionFileExists && !ai.poseLoaded)
            {
                MessageBoxResult mbr = MessageBox.Show("现在编辑会以新动作为基础, 先下载原来的动作吗? ", "档案尚未下载", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                if (mbr == MessageBoxResult.Cancel)
                {
                    return;
                }
                if (mbr == MessageBoxResult.Yes)
                {
                    DownloadAction();
                    if (!ai.poseLoaded)
                    {
                        return;
                    }
                }
            }

            int poseId;

            if (mode == InsertMode.END)
            {
                poseId = ai.pose.Length;
            }
            else
            {
                if ((poseId = IsPoseSelected()) < 0)
                {
                    return;
                }
                if (mode == InsertMode.AFTER)
                {
                    poseId++;
                }
            }

            int newPose = ai.InsertPose((UInt16)poseId);

            if (newPose < 0)
            {
                return;
            }
            RefreshAction(actionId);
            ucActionDetail.SetSelectedIndex(newPose);
        }
コード例 #13
0
 /// <summary>
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="ignore"></param>
 /// <param name="table"></param>
 /// <param name="columnNameList"></param>
 /// <param name="select"></param>
 /// <param name="duplicateUpdate"></param>
 public DmlInsertStatement(InsertMode mode,
                           bool ignore,
                           Identifier table,
                           IList<Identifier> columnNameList,
                           IQueryExpression select,
                           IList<Pair<Identifier, IExpression>> duplicateUpdate)
     : base(table, columnNameList, select)
 {
     Mode = mode;
     IsIgnore = ignore;
     DuplicateUpdate = EnsureListType(duplicateUpdate);
 }
コード例 #14
0
        public override InsertResult InsertOne(T entity, InsertMode insertMode)
        {
            if (insertMode == InsertMode.erase_existing && !string.IsNullOrWhiteSpace(entity.Id) && Exist(entity.Id))
            {
                var existingEntity = GetById(entity.Id);

                entity.SystemCreationDate = existingEntity.SystemCreationDate;

                Delete(existingEntity.Id, true);
            }
            try
            {
                try
                {
                    var date = NoSQLRepoHelper.DateTimeUtcNow();
                    if (AutoGeneratedEntityDate)
                    {
                        if (insertMode != InsertMode.erase_existing)
                        {
                            entity.SystemCreationDate = date;
                        }

                        entity.SystemLastUpdateDate = date;
                    }

                    collection.InsertOne(entity);
                    return(InsertResult.inserted);
                }
                catch (AggregateException e)
                {
                    throw e.InnerException;
                }
            }
            catch (MongoWriteException e)
            {
                if (e.WriteError.Category == ServerErrorCategory.DuplicateKey && insertMode == InsertMode.error_if_key_exists)
                {
                    throw new DupplicateKeyNoSQLException("The key '" + entity.Id + "' already exists", e);
                }
                if (e.WriteError.Category == ServerErrorCategory.DuplicateKey && insertMode == InsertMode.do_nothing_if_key_exists)
                {
                    return(InsertResult.not_affected);
                }
                else if (e.WriteError.Category == ServerErrorCategory.DuplicateKey)
                {
                    return(InsertResult.duplicate_key_exception);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #15
0
 /// <summary>
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="ignore"></param>
 /// <param name="table"></param>
 /// <param name="columnNameList"></param>
 /// <param name="select"></param>
 /// <param name="duplicateUpdate"></param>
 public DmlInsertStatement(InsertMode mode,
                           bool ignore,
                           Identifier table,
                           IList <Identifier> columnNameList,
                           IQueryExpression select,
                           IList <Pair <Identifier, IExpression> > duplicateUpdate)
     : base(table, columnNameList, select)
 {
     Mode            = mode;
     IsIgnore        = ignore;
     DuplicateUpdate = EnsureListType(duplicateUpdate);
 }
コード例 #16
0
	// Constructor.
	internal TextBoxBase()
			{
				acceptsTab = false;
				autoSize = true;
				hideSelection = true;
				modified = false;
				multiline = false;
				readOnly = false;
				insertMode = InsertMode.Insert;
				wordWrap = true;
				BorderStyleInternal = BorderStyle.Fixed3D;
				maxLength = 32767;
			}
コード例 #17
0
        public VimHandler(TextArea ta, String FileName) : base(ta)
        {
            this.FileName  = FileName;
            CommandMode    = new CommandMode(this);
            InsertMode     = new InsertMode(this);
            ArgumentMode   = new ArgumentMode(this);
            VisualMode     = new VisualMode(this);
            VisualLineMode = new VisualLineMode(this);

            ViSDGlobalState.StateChanged += delegate(object sender, State s) {
                ActualMode = GetModeByState(s);
            };

            ActualMode = GetModeByState(ViSDGlobalState.State);
        }
コード例 #18
0
        public InsertComponent(InsertMode insertMode)
        {
            switch (insertMode)
            {
            case InsertMode.Insert:
                value = Constants.QueryComponents.INSERT;
                break;

            case InsertMode.Replace:
                value = Constants.QueryComponents.REPLACE;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(insertMode), insertMode, null);
            }
        }
コード例 #19
0
        public override InsertResult InsertOne(T entity, InsertMode keyExistsAction)
        {
            var insertResult = default(InsertResult);

            var date = NoSQLRepoHelper.DateTimeUtcNow();

            if (AutoGeneratedEntityDate)
            {
                entity.SystemCreationDate   = date;
                entity.SystemLastUpdateDate = date;
            }

            NoSQLRepoHelper.SetIds(entity);

            if (localDb.ContainsKey(entity.Id))
            {
                if (keyExistsAction == InsertMode.error_if_key_exists)
                {
                    throw new DupplicateKeyNoSQLException();
                }
                else if (keyExistsAction == InsertMode.do_nothing_if_key_exists)
                {
                    return(InsertResult.not_affected);
                }
                else if (keyExistsAction == InsertMode.erase_existing)
                {
                    entity.SystemCreationDate = localDb[entity.Id].SystemCreationDate; // keep the origin creation date of the entity
                    // Continue execution
                }
                insertResult = InsertResult.updated;
            }
            else
            {
                insertResult = InsertResult.inserted;
            }

            // Clone to not shared reference between App instance and repository persisted value
            // UTC : Ensure to store only utc datetime
            var entityToStore = NewtonJsonHelper.CloneJson(entity, DateTimeZoneHandling.Utc);

            localDb[entity.Id] = entityToStore;
            config.ExpireAt(entity.Id, null);

            SaveJSONFile();
            return(insertResult);
        }
コード例 #20
0
        /// <summary>
        /// copy the style of old range to new range
        /// </summary>
        /// <param name="to">the new range where style will applied to</param>
        /// <param name="offset">the old range where style will be copied</param>
        /// <param name="skip">the number of rows or columns to skip</param>
        /// <returns>The <paramref name="ExcelRange"/> after new style applied</returns>
        public static ExcelRange CopyStyleFrom(this ExcelRange to, ExcelRange from, InsertMode mode = InsertMode.ColumnRight, bool withValue = false, int skip = 0)
        {
            var fromIndex = from.GetRangeIndex();
            var toIndex   = to.GetRangeIndex();
            var offset    = (mode.In(InsertMode.RowAfter, InsertMode.RowBefore) ? fromIndex[2] - fromIndex[0] : fromIndex[3] - fromIndex[1]) + 1;
            var range     = (mode.In(InsertMode.RowAfter, InsertMode.RowBefore) ? toIndex[2] - toIndex[0] : toIndex[3] - toIndex[1]) + 1;
            var rest      = range % offset;
            var loop      = (range - rest) / offset;
            var index     = 0;

            for (; index < loop; index++)
            {
                ExcelRange tmpRange = null;

                if (mode.In(InsertMode.RowAfter, InsertMode.RowBefore))
                {
                    tmpRange = to.GetRange(new[] { fromIndex[0] + (index + 1 + skip) * offset, fromIndex[1], fromIndex[2] + (index + 1 + skip) * offset, fromIndex[3] });
                }
                else
                {
                    tmpRange = to.GetRange(new[] { fromIndex[0], fromIndex[1] + (index + 1 + skip) * offset, fromIndex[2], fromIndex[3] + (index + 1 + skip) * offset });
                }

                from.Copy(tmpRange);
                if (!withValue)
                {
                    tmpRange.ForEach(t => t.Value = "");
                }
            }

            if (rest > 0)
            {
                var restRange = to.GetRange(new[] { fromIndex[0], fromIndex[1] + index * offset, fromIndex[2], fromIndex[1] + index * offset + rest - 1 });
                var x         = from.Start.Address.AddressToNumber();
                var y         = from.End.Address.AddressToNumber();
                var restFrom  = from[x[0], x[1], y[0], x[1] + rest - 1];
                restFrom.Copy(restRange);
                if (!withValue)
                {
                    restRange.ForEach(t => t.Value = "");
                }
            }

            return(to);
        }
コード例 #21
0
        private string TranslateMode(UInt16 mode)
        {
            InsertMode levelmode = (InsertMode)mode & (InsertMode)TrainMachine.LevelMask;

            InsertMode placemode = (InsertMode)mode & (InsertMode)TrainMachine.PlaceMask;

            string level_message = "", place_message = "";

            if (levelmode == InsertMode.AutoLevel)
            {
                level_message = "AutoLevel";
            }
            if (levelmode == InsertMode.DegradeLevel)
            {
                level_message = "DegradeLevel";
            }
            if (levelmode == InsertMode.UpgradeLevel)
            {
                level_message = "UpgradeLevel";
            }
            if (levelmode == InsertMode.ExactlyLevel)
            {
                level_message = "ExactlyLevel";
            }

            if (placemode == InsertMode.NewPlace)
            {
                place_message = "NewPlace";
            }
            if (placemode == InsertMode.OldPlace)
            {
                place_message = "OldPlace";
            }
            if (placemode == InsertMode.AutoPlace)
            {
                place_message = "AutoPlace";
            }

            return(level_message + " AND " + place_message);
        }
コード例 #22
0
        public string ToShowString()
        {
            string s1 =
                "System available: " + SystemAvailable.ToString() +
                "  " + Environment.NewLine +
                "Subsystem ready: " + SubsystemReady.ToString() +
                "  " + Environment.NewLine +
                "Keyboard shift: " + KeyboardShift.ToString() +
                "  " + Environment.NewLine +
                "Caps lock: " + CapsLock.ToString() +
                "  " + Environment.NewLine +
                "Insert mode: " + InsertMode.ToString() +
                "  " + Environment.NewLine +
                "Operator input error: " + OperatorInputError.ToString() +
                "  " + Environment.NewLine +
                "System wait: " + SystemWait.ToString() +
                "  " + Environment.NewLine +
                "Communications error: " + CommunicationsError.ToString() +
                "  " + Environment.NewLine +
                "Message wait: " + MessageWait.ToString();

            return(s1);
        }
コード例 #23
0
	protected override void OnKeyDown(KeyEventArgs e)
	{
		base.OnKeyDown(e);
		if( e.Handled ) return; 
		
		bool extendSel = (ModifierKeys & Keys.Shift) != 0;
		bool controlKey = (ModifierKeys & Keys.Control) != 0;
		
		switch (e.KeyCode)
		{
			case Keys.PageUp:
				MoveCaret(CaretDirection.PageUp, extendSel);
				e.Handled = true;
				break;
			case Keys.PageDown:
				MoveCaret(CaretDirection.PageDown, extendSel);
				e.Handled = true;
				break;
			case Keys.Home:
				MoveCaret(controlKey ? CaretDirection.TextStart : CaretDirection.LineStart, extendSel);
				e.Handled = true;
				break;
			case Keys.End:
				MoveCaret(controlKey ? CaretDirection.TextEnd : CaretDirection.LineEnd, extendSel);
				e.Handled = true;
				break;
			case Keys.C:
				if (controlKey)
				{
					Copy();
					e.Handled = true;
				}
				break;
			case Keys.X:
				if (controlKey)
				{
					Cut();
					e.Handled = true;
				}
				break;
			case Keys.V:
				if (controlKey)
				{
					Paste();
					e.Handled = true;
				}
				break;
			case Keys.A:
				if (controlKey)
				{
					SelectAll();
					e.Handled = true;
				}
				break;
			case Keys.Z:
				if (controlKey)
				{
					Undo();
					e.Handled = true;
				}
				break;
			case Keys.Back:
				DeleteTextOp(controlKey ? CaretDirection.WordLeft : CaretDirection.Left);
				e.Handled = true;
				break;
			case Keys.Delete:
				DeleteTextOp(controlKey ? CaretDirection.WordRight : CaretDirection.Right);
				e.Handled = true;
				break;
			case Keys.Insert:
				insertMode = insertMode==InsertMode.Insert ? InsertMode.Overwrite : InsertMode.Insert;
				OnToggleInsertMode();
				e.Handled = true;
				break;
		}
	}
コード例 #24
0
        // string type_Media = "audio/x-pn-RealAudio-plugin";


        /// <summary>
        /// 生成视频的Html的代码
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="width">宽</param>
        /// <param name="height">高</param>
        /// <param name="vspace"></param>
        /// <param name="hspace"></param>
        /// <param name="title">标题</param>
        /// <param name="accessKey">访问键</param>
        /// <param name="tabIndex">索引</param>
        /// <param name="align">显示方式</param>
        /// <param name="quality">显示质量</param>
        /// <param name="isLoopPlay">循环播放</param>
        /// <param name="isAutoPlay">自动播放</param>
        /// <returns>返回字符串</returns>
        public string MediaHtml(
            InsertMode insertMode,
            string path,
            string width,
            string height,
            string vspace,
            string hspace,
            string title,
            string accessKey,
            string tabIndex,
            Align align,
            Quality quality,
            bool isLoopPlay,
            bool isAutoPlay,//自动播放
            string scale,
            string mediaID
            )
        {
            string mediaCode = "";
            string pathStr   = "";

            if (insertMode == InsertMode.Id)
            {
                pathStr = "${srs_" + mediaID + "}";
            }
            else
            {
                pathStr = path;
            }
            string strExtension = Path.GetExtension(path);

            switch (strExtension)
            {
            case ".rm":
            case ".rmvb":
            {
                mediaCode  = "<object id=\"player\" height=\"" + height + "\" width=\"" + width + "\"";
                mediaCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                mediaCode += "classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" name=\"player\">";
                mediaCode += "<param name=\"_ExtentX\" value=\"10583\" />";
                mediaCode += "<param name=\"_ExtentY\" value=\"7197\" />";
                mediaCode += "<param name=\"AUTOSTART\" value=\"" + (0 - Convert.ToInt32(isAutoPlay)) + "\" />";
                mediaCode += "<param name=\"SHUFFLE\" value=\"0\" />";
                mediaCode += "<param name=\"PREFETCH\" value=\"0\" />";
                mediaCode += "<param name=\"NOLABELS\" value=\"-1\" />";
                mediaCode += "<param name=\"SRC\" value=\"" + pathStr + "\" />";
                mediaCode += "<param name=\"CONTROLS\" value=\"Imagewindow\" />";
                mediaCode += "<param name=\"CONSOLE\" value=\"clip1\" />";
                mediaCode += "<param name=\"LOOP\" value=\"" + Convert.ToInt32(isLoopPlay) + "\" />";
                mediaCode += "<param name=\"NUMLOOP\" value=\"0\" />";
                mediaCode += "<param name=\"CENTER\" value=\"0\" />";
                mediaCode += "<param name=\"MAINTAINASPECT\" value=\"0\" />";
                mediaCode += "<param name=\"BACKGROUNDCOLOR\" value=\"#000000\" />";
                mediaCode += "<param name=\"quality\" value=\"" + quality.ToString() + "\" />";
                mediaCode += "<param name=\"SCALE\" value=\"" + scale + "\" />";


                mediaCode += "<embed width=\"" + width + "\" height=\"" + height + "\" border=\"0\" showdisplay=\"0\" ";
                mediaCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                mediaCode += "showcontrols=\"1\" autostart=\"" + Convert.ToInt32(isAutoPlay) + "\" autorewind=\"0\" playcount=\"0\" ";
                mediaCode += "moviewindowheight=\"" + height + "\" moviewindowwidth=\"" + width + "\" ";
                mediaCode += "filename=\"" + pathStr + "\" />";


                mediaCode += "</object>";
                return(mediaCode);
            }

            case ".avi":
            {
                mediaCode  = "<object id=\"video1\" height=\"" + height + "\" width=\"" + width + "\"";
                mediaCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                mediaCode += "classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\">";
                mediaCode += "<param name=\"_ExtentX\" value=\"9313\" />";
                mediaCode += "<param name=\"_ExtentY\" value=\"7620\" />";
                mediaCode += "<param name=\"AUTOSTART\" value=\"" + (0 - Convert.ToInt32(isAutoPlay)) + "\" />";
                mediaCode += "<param name=\"SHUFFLE\" value=\"0\" />";
                mediaCode += "<param name=\"PREFETCH\" value=\"0\" />";
                mediaCode += "<param name=\"NOLABELS\" value=\"0\" />";
                mediaCode += "<param name=\"SRC\" value=\"" + "${srs_" + mediaID + "}" + "\" />";
                mediaCode += "<param name=\"CONTROLS\" value=\"ImageWindow\" />";
                mediaCode += "<param name=\"CONSOLE\" value=\"Clip1\" />";
                mediaCode += "<param name=\"LOOP\" value=\"0\" />";
                mediaCode += "<param name=\"NUMLOOP\" value=\"0\" />";
                mediaCode += "<param name=\"CENTER\" value=\"0\" />";
                mediaCode += "<param name=\"MAINTAINASPECT\" value=\"0\" />";
                mediaCode += "<param name=\"BACKGROUNDCOLOR\" value=\"#000000\" />";
                mediaCode += "<param name=\"quality\" value=\"" + quality.ToString() + "\" />";
                mediaCode += "<param name=\"SCALE\" value=\"" + scale + "\" />";


                mediaCode += "<embed width=\"" + width + "\" height=\"" + height + "\" border=\"0\" showdisplay=\"0\" ";
                mediaCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                mediaCode += "showcontrols=\"1\" autostart=\"" + Convert.ToInt32(isAutoPlay) + "\" autorewind=\"0\" playcount=\"0\" ";
                mediaCode += "moviewindowheight=\"" + height + "\" moviewindowwidth=\"" + width + "\" ";
                mediaCode += "filename=\"" + pathStr + "\" />";

                mediaCode += "</object>";
                return(mediaCode);
            }

            //case ".mpg":
            //    return MediaObject.GetMediaPlayerObjectString(width, height, (MediaObject.Align)align, mediaID, isLoopPlay, isAutoPlay);
            case ".wmv":
            {
                mediaCode  = "<object id=\"mPlayer1\" style=\"WIDTH: " + width + "; HEIGHT: " + height + "\"";
                mediaCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                mediaCode += "type='application/x-oleobject\"' height=\"115\" width=\"220\"";
                mediaCode += "classid=\"CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\">";
                mediaCode += "<param name=\"URL\" value=\"" + pathStr + "\" />";
                mediaCode += "<param name=\"rate\" value=\"1\" />";
                mediaCode += "<param name=\"balance\" value=\"0\" />";
                mediaCode += "<param name=\"currentPosition\" value=\"0\" />";
                mediaCode += "<param name=\"defaultFrame\" value=\"\" />";
                mediaCode += "<param name=\"playCount\" value=\"100\" />";
                mediaCode += "<param name=\"autoStart\" value=\"" + (0 - Convert.ToInt32(isAutoPlay)) + "\" />";
                mediaCode += "<param name=\"currentMarker\" value=\"0\" />";
                mediaCode += "<param name=\"invokeURLs\" value=\"-1\" />";
                mediaCode += "<param name=\"baseURL\" value=\"\" />";
                mediaCode += "<param name=\"volume\" value=\"100\" />";
                mediaCode += "<param name=\"mute\" value=\"0\" />";
                mediaCode += "<param name=\"uiMode\" value=\"full\" />";
                mediaCode += "<param name=\"stretchToFit\" value=\"0\" />";
                mediaCode += "<param name=\"windowlessVideo\" value=\"0\" />";
                mediaCode += "<param name=\"enabled\" value=\"-1\" />";
                mediaCode += "<param name=\"enableContextMenu\" value=\"0\" />";
                mediaCode += "<param name=\"fullScreen\" value=\"0\" />";
                mediaCode += "<param name=\"SAMIStyle\" value=\"\" />";
                mediaCode += "<param name=\"SAMILang\" value=\"\" />";
                mediaCode += "<param name=\"SAMIFilename\" value=\"\" />";
                mediaCode += "<param name=\"captioningID\" value=\"\" />";
                mediaCode += "<param name=\"enableErrorDialogs\" value=\"0\" />";
                mediaCode += "<param name=\"_cx\" value=\"5821\" />";
                mediaCode += "<param name=\"_cy\" value=\"3043\" />";
                mediaCode += "<param name=\"quality\" value=\"" + quality.ToString() + "\" />";
                mediaCode += "<param name=\"SCALE\" value=\"" + scale + "\" />";

                mediaCode += "<embed width=\"" + width + "\" height=\"" + height + "\" border=\"0\" showdisplay=\"0\" ";
                mediaCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                mediaCode += "showcontrols=\"1\" autostart=\"" + Convert.ToInt32(isAutoPlay) + "\" autorewind=\"0\" playcount=\"0\" ";
                mediaCode += "moviewindowheight=\"" + height + "\" moviewindowwidth=\"" + width + "\" ";
                mediaCode += "filename=\"" + pathStr + "\" />";

                mediaCode += "</object>";

                return(mediaCode);
            }

            default:
            {
                return("");
            }
            }
        }
コード例 #25
0
        protected override void OnBeforeInsert(jQueryObject targetElement, InsertMode mode)
        {
            // Setup initial conditions.
            if (mode != InsertMode.Replace) return;

            // Retrieve the 'value' if there is one.
            string value = targetElement.GetAttribute(Html.Value);
            if (!Script.IsUndefined(value))
            {
                Text = value;
            }

            // Finish up.
            base.OnBeforeInsert(targetElement, mode);
        }
コード例 #26
0
        private EmployeeRole AttachWithRelations(EmployeeRole entity, InsertMode insertMode = InsertMode.Attach, MergeOption mergeOption = MergeOption.AppendOnly, List <object> referenceTrackingList = null)
        {
            #region iteration tracking

            if (ReferenceEquals(null, referenceTrackingList))
            {
                referenceTrackingList = new List <object>();
            }

            if (referenceTrackingList.Contains(entity))
            {
                return(_employeeRoles.GetExisting(entity));
            }
            else
            {
                referenceTrackingList.Add(entity);
            }

            #endregion

            #region add/attach entity

            EmployeeRole existingEntity = null;

            switch (insertMode)
            {
            case InsertMode.Add:
                existingEntity = _employeeRoles.Add(entity);
                break;

            case InsertMode.Attach:
                existingEntity = _employeeRoles.Attach(entity);
                break;

            default:
                throw new Exception(string.Format("Implementation Exception: missing action for {0}", insertMode));
            }

            if (!ReferenceEquals(null, existingEntity) && ReferenceEquals(existingEntity, entity))
            {
                return(existingEntity);
            }

            #endregion

            #region attach relations recursively


            if (!ReferenceEquals(null, entity.Employees))
            {
                // register relation's collection changed event if entity is new to context
                if (ReferenceEquals(null, existingEntity))
                {
                    entity.Employees.CollectionChanged += On_employeeRole_employees_collectionChanged;
                }

                // attach related entities to context
                if (entity.Employees.Count > 0)
                {
                    foreach (var item in entity.Employees.ToArray())
                    {
                        var existingRelatedEntity = (Employee)AttachWithRelations(item, insertMode, mergeOption, referenceTrackingList);

                        // update relation if entity is new to context or relation is new to entity
                        if (ReferenceEquals(null, existingEntity) || !existingEntity.Employees.Contains(item))
                        {
                            if (!ReferenceEquals(null, existingRelatedEntity) && !ReferenceEquals(existingRelatedEntity, item))
                            {
                                // check merge options
                                if (!(mergeOption == MergeOption.PreserveChanges && existingRelatedEntity.ChangeTracker.OriginalValues.ContainsKey("EmployeeRole")))
                                {
                                    using (entity.ChangeTrackingPrevention())
                                    {
                                        entity.Employees.Replace(item, existingRelatedEntity);
                                    }

                                    using (existingRelatedEntity.ChangeTrackingPrevention())
                                    {
                                        existingRelatedEntity.EmployeeRole = entity;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region refresh existing entity based on merge options

            if (!ReferenceEquals(null, existingEntity) && !ReferenceEquals(existingEntity, entity))
            {
                if (EmployeeRoles.MergeOption == MergeOption.OverwriteChanges)
                {
                    Invoke(delegate
                    {
                        existingEntity.Refresh(entity, trackChanges: false);
                        existingEntity.AcceptChanges();
                    });
                }
                else if (EmployeeRoles.MergeOption == MergeOption.PreserveChanges)
                {
                    Invoke(delegate
                    {
                        existingEntity.Refresh(entity, trackChanges: false, preserveExistingChanges: true);
                    });
                }
            }

            #endregion

            return(existingEntity);
        }
コード例 #27
0
 private void AddToPlaylist(Playlist playlist, InsertMode insertMode)
 {
     if (playlist != null)
     {
         switch (insertMode)
         {
             case InsertMode.All:
                 this.AddAllToPlaylist(playlist);
                 break;
             default:
                 this.AddSelectedToPlaylist(playlist);
                 break;
         }
     }
 }
コード例 #28
0
        public override BulkInsertResult <string> InsertMany(IEnumerable <T> entities, InsertMode insertMode)
        {
            var insertResult = new BulkInsertResult <string>();

            foreach (var entity in entities)
            {
                // Create the document
                InsertOne(entity, insertMode);
                insertResult[entity.Id] = InsertResult.unknown;
            }
            return(insertResult);
        }
コード例 #29
0
        public void Insert(string cssSeletor, InsertMode mode)
        {
            // Retreive the target element used for the insertion.
            jQueryObject element = jQuery.Select(cssSeletor);
            if (element == null) throw GetInsertException(cssSeletor, "No such element exists");

            // Invoke the pre-method.
            OnBeforeInsert(element, mode);

            switch (mode)
            {
                case InsertMode.Replace:
                    // Perform the insertion.
                    Css.CopyClasses(element, Container);
                    Container.ReplaceAll(cssSeletor);
                    break;

                default: throw GetInsertException(cssSeletor, string.Format("The insert mode '{0}' is not supported.", mode.ToString()));
            }

            // Finish up.
            UpdateLayout();
            OnAfterInsert(mode);
        }
コード例 #30
0
 public override async Task <InsertResult> InsertOne(T entity, InsertMode insertMode)
 {
     throw new NotImplementedException();
 }
コード例 #31
0
        public override BulkInsertResult <string> InsertMany(IEnumerable <T> entities, InsertMode insertMode)
        {
            if (insertMode != InsertMode.db_implementation)
            {
                throw new NotImplementedException();
            }

            var insertResult = new BulkInsertResult <string>();

            var creationDate = NoSQLRepoHelper.DateTimeUtcNow();

            foreach (var entity in entities)
            {
                if (AutoGeneratedEntityDate)
                {
                    entity.SystemCreationDate = creationDate;
                }
                if (AutoGeneratedEntityDate)
                {
                    entity.SystemLastUpdateDate = creationDate;
                }

                NoSQLRepoHelper.SetIds(entity);

                var entityToStore = NewtonJsonHelper.CloneJson(entity, DateTimeZoneHandling.Utc);
                localDb[entity.Id] = entityToStore;
                config.ExpireAt(entity.Id, null);
                insertResult[entity.Id] = InsertResult.unknown;
            }
            SaveJSONFile();

            return(insertResult);
        }
コード例 #32
0
 private NewPlaylistUserControlViewModel CreateNewPlaylistModel(InsertMode insertMode)
 {
     var newPlaylistViewModel = new NewPlaylistUserControlViewModel(this.DataService, this.AccountService, this.ResourceService)
     {
         IsOpen = true,
         InsertMode = insertMode
     };
     newPlaylistViewModel.PlaylistInserted += this.OnNewPlaylistInserted;
     return newPlaylistViewModel;
 }
コード例 #33
0
        /// <summary>
        /// 生成图片的Html代码
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="path">路径</param>
        /// <param name="width">宽</param>
        /// <param name="widthUnit">宽单位</param>
        /// <param name="height">高</param>
        /// <param name="heightUnit">高单位</param>
        /// <param name="align">图片显示方式</param>
        /// <param name="border">边框</param>
        /// <param name="vspace"></param>
        /// <param name="hspace"></param>
        /// <param name="alt">说明文字</param>
        /// <param name="linkUrl">链接的URL</param>
        /// <param name="pic2Path">替换图片的路径</param>
        /// <param name="linkTarget">目标</param>
        /// <param name="linkTitle">标题</param>
        /// <param name="linkAccesskey">访问键</param>
        /// <returns></returns>
        public string ImageHtml(
            InsertMode insertMode,
            string name,
            string path,
            string width,
            string widthUnit,
            string height,
            string heightUnit,
            Align align,
            string border,
            string vspace,
            string hspace,
            string alt,
            string linkUrl,
            string pic2Path,
            string linkTarget,
            string linkTitle,
            string linkAccesskey,
            string mediaID
            )
        {
            string picMouseOut  = "";
            string picMouseOver = "";
            string picCode      = "";

            if (path == "")
            {
                return("");
            }

            //图片设置*/
            string imgHtml = "";

            switch (insertMode)
            {
            case InsertMode.File:
                imgHtml += "<img src=\"" + mediaID + "\"";
                break;

            case InsertMode.Id:
                imgHtml += "<img src=\"[src:" + path + "]\" ";
                break;
            }
            imgHtml += "style = \"WIDTH:" + width + widthUnit + "; HEIGHT:" + height + heightUnit + "\" ";
            imgHtml += "border=\"" + border + "\" vspace=\"" + vspace + "\" ";
            imgHtml += "hspace=\"" + hspace + "\" alt=\"" + alt + "\" ";
            imgHtml += "name=\"" + name + "\" align=\"" + align.ToString().ToLower() + "\" />";

            //链接设置*/
            string linkHtml = "";

            if (linkUrl != "" || pic2Path != "")
            {
                if (linkUrl != "")
                {
                    linkHtml  = "<a href=\"" + linkUrl + "\" ";
                    linkHtml += "target=\"" + linkTarget + "\" ";
                    linkHtml += "title=\"" + linkTitle + "\" ";
                    linkHtml += "accesskey=\"" + linkAccesskey + "\"";
                }
                else
                {
                    linkHtml = "<a href=\"#\"";
                }
                //图片替换
                if (pic2Path != "")
                {
                    picMouseOut  = " na_restore_img_src('" + name + "', 'document')";
                    linkHtml    += "OnMouseOut=\"" + picMouseOut + "\"";
                    picMouseOver = "na_change_img_src('" + name + "', 'document'," + pic2Path + ",true)";
                    linkHtml    += "OnMouseOver=\"" + picMouseOver + "\"";
                }

                linkHtml += ">";
                picCode   = linkHtml + imgHtml + @"</a>";
                return(picCode);
            }
            else
            {
                picCode = picCode = imgHtml;
                return(picCode);
            }
        }
コード例 #34
0
ファイル: TabPanelDesigner.cs プロジェクト: pgodwin/Ext.net
        private void AddTab(InsertMode mode)
        {
            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
            
            if (host != null)
            {
                PanelBase tab = (PanelBase)host.CreateComponent(typeof(PanelBase));

                if (tab != null)
                    {
                        //this.tabPanelControl.EnsureTabs();

                        IComponentChangeService changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));

                        try
                        {
                            changeService.OnComponentChanging(this.tabPanelControl, TypeDescriptor.GetProperties(this.tabPanelControl)["Tabs"]);
                            
                            switch(mode)
                            {
                                case InsertMode.Begin:
                                    this.tabPanelControl.Items.Insert(0,tab);
                                    break;
                                case InsertMode.End:
                                    this.tabPanelControl.Items.Add(tab);
                                    break;
                                case InsertMode.AfterActive:
                                    if (ActiveTabIndexIsValid)
                                    {
                                        this.tabPanelControl.Items.Insert(this.tabPanelControl.ActiveTabIndex+1, tab);
                                    }
                                    else
                                    {
                                        this.tabPanelControl.Items.Add(tab);
                                    }
                                    break;
                                default:
                                    throw new ArgumentOutOfRangeException("mode");
                            }
                        }
                        finally
                        {
                            changeService.OnComponentChanged(this.tabPanelControl, TypeDescriptor.GetProperties(this.tabPanelControl)["Tabs"], null, null);
                        }
                        PropertyDescriptor activeTab = TypeDescriptor.GetProperties(this.tabPanelControl)["ActiveTabIndex"];

                        int newActiveTab;

                        switch(mode)
                        {
                            case InsertMode.Begin:
                                newActiveTab = 0;
                                break;
                            case InsertMode.End:
                                newActiveTab = this.tabPanelControl.Items.Count - 1;
                                break;
                            case InsertMode.AfterActive:
                                if (ActiveTabIndexIsValid)
                                {
                                    newActiveTab = this.tabPanelControl.ActiveTabIndex + 1;
                                }
                                else
                                {
                                    newActiveTab = this.tabPanelControl.Items.Count - 1;
                                }
                                break;
                            default:
                                throw new ArgumentOutOfRangeException("mode");
                        }

                        activeTab.SetValue(this.tabPanelControl, newActiveTab);
                        this.tabPanelControl.ActiveTabIndex = newActiveTab;
                    }

                    this.UpdateDesignTimeHtml();
                
                this.Tag.SetDirty(true);
            }
        }
コード例 #35
0
ファイル: RecordListDialog.cs プロジェクト: jg-maon/gpe
 /// <summary>
 /// ページを開く
 /// </summary>
 /// <param name="insertMode">モード</param>
 private void _ChangedMode(InsertMode insertMode)
 {
     // コピーモードの時のみ表示
     m_copyBaseIdBox.Visible = m_copyBaseIdLabel.Visible = (InsertMode.COPY == insertMode);
 }
コード例 #36
0
        public void AddItem(AudioCore.MediaEntry item, InsertMode insertMode, int index)
        {
            item.TaskSource = AudioCore.MediaEntry.Source.Schedule;

            // B73 : 2014-10-20 Changed
            //            item.NextEligibility = DateTime.Now;
            //            if (PlaysNow(item) && item.Every == 0)
            //                item.NextEligibility = item.NextEligibility.Date.AddDays(1);

            DateTime n2;
            DateTime now = DateTime.Now;
            var startTime = new DateTime(now.Year, now.Month, now.Day) + new TimeSpan(item.StartTime.Ticks);

            if (item.Every != 0)
            {
                while (true)
                {
                    if (startTime > now)
                    {
                        n2 = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.TimeOfDay.Hours, startTime.TimeOfDay.Minutes, startTime.TimeOfDay.Seconds);
                        break;
                    }
                    startTime += new TimeSpan(0, item.Every, 0);
                }
            }
            else
            {
                n2 = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.TimeOfDay.Hours, startTime.TimeOfDay.Minutes, startTime.TimeOfDay.Seconds);
                if (n2 < now)
                    n2 += new TimeSpan(1, 0, 0, 0); // = startTime > DateTime.Now ? startTime : startTime.AddDays(1);
            }
            item.NextEligibility = n2;

            if (index == -1)
            {
                lock (_lockObject)
                    MediaEntries.Add(item);
            }
            else
            {
                try
                {
                    switch (insertMode)
                    {
                        case InsertMode.After:
                            lock (_lockObject)
                                MediaEntries.Insert(index + 1, item);
                            break;

                        case InsertMode.Before:
                            lock (_lockObject)
                                MediaEntries.Insert(index, item);
                            break;

                        case InsertMode.Replace:
                            lock (_lockObject)
                                MediaEntries[index] = item;
                            break;
                    }
                }
                catch (Exception ex)
                {
                    Log.WriteException(ex, "item:" + item.Name + " insertmode:" + insertMode + " index:" + index);
                }
            }
            SaveSchedule();
        }
コード例 #37
0
ファイル: InsertElement.cs プロジェクト: pwq1989/AddressMatch
 /// <summary>
 /// in the case that place_mode is OldPlace, level_mode must be ExactlyLevel. 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="level"></param>
 /// <param name="mode"></param>
 public InsertElement(string name, LEVEL level, InsertMode mode)
 {
     Name = name;
     Level = level;
     Mode = (UInt16)mode;
 }
コード例 #38
0
 /// <summary>Invoked immediately before the insertion occurs via the 'Insert' method.</summary>
 /// <param name="targetElement">The element being replaced.</param>
 /// <param name="mode">The strategy used for the insertion.</param>
 /// <remarks>Use this to extract any meta-data from the original element before it is removed from the DOM.</remarks>
 protected virtual void OnBeforeInsert(jQueryObject targetElement, InsertMode mode) { }
コード例 #39
0
 public override async Task <BulkInsertResult <string> > InsertMany(IEnumerable <T> entities, InsertMode insertMode)
 {
     throw new NotImplementedException();
 }
コード例 #40
0
 /// <summary>Invoked immediately after the insertion occurs via the 'Insert' method.</summary>
 /// <param name="mode">The strategy used for the insertion.</param>
 protected virtual void OnAfterInsert(InsertMode mode) { }
コード例 #41
0
        /// <summary>
        /// 生成音频的Html的代码
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="width">宽</param>
        /// <param name="height">高</param>
        /// <param name="vspace"></param>
        /// <param name="hspace"></param>
        /// <param name="title">标题</param>
        /// <param name="accessKey">访问键</param>
        /// <param name="tabIndex">索引</param>
        /// <param name="align">显示方式</param>
        /// <param name="quality">显示质量</param>
        /// <param name="isLoopPlay">循环播放</param>
        /// <param name="isAutoPlay">自动播放</param>
        /// <returns>返回字符串</returns>
        public string AudioHtml(
            InsertMode insertMode,
            string path,
            string width,
            string height,
            string vspace,
            string hspace,
            string title,
            string accessKey,
            string tabIndex,
            Align align,
            Quality quality,
            bool isLoopPlay,
            bool isAutoPlay,
            string scale,
            string mediaID
            )
        {
            string audioCode = "";
            string pathStr   = "";

            if (insertMode == InsertMode.Id)
            {
                pathStr = "${srs_" + mediaID + "}";
            }
            else
            {
                pathStr = path;
            }
            string strExtension = Path.GetExtension(path);

            switch (strExtension)
            {
            case ".mp3":
            {
                audioCode  = "<object style=\"WIDTH: " + width + "; HEIGHT: " + height + " \"";
                audioCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                audioCode += "classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\">";
                audioCode += "<param name=\"_ExtentX\" value=\"8599\" /> ";
                audioCode += "<param name=\"_ExtentY\" value=\"3916\" />";
                audioCode += "<param name=\"AUTOSTART\" value=\"" + pathStr + " />";
                audioCode += "<param name=\"SHUFFLE\" value=\"0\" />";
                audioCode += "<param name=\"PREFETCH\" value=\"0\" />";
                audioCode += "<param name=\"NOLABELS\" value=\"0\" />";
                audioCode += "<param name=\"SRC\" value=\"" + "${srs_" + mediaID + "}" + "\" />";
                audioCode += "<param name=\"CONTROLS\" value=\"StatusBar,ControlPanel\" />";
                audioCode += "<param name=\"CONSOLE\" value=\"RAPLAYER\" />";
                audioCode += "<param name=\"LOOP\" value=\"" + Convert.ToInt32(isLoopPlay) + "\" />";
                audioCode += "<param name=\"NUMLOOP\" value=\"0\" />";
                audioCode += "<param name=\"CENTER\" value=\"0\" />";
                audioCode += "<param name=\"MAINTAINASPECT\" value=\"0\" />";
                audioCode += "<param name=\"quality\" value=\"" + quality.ToString() + "\" />";
                audioCode += "<param name=\"SCALE\" value=\"" + scale + "\" />";

                audioCode += "<embed width=\"" + width + "\" height=\"" + height + "\" border=\"0\" showdisplay=\"0\" ";
                audioCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                audioCode += "quality=\"" + quality.ToString() + "\" ";
                audioCode += "SCALE=\"" + scale + "\" ";
                audioCode += "showcontrols=\"1\" autostart=\"" + Convert.ToInt32(isAutoPlay) + "\" autorewind=\"0\" playcount=\"0\" ";
                audioCode += "moviewindowheight=\"" + height + "\" moviewindowwidth=\"" + width + "\" ";
                audioCode += "filename=\"" + "${srs_" + mediaID + "}" + "\" />";

                audioCode += "</object>";
                return(audioCode);
            }

            case ".wma":
            {
                audioCode  = "<object style=\"WIDTH: " + width + "; HEIGHT: " + height + " \"";
                audioCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                audioCode += "type='application/x-oleobject\"'";        // height=\"115\" width=\"220\"";
                audioCode += "classid=\"CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\">";
                audioCode += "<param name=\"URL\" value=\"" + pathStr + "\" />";
                audioCode += "<param name=\"rate\" value=\"1\" />";
                audioCode += "<param name=\"balance\" value=\"0\" />";
                audioCode += "<param name=\"currentPosition\" value=\"0\" />";
                audioCode += "<param name=\"defaultFrame\" value=\"\" />";
                audioCode += "<param name=\"playCount\" value=\"100\" />";
                audioCode += "<param name=\"autoStart\" value=\"" + Convert.ToInt32(isAutoPlay) + "\" />";
                audioCode += "<param name=\"currentMarker\" value=\"0\" />";
                audioCode += "<param name=\"invokeURLs\" value=\"-1\" />";
                audioCode += "<param name=\"baseURL\" value=\"\" />";
                audioCode += "<param name=\"volume\" value=\"100\" />";
                audioCode += "<param name=\"mute\" value=\"0\" />";
                audioCode += "<param name=\"uiMode\" value=\"full\" />";
                audioCode += "<param name=\"stretchToFit\" value=\"0\" />";
                audioCode += "<param name=\"windowlessVideo\" value=\"0\" />";
                audioCode += "<param name=\"enabled\" value=\"-1\" />";
                audioCode += "<param name=\"enableContextMenu\" value=\"0\" />";
                audioCode += "<param name=\"fullScreen\" value=\"0\" />";
                audioCode += "<param name=\"SAMIStyle\" value=\"\" />";
                audioCode += "<param name=\"SAMILang\" value=\"\" />";
                audioCode += "<param name=\"SAMIFilename\" value=\"\" />";
                audioCode += "<param name=\"captioningID\" value=\"\" />";
                audioCode += "<param name=\"enableErrorDialogs\" value=\"0\" />";
                audioCode += "<param name=\"_cx\" value=\"5821\" />";
                audioCode += "<param name=\"_cy\" value=\"3043\" />";
                audioCode += "<param name=\"quality\" value=\"" + quality.ToString() + "\" />";
                audioCode += "<param name=\"SCALE\" value=\"" + scale + "\" />";


                audioCode += "<embed width=\"" + width + "\" height=\"" + height + "\" border=\"0\" showdisplay=\"0\" ";
                audioCode += "hspace=\"" + hspace + "\" vspace=\"" + vspace + "\" ";
                audioCode += "quality=\"" + quality.ToString() + "\" ";
                audioCode += "SCALE=\"" + scale + "\" ";
                audioCode += "showcontrols=\"1\" autostart=\"" + Convert.ToInt32(isAutoPlay) + "\" autorewind=\"0\" playcount=\"0\" ";
                audioCode += "moviewindowheight=\"" + height + "\" moviewindowwidth=\"" + width + "\" ";
                audioCode += "filename=\"" + pathStr + "\" />";

                audioCode += "</object>";

                return(audioCode);
            }

            default:
            {
                return("");
            }
            }
        }
コード例 #42
0
        private Person AttachWithRelations(Person entity, InsertMode insertMode = InsertMode.Attach, MergeOption mergeOption = MergeOption.AppendOnly, List <object> referenceTrackingList = null)
        {
            #region iteration tracking

            if (ReferenceEquals(null, referenceTrackingList))
            {
                referenceTrackingList = new List <object>();
            }

            if (referenceTrackingList.Contains(entity))
            {
                return(_people.GetExisting(entity));
            }
            else
            {
                referenceTrackingList.Add(entity);
            }

            #endregion

            #region add/attach entity

            Person existingEntity = null;

            switch (insertMode)
            {
            case InsertMode.Add:
                existingEntity = _people.Add(entity);
                break;

            case InsertMode.Attach:
                existingEntity = _people.Attach(entity);
                break;

            default:
                throw new Exception(string.Format("Implementation Exception: missing action for {0}", insertMode));
            }

            if (!ReferenceEquals(null, existingEntity) && ReferenceEquals(existingEntity, entity))
            {
                return(existingEntity);
            }

            #endregion

            #region attach relations recursively

            // register entity's property changed event if entity is new to context
            if (ReferenceEquals(null, existingEntity))
            {
                entity.PropertyChanged += On_person_propertyChanged;
            }

            // attach related entity to context
            if (!ReferenceEquals(null, entity.Address1))
            {
                var existingRelatedEntity = AttachWithRelations(entity.Address1, insertMode, mergeOption, referenceTrackingList);

                // update relation if entity is new to context or relation is new to entity
                if (ReferenceEquals(null, existingEntity) || !entity.Address1.Equals(existingEntity.Address1))
                {
                    if (!ReferenceEquals(null, existingRelatedEntity) && !ReferenceEquals(existingRelatedEntity, entity.Address1))
                    {
                        // check merge options
                        if (!(mergeOption == MergeOption.PreserveChanges && existingRelatedEntity.ChangeTracker.OriginalValues.ContainsKey("People")))
                        {
                            using (entity.ChangeTrackingPrevention())
                            {
                                entity.Address1 = existingRelatedEntity;
                            }

                            using (existingRelatedEntity.ChangeTrackingPrevention())
                            {
                                var entityToReplace = existingRelatedEntity.People.FirstOrDefault(e => e.Equals(entity));
                                if (!ReferenceEquals(null, entityToReplace))
                                {
                                    using (entityToReplace.ChangeTrackingPrevention())
                                    {
                                        existingRelatedEntity.People.Remove(entityToReplace);
                                    }
                                }

                                existingRelatedEntity.People.Add(entity);
                            }
                        }
                    }
                }
            }

            #endregion

            #region refresh existing entity based on merge options

            if (!ReferenceEquals(null, existingEntity) && !ReferenceEquals(existingEntity, entity))
            {
                if (People.MergeOption == MergeOption.OverwriteChanges)
                {
                    Invoke(delegate
                    {
                        existingEntity.Refresh(entity, trackChanges: false);
                        existingEntity.AcceptChanges();
                    });
                }
                else if (People.MergeOption == MergeOption.PreserveChanges)
                {
                    Invoke(delegate
                    {
                        existingEntity.Refresh(entity, trackChanges: false, preserveExistingChanges: true);
                    });
                }
            }

            #endregion

            return(existingEntity);
        }
コード例 #43
0
        public override InsertResult InsertOne(T entity, InsertMode insertMode)
        {
            var       insertResult          = default(InsertResult);
            bool      documentAlreadyExists = false;
            IDocument documentObjet         = null;

            var date = NoSQLRepoHelper.DateTimeUtcNow();
            IDictionary <string, object> properties;

            if (string.IsNullOrEmpty(entity.Id))
            {
                // No id specified, let CouchBaseLite generate the id and affect it to the entity
                documentObjet = database.CreateDocument();
                entity.Id     = cblGeneratedIdPrefix + documentObjet.Id; // NB: prefix the Id generated by CouchBaseLite to be able to distinguish it with a user provided id
            }
            else
            {
                // Get an existing document or return a new one if not exists
                documentObjet = database.GetDocument(GetInternalCBLId(entity.Id));

                if (documentObjet.CurrentRevisionId != null)
                {
                    // Document already exists
                    if (insertMode == InsertMode.error_if_key_exists)
                    {
                        throw new DupplicateKeyNoSQLException();
                    }
                    else if (insertMode == InsertMode.do_nothing_if_key_exists)
                    {
                        return(InsertResult.not_affected);
                    }

                    documentAlreadyExists = true;
                }
            }

            if (!documentAlreadyExists)
            {
                if (AutoGeneratedEntityDate)
                {
                    entity.SystemCreationDate   = date;
                    entity.SystemLastUpdateDate = date;
                }

                properties = new Dictionary <string, object>()
                {
                    { "creat date", date },
                    { "update date", date },
                    { "collection", this.CollectionName },
                    { "members", entity },
                    { "entityType", entity.GetType().Name } // Store the original actual object class to handle polymorphism
                };

                insertResult = InsertResult.inserted;
            }
            else
            {
                properties = documentObjet.Properties;

                entity.SystemCreationDate   = (DateTime)properties["creat date"];
                entity.SystemLastUpdateDate = date;

                properties["update date"] = entity.SystemLastUpdateDate;
                properties["members"]     = entity;

                insertResult = InsertResult.updated;
            }

            documentObjet.PutProperties(properties);

            return(insertResult);
        }
コード例 #44
0
 private void ChoosePlaylist(MenuItemViewModel menuItem, InsertMode insertMode)
 {
     MenuPlaylistViewModel menuPlaylistViewModel = menuItem as MenuPlaylistViewModel;
     if (menuPlaylistViewModel != null && menuPlaylistViewModel.Playlist != null)
     {
         AddToPlaylist(menuPlaylistViewModel.Playlist, insertMode);
     }
 }
コード例 #45
0
ファイル: InsertModeTest.cs プロジェクト: kri4er/VsVim
        protected void Create(bool insertMode, params string[] lines)
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _factory.DefaultValue = DefaultValue.Mock;
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vim = _factory.Create<IVim>(MockBehavior.Loose);
            _editorOptions = _factory.Create<IEditorOptions>(MockBehavior.Loose);
            _textChangeTracker = _factory.Create<ITextChangeTracker>(MockBehavior.Loose);
            _textChangeTracker.SetupGet(x => x.CurrentChange).Returns(FSharpOption<TextChange>.None);
            _undoRedoOperations = CreateUndoRedoOperations();
            _wordCompletionSessionFactoryService = _factory.Create<IWordCompletionSessionFactoryService>();

            var localSettings = new LocalSettings(Vim.GlobalSettings);
            _vimBuffer = Vim.CreateVimBuffer(_textView);
            _globalSettings = _vimBuffer.GlobalSettings;
            var vimTextBuffer = Vim.GetOrCreateVimTextBuffer(_textView.TextBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            _operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            _broker = _factory.Create<IDisplayWindowBroker>();
            _broker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _broker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
            _broker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _broker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);
            _insertUtil = _factory.Create<IInsertUtil>();
            _motionUtil = _factory.Create<IMotionUtil>();
            _commandUtil = _factory.Create<ICommandUtil>();
            _capture = _factory.Create<IMotionCapture>();

            // Setup the mouse.  By default we say it has no buttons down as that's the normal state
            _mouseDevice = _factory.Create<IMouseDevice>();
            _mouseDevice.SetupGet(x => x.IsLeftButtonPressed).Returns(false);

            // Setup the keyboard.  By default we don't say that any button is pressed.  Insert mode is usually
            // only concerned with arrow keys and we will set those up as appropriate for the typing tests
            _keyboardDevice = _factory.Create<IKeyboardDevice>();
            _keyboardDevice.Setup(x => x.IsArrowKeyDown).Returns(false);

            _modeRaw = new global::Vim.Modes.Insert.InsertMode(
                _vimBuffer,
                _operations,
                _broker.Object,
                _editorOptions.Object,
                _undoRedoOperations,
                _textChangeTracker.Object,
                _insertUtil.Object,
                _motionUtil.Object,
                _commandUtil.Object,
                _capture.Object,
                !insertMode,
                _keyboardDevice.Object,
                _mouseDevice.Object,
                WordUtil,
                _wordCompletionSessionFactoryService.Object);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
            _mode.CommandRan += (sender, e) => { _lastCommandRan = e.CommandRunData; };
        }
コード例 #46
0
 public abstract InsertResult InsertOne(T entity, InsertMode insertMode);