private void Create(params string[] lines) { _globalSettings = Vim.GlobalSettings; _vimBuffer = CreateVimBuffer(lines); _textView = (IWpfTextView)_vimBuffer.TextView; _textBuffer = _vimBuffer.TextBuffer; _commonOperationsRaw = (CommonOperations)CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData); _commonOperations = _commonOperationsRaw; }
private void frmCompanyConfig_Load(object sender, EventArgs e) { MyCom = new CommonOperations(Program.AccountStatic.LoggingAsLocal); Myaccount = new AccountCreation(Program.AccountStatic.LoggingAsLocal); panel1.Top = (this.Height - panel1.Height) / 2; panel1.Left = (this.Width - panel1.Width) / 2; Myaccount.LoadSupplier(dgvList); DataTable tb = MyCom.GetDataTableAccount("Select CurID from tblcurrency", "xx"); MyCom.LoadDatatoComboWithOutBind(txtCurrency, tb, "CurID", true); }
public void CreateLines(params string[] lines) { _view = Utils.EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _host = new Mock<IVimHost>(MockBehavior.Strict); _jumpList = new Mock<IJumpList>(MockBehavior.Strict); _editorOpts = new Mock<IEditorOperations>(MockBehavior.Strict); _operationsRaw = new OperationsImpl(_view, _editorOpts.Object, _host.Object, _jumpList.Object); _operations = _operationsRaw; }
private RoomFitTransform checkIfRoomFits(Coordinate baseTileWorldLocation, RoomDataHolder roomData, Orientation orientation) { // Try moving the room so that any occupied tile is positioned on baseTile TileData[] testTiles = roomData.occupiedTiles; while (testTiles.Length > 0) { TileData newRoomBaseTile = CommonOperations.getRandomItemFromList <TileData>(testTiles); bool collisionDetected = false; // Room may be rotated, transform coordinates accordingly Coordinate transformed_newRoomBaseTile = CommonOperations.getTransformedCoordinate(newRoomBaseTile.tileCoordinate, orientation); foreach (TileData roomOccupationTile in roomData.occupiedTiles) { // Room may be rotated, transform coordinates accordingly Coordinate transformed_roomOccupationTile = CommonOperations.getTransformedCoordinate(roomOccupationTile.tileCoordinate, orientation); // Get the coordinate of the tiles in the rotated and shifted room Coordinate checkCoordinate = baseTileWorldLocation + (transformed_roomOccupationTile - transformed_newRoomBaseTile); // Check if room can be placed on this tile if (!mansionDataHandler.canPlaceRoomOnTile(checkCoordinate)) { collisionDetected = true; break; } } // Check if all doors align with existing doors if (!collisionDetected && !checkIfDoorsAlign(baseTileWorldLocation, newRoomBaseTile.tileCoordinate, roomData, orientation)) { collisionDetected = true; } // No collisions with the transformation above. Use that transformation to later place the room! if (!collisionDetected) { return(new RoomFitTransform(-transformed_newRoomBaseTile, orientation)); } // Remove checked coordinate from list TileData[] newTestTiles = new TileData[testTiles.Length - 1]; int index = 0; for (int i = 0; i < testTiles.Length && index < newTestTiles.Length; ++i) { if (testTiles[i].tileCoordinate != newRoomBaseTile.tileCoordinate) { newTestTiles[index++] = testTiles[i]; } } testTiles = newTestTiles.Clone() as TileData[]; } // No transformation of this room fit on this return(null); }
private void frmAccountCreation_Load(object sender, EventArgs e) { MyCommon = new CommonOperations(Program.AccountStatic.LoggingAsLocal); MyAccount = new AccountCreation(Program.AccountStatic.LoggingAsLocal); panel1.Top = (this.Height - panel1.Height) / 2; panel1.Left = (this.Width - panel1.Width) / 2; InitializeScreen(); panel7.Enabled = false; panel8.Enabled = false; LoadExistingAccount(); LoadExtAccountInHiaraky(); }
private void frmInvoice_Load(object sender, EventArgs e) { MyCommon = new CommonOperations(Program.AccountStatic.LoggingAsLocal); // MyAccount = new AccountCreation(Program.AccountStatic.LoggingAsLocal); // MyInvoice = new Invoice(Program.AccountStatic.LoggingAsLocal); panel1.Top = (this.Height - panel1.Height) / 2; panel1.Left = (this.Width - panel1.Width) / 2; //MyAccount.LoadCustomer(cmbSupplier); //MyCommon.LoadStatusComboAccount(cmbStatus, 4); //LoadList(); }
public void Run() { Console.WriteLine("Welcome to the gesture creation"); Console.WriteLine("To initalize a gesture pattern, please press enter"); Console.ReadLine(); var data = GetData(); Console.WriteLine("Do you wish to keep this gesture?"); bool keep = CommonOperations.GetYesOrNo(); bool calibrated = false; bool tryAgain = false; if (keep) { var options = SetOptions(); var gesture = AnalyzeData(data, options); //here, we want to make the user repeat the action a few times to see how comfortable it is with the settings do { calibrated = CalibrateGesture(gesture, options); if (!calibrated) { Console.WriteLine("Would you wish to try calibrating again?"); tryAgain = CommonOperations.GetYesOrNo(); } else { //we have succeed calibration tryAgain = false; SetAction(gesture); SaveGesture(gesture); } } while (tryAgain); } //if the user wants to make a new gesture if (!keep && !calibrated && !tryAgain) { Console.WriteLine("Would you wish to still create a new gesture?"); //reusing variables ftw tryAgain = CommonOperations.GetYesOrNo(); if (tryAgain) { //recursive call... ok, it's pretty lazy I have to admit. Might be a problem this.Run(); } else { return; } } }
private void LoadData() { MyCommon = new CommonOperations(Program.AccountStatic.LoggingAsLocal); DataTable dt2 = new DataTable(); dt2 = MyCommon.GetDataTableAccount("select * from acknoladgement", "Get Ack"); if (dt2.Rows.Count > 0) { dataGridView1.DataSource = null; dataGridView1.DataSource = dt2; } }
private void rbt3Sfab_CheckedChanged(object sender, EventArgs e) { try { WrireConf("network"); Program.AccountStatic.LoggingAsLocal = false; MyUser = new UserHandling(Program.AccountStatic.LoggingAsLocal); MyGeneral = new CommonOperations(Program.AccountStatic.LoggingAsLocal); MyGeneral.LoadCompany(cmbCompanyName); } catch (Exception ex) { } }
public void addRoomTiles(RoomDataHolder roomData) { Coordinate roomPosition = roomData.getWorldPosition(); foreach (TileData tile in roomData.occupiedTiles) { Coordinate transformed_tile = CommonOperations.getTransformedCoordinate(tile.tileCoordinate, roomData.getOrientation()); Coordinate transformedCoordinate = roomPosition + transformed_tile; if (transformedCoordinate.x < 0 || transformedCoordinate.y < 0 || transformedCoordinate.z < 0) { return; } mansionData.occupiedTiles[transformedCoordinate.x, transformedCoordinate.y, transformedCoordinate.z] = new MansionTileInfo(roomData, tile); } }
public ActionResult GetPocketByDistrictId(string districtId) { districtId = Convert.ToString(JsonConvert.DeserializeObject <int>(districtId)); ServiceInputObject serviceObject = new ServiceInputObject { baseURL = ConfigSettings.WebApiBaseAddress, controllerName = "Pocket", methodName = "GetActivePocketsByDistrictId", parameterValue = districtId }; List <PocketInfoEntities> pocketIfo = ServiceMethods.GenerateGatRequest <List <PocketInfoEntities> >(serviceObject); List <SelectListItem> pocketList = CommonOperations.BindDropdwon <PocketInfoEntities>(pocketIfo, "PocketID", "PocketName"); return(Json(pocketList)); }
public ActionResult GetDistrictByStateId(string stateId) { stateId = Convert.ToString(JsonConvert.DeserializeObject <int>(stateId)); ServiceInputObject serviceObject = new ServiceInputObject { baseURL = ConfigSettings.WebApiBaseAddress, controllerName = "District", methodName = "GetDistrictOfState", parameterValue = stateId }; List <DistrictInfoEntities> districtInfo = ServiceMethods.GenerateGatRequest <List <DistrictInfoEntities> >(serviceObject); List <SelectListItem> districtList = CommonOperations.BindDropdwon <DistrictInfoEntities>(districtInfo, "DistID", "DistrictName"); return(Json(districtList)); }
UserCalibrationTask GetData(UserCalibrationTask.Calibrating currentlyCalibrating, int waitTime) { var task = new UserCalibrationTask(currentlyCalibrating); var manager = new MyomiTaskManager((1000 / 50), task); var taskThread = new Thread(manager.Run); Console.WriteLine("Starting new Manager task"); //we are giving the users 5 seconds to calibrate their arm motion taskThread.Start(); CommonOperations.Sleep(waitTime); manager.StopExecution = true; return(task); }
public ActionResult GetVillageBySubDistrictId(string subDistrictId) { subDistrictId = Convert.ToString(JsonConvert.DeserializeObject <int>(subDistrictId)); ServiceInputObject serviceObject = new ServiceInputObject { baseURL = ConfigSettings.WebApiBaseAddress, controllerName = "Village", methodName = "GetVillageListofSubDistrict", parameterValue = subDistrictId }; List <VillageInfoEntities> villageInfoEntities = ServiceMethods.GenerateGatRequest <List <VillageInfoEntities> >(serviceObject); List <SelectListItem> villageList = CommonOperations.BindDropdwon <VillageInfoEntities>(villageInfoEntities, "VillageID", "VILLAGE"); return(Json(villageList)); }
private void frmBill_Load(object sender, EventArgs e) { MyBill = new Billing(Program.AccountStatic.LoggingAsLocal); MyCommon = new CommonOperations(Program.AccountStatic.LoggingAsLocal); MyAccount = new AccountCreation(Program.AccountStatic.LoggingAsLocal); panel1.Top = (this.Height - panel1.Height) / 2; panel1.Left = (this.Width - panel1.Width) / 2; //MyAccount.LoadSupplier(cmbSupplier); //MyAccount.LoadSupplier(cmbSearchSupplier); //Edit by manjula *** Load suppliers from MRP LoadSuppliers(); MyCommon.LoadStatusComboAccount(cmbStatus, 4); EditScreen(false); }
public ActionResult GetDistrictsOfPocket(string pocketId) { pocketId = Convert.ToString(JsonConvert.DeserializeObject <int>(pocketId)); ServiceInputObject serviceInputsForDocType = new ServiceInputObject { baseURL = ConfigSettings.WebApiBaseAddress, controllerName = "Pocket", methodName = "GetPocketDetail", parameterValue = pocketId }; PocketInfoEntities pocketDetail = new PocketInfoEntities(); pocketDetail = ServiceMethods.GenerateGatRequest <PocketInfoEntities>(serviceInputsForDocType); List <SelectListItem> Districts = CommonOperations.BindDropdwon <DistrictInfoEntities>(pocketDetail.districts, "DistID", "DistrictName"); return(Json(Districts)); }
private void frmPaymentVoucher_Load(object sender, EventArgs e) { try { MyAccount = new AccountCreation(Program.AccountStatic.LoggingAsLocal); MyCommon = new CommonOperations(Program.AccountStatic.LoggingAsLocal); MyPay = new Payment(Program.AccountStatic.LoggingAsLocal); panel4.Top = (this.Height - panel4.Height) / 2; panel4.Left = (this.Width - panel4.Width) / 2; LoadToCombo(); EnableCurrent(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private bool checkIfDoorAgainstWall(TileData targetTileData, Orientation roomOrientation, Orientation wallDirection) { if (targetTileData == null) { return(false); } bool foundDoor = false; foreach (DoorData door in targetTileData.doors) { if (CommonOperations.getTransformedOrientation(door.wallDirection, roomOrientation) == wallDirection) { foundDoor = true; } } return(foundDoor); }
public void Run() { CommonOperations.Sleep(2000); while (!_complete) { Console.Clear(); Console.WriteLine("Starting calibration of user movements"); _complete = true; _complete &= GetArm(); _complete &= GetFastAccel(); _complete &= GetSlowAccel(); _complete &= GetFastGyro(); _complete &= GetSlowGyro(); _complete &= AnalyzeResults(); } }
private void frmJournal_Load(object sender, EventArgs e) { MyAccount = new AccountCreation(Program.AccountStatic.LoggingAsLocal); MyCommon = new CommonOperations(Program.AccountStatic.LoggingAsLocal); MyJournal = new Journal(Program.AccountStatic.LoggingAsLocal); IsLocalLoging = Program.AccountStatic.LoggingAsLocal; panel1.Top = (this.Height - panel1.Height) / 2; panel1.Left = (this.Width - panel1.Width) / 2; MyCommon.LoadCurrency(cmbCurrency); MyCommon.LoadStatusComboAccount(cmbPayFor, 6); string HmCur = "", HmRate = ""; string respond = MyCommon.GetHomeCurrencyAndExrate(out HmCur, out HmRate); cmbCurrency.Text = HmCur; MyCommon.LoadStatusComboAccount(cmbStatus, 4); }
public ActionResult GetPocketInitialValues() { ServiceInputObject serviceObject = new ServiceInputObject { baseURL = ConfigSettings.WebApiBaseAddress, controllerName = "Pocket", methodName = "GetPocketPageUIvalues" }; PocketPageUIvalues pageUiValues = ServiceMethods.GenerateGatRequest <PocketPageUIvalues>(serviceObject); PocketDropdownValueForAddPage dropdownValue = new PocketDropdownValueForAddPage(); dropdownValue.states = CommonOperations.BindDropdwon <StateInfoEntities>(pageUiValues.states, "StateID", "StateName"); dropdownValue.crops = CommonOperations.BindDropdwon <CropInfoEntities>(pageUiValues.crops, "CropID", "CropName"); dropdownValue.fertilizers = CommonOperations.BindDropdwon <FertilizerInfoEntities>(pageUiValues.fertilizers, "Id", "Fertilizer"); dropdownValue.pocketStatusList = CommonOperations.BindDropdwon <PocketStatusEntities>(pageUiValues.pocketStatusList, "Id", "PocketStatus"); return(Json(dropdownValue)); }
public ActionResult GetPageUIvaluesForPocket(string pocketId) { pocketId = Convert.ToString(JsonConvert.DeserializeObject <int>(pocketId)); ServiceInputObject serviceInputObject = new ServiceInputObject { baseURL = ConfigSettings.WebApiBaseAddress, controllerName = "FarmerDetail", methodName = "GetPocketMappingData", parameterValue = pocketId }; FarmerDetailPageUIvalues pageUIvalues = ServiceMethods.GenerateGatRequest <FarmerDetailPageUIvalues>(serviceInputObject); PocketDropdownValueForAddPage dropdownValue = new PocketDropdownValueForAddPage(); dropdownValue.crops = CommonOperations.BindDropdwon <CropInfoEntities>(pageUIvalues.CropList, "CropID", "CropName"); dropdownValue.villages = CommonOperations.BindDropdwon <VillageInfoEntities>(pageUIvalues.villageList, "VillageID", "VILLAGE"); return(Json(dropdownValue)); }
public void CommonOperations_LineAndArrowGenerator_ReturnCorrectDataForArrowCatchesSomeInvalidInput() { ICommonOperations common = new CommonOperations(); /* * 5 |\ |\/ 0---1 \ |\4 6 \ 3---2 / |/ \ 7 \ \ 4 = (-5, 0) \ 5 = (5, 10) \ */ //Num divisions sent in as 0, which will be corrected to 2 var result = common.LineAndArrowVertexAndIndicesGenerator(Vector2.Zero, new Vector2(10.0f, 0.0f), 10.0f, true, true, 0, true, 5.0f, 20.0f); var verts = result.Item1; var indices = result.Item2; Assert.Equal(8, verts.Length); var topLeftCornerOfArrow = verts[5]; Assert.Equal(5.0f, topLeftCornerOfArrow.X, 5); Assert.Equal(10.0f, topLeftCornerOfArrow.Y, 5); var OnlyVertexOnTheCurvedEndThatHappensToLieInTheMiddleY = verts[4]; Assert.Equal(-5.0f, OnlyVertexOnTheCurvedEndThatHappensToLieInTheMiddleY.X, 5); Assert.Equal(0.0f, OnlyVertexOnTheCurvedEndThatHappensToLieInTheMiddleY.Y, 5); Assert.Equal(12, indices.Length); //Ensuring the index buffer indexes the vertex on the curve end at the expected time Assert.Equal(4, indices[8]); }
private RoomFitTransform checkIfRoomFits(Coordinate baseTile, RoomDataHolder roomData) { RoomFitTransform resultingTransformation = null; // Test each orientation in a random order Orientation[] checkableOrientations = { Orientation.NORTH, Orientation.EAST, Orientation.SOUTH, Orientation.WEST }; while (checkableOrientations.Length > 0) { // Test random orientation Orientation orientationToCheck = CommonOperations.getRandomItemFromList <Orientation>(checkableOrientations); // Null if it didn't fit with the orientation, otherwise success! resultingTransformation = checkIfRoomFits(baseTile, roomData, orientationToCheck); if (resultingTransformation != null) { break; } // Remove checked orientation from list Orientation[] newCheckableOrientations = new Orientation[checkableOrientations.Length - 1]; int index = 0; for (int i = 0; i < checkableOrientations.Length && index < newCheckableOrientations.Length; ++i) { if (checkableOrientations[i] != orientationToCheck) { newCheckableOrientations[index++] = checkableOrientations[i]; } } checkableOrientations = newCheckableOrientations.Clone() as Orientation[]; // No orientation could fit the tile if (checkableOrientations.Length == 0) { break; } } // Pass any result to the caller! return(resultingTransformation); }
public ActionResult AddFarmerDetail() { FarmerDetailModel farmerDetailModel = new FarmerDetailModel(); farmerDetailModel.farmerDetail = new FarmerDetailEntities(); FarmerDetailPageUIvalues pageUIValues = GetPageUIvalues(); farmerDetailModel.crops = CommonOperations.BindDropdwon <CropInfoEntities>(pageUIValues.CropList, "CropID", "CropName"); farmerDetailModel.farmerTypes = CommonOperations.BindDropdwon <FarmerTypeEntities>(pageUIValues.FarmerTypeList, "id", "farmerType"); farmerDetailModel.countryCodes = CommonOperations.GetCountryCodes(); farmerDetailModel.DealerList = CommonOperations.BindDropdwon <DealerDetailEntities>(pageUIValues.DealerList, "id", "dealerName"); farmerDetailModel.pocketList = CommonOperations.BindDropdwon <PocketInfoEntities>(pageUIValues.PocketList, "PocketID", "PocketName"); farmerDetailModel.irrigationSourceList = CommonOperations.BindDropdwon <IrrigationSourceEntities>(pageUIValues.irrigationSourceList, "Id", "SourceName").ToList(); farmerDetailModel.farmerDetail.farmerLandMappingList.Add(new FarmerLandMappingEntities()); farmerDetailModel.farmerDetail.farmerConsumptionMappingList.Add(new FarmerConsumptionMappingEntities()); farmerDetailModel.farmerDetail.farmerCropMappingList.Add(new FarmerCropMappingEntities()); farmerDetailModel.farmerDetail.farmerPestiesMappingList.Add(new FarmerPesticesMappingEntities()); farmerDetailModel.farmerDetail.inputSoruceList.Add(new FarmerInputSourceMappingEntities()); farmerDetailModel.Action = ActionTypeEnum.Insert; return(View("AddFarmerDetail", farmerDetailModel)); }
public void CommonOperations_RegularPolyGenerator_ReturnCorrectData() { ICommonOperations common = new CommonOperations(); /* * 1 * / | \ * / | \ * 4 --0-- 2 \ | / \ | / \ 3 \ \ 3= (-5, 0) \ 2= (0, -5) \ */ var result = common.RegularPolygonVertexAndIndicesGenerator(Vector2.Zero, 4, 5.0f); var verts = result.Item1; var indices = result.Item2; Assert.Equal(5, verts.Length); var left = verts[4]; Assert.Equal(-5.0f, left.X, 5); Assert.Equal(0.0f, left.Y, 5); var bottom = verts[3]; Assert.Equal(0.0f, bottom.X, 5); Assert.Equal(-5.0f, bottom.Y, 5); Assert.Equal(12, indices.Length); Assert.Equal(1, indices[11]); Assert.Equal(3, indices[5]); }
public GameObject getNextFittingRoom(Coordinate baseTile) { RoomDataHolder checkRoom = mansionDataHandler.getRoomDataOnCoordinate(new Coordinate(0, 0, 1)); //List<UnityEngine.Object> roomPrefabs = getAllRoomPrefabs(); GameObject[] checkableSpawnableRooms = spawnableRooms; while (checkableSpawnableRooms.Length > 0) { GameObject roomObject = CommonOperations.getRandomItemFromList <GameObject>(checkableSpawnableRooms); RoomDataHolder roomData = roomObject.GetComponent(typeof(RoomDataHolder)) as RoomDataHolder; if (roomData != null) { RoomFitTransform roomFitTransform = checkIfRoomFits(baseTile, roomData); if (roomFitTransform != null) { roomData.setWorldPosition(baseTile + roomFitTransform.baseLocation); roomData.setOrientation(roomFitTransform.orientation); RoomDataHolder roomData2 = roomObject.GetComponent(typeof(RoomDataHolder)) as RoomDataHolder; return(roomObject); } } // Remove checked GameObject from list GameObject[] newCheckableSpawnableRooms = new GameObject[checkableSpawnableRooms.Length - 1]; int index = 0; for (int i = 0; i < checkableSpawnableRooms.Length && index < newCheckableSpawnableRooms.Length; ++i) { if (checkableSpawnableRooms[i] != roomObject) { newCheckableSpawnableRooms[index++] = checkableSpawnableRooms[i]; } } checkableSpawnableRooms = newCheckableSpawnableRooms.Clone() as GameObject[]; } return(null); }
public async Task <ActionResult <CartItem> > PutCartItem(long id, CartItem cart) { if (id != cart.CartId) { return(BadRequest()); } // Validate user var userId = cart.UserId; var userName = cart.UserName; var password = cart.Password; // If validation fails, return bad request if (!CommonOperations.ValidateUser(userId, userName, password)) { return(BadRequest()); } _context.Entry(cart).State = EntityState.Modified; await _context.SaveChangesAsync(); return(await _context.CartItems.FindAsync(id));; }
public async Task <ActionResult <DeliveryItem> > PostDeliveryItem(DeliveryItem delivery) { if (delivery == null) { throw new System.ArgumentNullException(nameof(delivery)); } else if (delivery.OrderItems == null) { throw new System.ArgumentNullException(nameof(delivery.OrderItems)); } // Retrieving all orders from delivery ICollection <OrderItem> orders = await CommonOperations.ExtractOrders(delivery, _context); delivery.OrderItems = orders; delivery.Status = "created"; _context.DeliveryItems.Add(delivery); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetDeliveryItem), new { id = delivery.DeliveryId }, delivery)); }
public void Run() { int decision = -1; while (decision != 0) { Console.WriteLine("Welcome to profile management, currently selected profile is {0}", this._profile.Name); Console.WriteLine("Please select one of the options below or type 0 to quit"); Console.WriteLine("Type '1' to change the settings of the profile"); Console.WriteLine("Type '2' to change the name of the profile"); Console.WriteLine("Type '0' to exit"); var optionString = Console.ReadLine(); decision = CommonOperations.GetOptionValue(optionString, 1, 2); if (decision == -1) { Console.WriteLine("The input was not valid"); } else { DecisionLadder(decision); } } }
public int GetPoint(OrientationProfileData profile, MyomiGestureOptions options) { if (!options.OrienEnabled) { return(CalculatePoint(Result.NotAnalyzed)); } if (options.OrienHalfMode) { Data.Pitch = CommonOperations.GetHalfModeValue(Data.Pitch); Data.Roll = CommonOperations.GetHalfModeValue(Data.Roll); Data.Azimuth = CommonOperations.GetHalfModeValue(Data.Azimuth); } int points = 0; var result = Analyze(profile.Pitch, Data.Pitch); points += CalculatePoint(result); result = Analyze(profile.Roll, Data.Roll); points += CalculatePoint(result); result = Analyze(profile.Azimuth, Data.Azimuth); points += CalculatePoint(result); return(points); }
public void TearDown() { _operations = null; _operationsRaw = null; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _vimData = new VimData(); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOptions = _factory.Create<IEditorOptions>(); _editorOptions.Setup(x => x.GetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId)).Returns(true); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorTabSettings).Returns(false); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _settings.SetupGet(x => x.AutoIndent).Returns(false); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _settings.SetupGet(x => x.ExpandTab).Returns(true); _settings.SetupGet(x => x.TabStop).Returns(4); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _statusUtil = _factory.Create<IStatusUtil>(); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _undoRedoOperations.Setup(x => x.CreateUndoTransaction(It.IsAny<string>())).Returns<string>(name => new UndoTransaction(FSharpOption.Create(EditorUtil.GetUndoHistory(_textView.TextBuffer).CreateTransaction(name)))); _smartIndent = _factory.Create<ISmartIndentationService>(); _searchService = new SearchService(EditorUtil.FactoryService.TextSearchService, _globalSettings.Object); var data = new OperationsData( vimData: _vimData, vimHost: _host.Object, editorOperations: _editorOperations.Object, textView: _textView, outliningManager: FSharpOption.Create(_outlining.Object), jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations.Object, registerMap: _registerMap, editorOptions: _editorOptions.Object, keyMap: null, navigator: null, statusUtil: _statusUtil.Object, foldManager: null, searchService: _searchService, smartIndentationService: _smartIndent.Object); _operationsRaw = new CommonOperations(data); _operations = _operationsRaw; }
public static void testTeardown() { CommonOperations.TestTeardown(); }
public void Create(params string[] lines) { _view = EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOpts = _factory.Create<IEditorOperations>(); _settings = _factory.Create<IVimLocalSettings>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); var data = new OperationsData( vimHost: _host.Object, editorOperations: _editorOpts.Object, textView: _view, outliningManager: _outlining.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations.Object, editorOptions: null, keyMap: null, navigator: null, statusUtil: null, foldManager: null); _operationsRaw = new OperationsImpl(data); _operations = _operationsRaw; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _vimData = new VimData(); _editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(_textView); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorTabSettings).Returns(false); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _settings.SetupGet(x => x.AutoIndent).Returns(false); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _settings.SetupGet(x => x.ExpandTab).Returns(true); _settings.SetupGet(x => x.TabStop).Returns(4); _outlining = _factory.Create<IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>())) .Returns<IEnumerable<ICollapsible>>(null); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _statusUtil = _factory.Create<IStatusUtil>(); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var data = new OperationsData( vimData: _vimData, vimHost: _host.Object, editorOperations: _editorOperations.Object, textView: _textView, outliningManager: FSharpOption.Create(_outlining.Object), jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations, registerMap: _registerMap, editorOptions: _editorOptions, keyMap: null, navigator: null, statusUtil: _statusUtil.Object, foldManager: null, searchService: _searchService); _operationsRaw = new CommonOperations(data); _operations = _operationsRaw; }
public void Create(params string[] lines) { _textView = CreateTextView(lines); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _foldManager = FoldManagerFactory.GetFoldManager(_textView); _factory = new MockRepository(MockBehavior.Strict); // Create the Vim instance with our Mock'd services _vimData = new VimData(); var registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _vimHost = _factory.Create<IVimHost>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.IsVirtualEditOneMore).Returns(false); _globalSettings.SetupGet(x => x.SelectionKind).Returns(SelectionKind.Inclusive); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorSettings).Returns(false); _globalSettings.SetupGet(x => x.VirtualEdit).Returns(String.Empty); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _searchService = new SearchService(TextSearchService, _globalSettings.Object); var vim = MockObjectFactory.CreateVim( registerMap: registerMap, host: _vimHost.Object, settings: _globalSettings.Object, searchService: _searchService, factory: _factory); // Create the IVimTextBuffer instance with our Mock'd services _localSettings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _localSettings.SetupGet(x => x.AutoIndent).Returns(false); _localSettings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _localSettings.SetupGet(x => x.ExpandTab).Returns(true); _localSettings.SetupGet(x => x.TabStop).Returns(4); _vimTextBuffer = MockObjectFactory.CreateVimTextBuffer( _textBuffer, localSettings: _localSettings.Object, vim: vim.Object, factory: _factory); // Create the VimBufferData instance with our Mock'd services _jumpList = _factory.Create<IJumpList>(); _statusUtil = _factory.Create<IStatusUtil>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var vimBufferData = CreateVimBufferData( _vimTextBuffer.Object, _textView, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, undoRedoOperations: _undoRedoOperations); _smartIndentationService = _factory.Create<ISmartIndentationService>(); _outlining = _factory.Create<IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>())) .Returns<IEnumerable<ICollapsible>>(null); _operationsRaw = new CommonOperations( vimBufferData, EditorOperationsFactoryService.GetEditorOperations(_textView), FSharpOption.Create(_outlining.Object), _smartIndentationService.Object); _operations = _operationsRaw; }
private void Create(params string[] lines) { _textView = CreateTextView(lines); _factory = new MockRepository(MockBehavior.Strict); _vimHost = _factory.Create<IVimHost>(); var registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _keyMap = _factory.Create<IKeyMap>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); // Initialize the Mock<IVim> with all of our Mock'd services var vim = MockObjectFactory.CreateVim( registerMap: registerMap.Object, host: _vimHost.Object, keyMap: _keyMap.Object, searchService: _searchService, settings: _globalSettings.Object, vimData: new VimData()); _localSettings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _vimTextBuffer = MockObjectFactory.CreateVimTextBuffer( _textView.TextBuffer, localSettings: _localSettings.Object, vim: vim.Object, factory: _factory); // Initialize the VimBufferData with all of our Mock'd services _jumpList = _factory.Create<IJumpList>(); _statusUtil = _factory.Create<IStatusUtil>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var vimBufferData = CreateVimBufferData( _vimTextBuffer.Object, _textView, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, undoRedoOperations: _undoRedoOperations); _outlining = _factory.Create<IOutliningManager>(); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); var commonOperations = new CommonOperations( vimBufferData, _editorOperations.Object, FSharpOption.Create(_outlining.Object)); _operationsRaw = new DefaultOperations( vimBufferData, commonOperations); _operations = _operationsRaw; }
public void Create(params string[] lines) { _view = Utils.EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _factory = new MockFactory(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOpts = _factory.Create<IEditorOperations>(); _settings = _factory.Create<IVimLocalSettings>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _operationsRaw = new OperationsImpl(_view, _editorOpts.Object, _outlining.Object, _host.Object, _jumpList.Object,_settings.Object, _undoRedoOperations.Object); _operations = _operationsRaw; }