void fillVars() { UIController = LifetimeService.Instance.Container.Resolve<IUIController>(); ds = UIController.GetActiveDocument(); if (ds == null) { canExecute = false; return; } Variables = new ObservableCollection<DataSourceVariable>(ds.Variables); source.ItemsSource = ds.Variables; //source.Items.Add("AA"); //source.Items.Add("BB"); //source.Items.Add("CC"); //source.Items.Add("DD"); //source.Items.Add("EE"); //source.Items.Add("FF"); //source.Items.Add("GG"); //source.Items.Add("HH"); //source.Items.Add("II"); //source.Items.Add("JJ"); //source.Items.Add("KK"); //source.Items.Add("LL"); //source.Items.Add("MM"); //source.Items.Add("NN"); //source.Items.Add("OO"); ////////////// Function catagory ///////// funcat.Items.Add("All"); funcat.Items.Add("Arithmetic"); funcat.Items.Add("CDF & Noncentral CDF"); funcat.Items.Add("Conversion"); funcat.Items.Add("Current Date/Time"); funcat.Items.Add("Date Arithmetic"); funcat.Items.Add("Date Creation"); }
public MainWindow() { InitializeComponent(); var ds = new DataSource(); if (ds != null) { LayoutPanel panel = new LayoutPanel() { Caption = "Live Report", AllowClose = false }; AccountDataSheet sheet = new AccountDataSheet() { DataContext = ds }; panel.Content = sheet; documents.Add(panel); panel.IsActive = true; } var bds = new BenchMarkDataSource(); if (bds != null) { LayoutPanel panel = new LayoutPanel() { Caption = "BenchMark Report", AllowClose = false }; BenchMarkDataSheet sheet = new BenchMarkDataSheet() { DataContext = bds }; panel.Content = sheet; documents.Add(panel); panel = new LayoutPanel() { Caption = "Report", AllowClose = false }; NewReportDataSheet Nsheet = new NewReportDataSheet() { DataContext = bds }; panel.Content = Nsheet; documents.Add(panel); panel.IsActive = true; } }
/// <summary> /// Get list of DBs which can be accessed by worker /// </summary> public static List<WorkerDb> LoadDatabases(DataSource source) { List<WorkerDb> result = new List<WorkerDb>(); var csBuilder = new SqlConnectionStringBuilder(); csBuilder.DataSource = source.Address; csBuilder.UserID = source.Username; csBuilder.Password = source.Password; var conn = new SqlConnection(csBuilder.ConnectionString); var cmd = new SqlCommand(GetSuitableDatabases, conn); cmd.Parameters.AddWithValue("@pattern", source.SearchPattern); conn.Open(); var reader = cmd.ExecuteReader(); while (reader.Read()) { var name = reader.GetString(0); var id = Regex .Replace(name, source.NameRegex, string.Empty) .ToLower(); var db = new WorkerDb(); db.Id = id; csBuilder.InitialCatalog = name; db.ConnectionString = csBuilder.ConnectionString; result.Add(db); } conn.Close(); return result; }
public DataSource UpdateDataSource(DataSource dataSource, string accountId) { var ds = Mapper.Map<DataSource, DynamoDb.DataSource>(dataSource); ds.AccountId = accountId; this.Context.Save(ds); return dataSource; }
public override void ViewDidLoad () { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. //NavigationItem.LeftBarButtonItem = EditButtonItem; // var addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add, AddNewItem); // NavigationItem.RightBarButtonItem = addButton; MainSearchBar.SearchButtonClicked += (object sender, EventArgs e) => { _kunden = BusinessLayer.Kunde.GetKunden(MainSearchBar.Text,ref AppDelegate._user , false); dataSource.SetSource(_kunden); // TableView.Source = new SpeakersTableSource (_kunden); TableView.ReloadData(); }; //TODO: Step 1a: uncomment to set SpeakersTableSource as the TableView Source dataSource = new DataSource (this); TableView.Source = dataSource; //TableView.Source = dataSource ; }
public SqlQueue(Uri uri, IScriptProvider scriptProvider, IDatabaseConnectionFactory databaseConnectionFactory, IDatabaseGateway databaseGateway) { Guard.AgainstNull(uri, "uri"); Guard.AgainstNull(scriptProvider, "scriptProvider"); Guard.AgainstNull(databaseConnectionFactory, "databaseConnectionFactory"); Guard.AgainstNull(databaseGateway, "databaseGateway"); _scriptProvider = scriptProvider; _databaseConnectionFactory = databaseConnectionFactory; _databaseGateway = databaseGateway; _log = Log.For(this); Uri = uri; parser = new SqlUriParser(uri); _dataSource = new DataSource(parser.ConnectionName, new SqlDbDataParameterFactory()); _tableName = parser.TableName; BuildQueries(); }
public async static Task initializeRoutes() { //var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"routeconfig.txt"); Assembly assem = typeof(API).GetTypeInfo().Assembly; var names = assem.GetManifestResourceNames(); var stream = assem.GetManifestResourceStream("NextBusParser.routeconfig.txt"); StreamReader reader = new StreamReader(stream); string routedata = await reader.ReadToEndAsync(); DataSource ds = JsonConvert.DeserializeObject<DataSource>(routedata); _ds = ds; reader.Dispose(); foreach (Route r in ds.Routes) { foreach (Direction d in r.Directions) { for (int i = 0; i < d.Stops.Count; i++) { Stop s = d.Stops[i]; s = r.Stops.Where(e => e.Tag.Equals(s.Tag)).First(); d.Stops[i] = s; } } } _isInitialized = true; }
public void DataSourceConventions(DataSource<string> sut, int expectedCount) { var collection = sut.Data.ToList(); collection.Count.ShouldBe(expectedCount); collection.Count.ShouldBe(sut.Data.Distinct().ToList().Count); collection.ForEach(item => item.ShouldNotBeNullOrEmpty()); }
public static Attempt GetAttempt(string id, int attemptN, DataSource source) { using(var repo = new AttemptRepository()) { var attempt = repo.Attempts.Where(att => att.ID == id && att.AttemptNumber == attemptN && att.Source == source); return attempt.Single(); } }
private void DefineDatabaseConnectionMenuItem_OnClick(object sender, RoutedEventArgs e) { // Build the data source, hard-coded to SQL Server DataSource sqlDataSource = new DataSource("MicrosoftSqlServer", "Microsoft SQL Server"); sqlDataSource.Providers.Add(DataProvider.SqlDataProvider); // Construct the data connection dialog, add the SQL Server data source, and set to default DataConnectionDialog dbConnectionDialog = new DataConnectionDialog(); dbConnectionDialog.DataSources.Add(sqlDataSource); dbConnectionDialog.SelectedDataProvider = DataProvider.SqlDataProvider; dbConnectionDialog.SelectedDataSource = sqlDataSource; // When user clicks OK, grab the connection string and parse through it if (DataConnectionDialog.Show(dbConnectionDialog) == System.Windows.Forms.DialogResult.OK) { if (_simInstanceDirector.IsConnectionStringValid(dbConnectionDialog.ConnectionString)) { // Save off the validated connection string for future use on restart Settings.Default.ExperimentDbConnectionString = _simInstanceDirector.GetEntityFormatConnectionString(dbConnectionDialog.ConnectionString); Settings.Default.Save(); // Enable the database experiment selection option LoadDatabaseExperimentConfigurationMenuItem.IsEnabled = true; } else { MessageBox.Show("Couldn't connect to the database using the provided connection information.", "Error Connecting to Data Source", MessageBoxButton.OK, MessageBoxImage.Exclamation); // Reset the database experiment selection option LoadDatabaseExperimentConfigurationMenuItem.IsEnabled = false; } } }
public async override void ViewDidLoad () { base.ViewDidLoad (); var query = ParseObject.GetQuery("Item") .WhereEqualTo("PurchaserName", PersonDetailViewController.Instance.CurrentPerson.ID); IEnumerable<ParseObject> results = await query.FindAsync(); ParseObj = results.ToList (); foreach (ParseObject po in ParseObj) { string Desc = po.Get<string> ("Description"); string Value = po.Get<string> ("Value"); bool Available = po.Get<Boolean> ("Available"); PurchasedItems.Add (new Items { Description = Desc, Value = Value, Available = Available }); } this.NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(UIBarButtonSystemItem.Add, (sender,args) => { // button was clicked }) , true); TableView.Source = dataSource = new DataSource(this, PurchasedItems); TableView.ReloadData (); this.Title = "Total=> "; }
public HeaderRecord(DataSource source, ThreeLetterCode code, string text, string value) : base(RecordType.H, text) { DataSource = source; ThreeLetterCode = code; Value = value ?? string.Empty; }
public MobileScrollView(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator) : base(viewContext, initializer) { this.urlGenerator = urlGenerator; Items = new List<MobileScrollViewItem>(); BounceVelocityThreshold = 1.6; Duration = 300; PageSize = 1; VelocityThreshold = 0.8; EnablePager = true; AutoBind = true; ItemsPerPage = 1; DataSource = new DataSource() { Type = DataSourceType.Ajax, ServerAggregates = true, ServerFiltering = true, ServerGrouping = true, ServerPaging = true, ServerSorting = true }; //>> Initialization //<< Initialization }
public void Should_be_able_prepare_a_query() { const string sql = "select @Id"; var guid = Guid.NewGuid(); var mc = new MappedColumn<Guid>("Id", DbType.Guid); var query = new RawQuery(sql).AddParameterValue(mc, guid); var dataParameterCollection = new Mock<IDataParameterCollection>(); var dataParameterFactory = new Mock<IDbDataParameterFactory>(); dataParameterFactory.Setup(m => m.Create("@Id", DbType.Guid, guid)); var dataSource = new DataSource("data-source", dataParameterFactory.Object); var command = new Mock<IDbCommand>(); dataParameterCollection.Setup(m => m.Add(It.IsAny<IDbDataParameter>())).Verifiable(); command.SetupGet(m => m.Parameters).Returns(dataParameterCollection.Object); command.SetupSet(m => m.CommandText = sql).Verifiable(); command.SetupSet(m => m.CommandType = CommandType.Text).Verifiable(); query.Prepare(dataSource, command.Object); command.VerifyAll(); dataParameterFactory.VerifyAll(); }
public override object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource) { object result = base.authorizedConnect(credentials, permission, validationDataSource); //_eventArgs.ConnectionEventType = ConnectionPoolEventArgs.ConnectionChangeEventType.ConnectionAvailable; //OnChanged(_eventArgs); return result; }
private DataTable CreateDataSource(DataSource ds, string sql) { DataTable dt = null; try { using(IDbAccess dataAccess = ds.CreateDbAccess()) { dt = dataAccess.QueryDataTable(sql.ToQuery()); } } catch (SqlException ex) { if (ex.Message.Contains("Must declare the scalar variable")) { foreach (string parameterName in FindParameterName(ex.Message)) { sql = sql.Replace(parameterName, "NULL"); } return CreateDataSource(ds, sql); } else throw; } return dt; }
public MainWindow() { InitializeComponent(); dataSource = new DataSource(); this.DataContext = dataSource; }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { // Arrange var ds = new DataSource(); await ds.CleanDatabaseAsync(); await ds.InitializeDbAsync(); // CRUD Operations Demos await CrudOperationsDemo(ds); // Tx Demos var speakers = await TxInsertDemo(ds); await TxDeleteDemo(ds, speakers.First().Id); // Reset the database await ds.CleanDatabaseAsync(); await ds.InitializeDbAsync(); // Querying Demos await TxInsertDemo(ds); // re-add data to the database await QueryingDemos(ds); // Some advanced scenarios await AdvancedDemos(ds); }
public Bars RequestData(DataSource ds, string symbol, DateTime startDate, DateTime endDate, int maxBars, bool includePartialBar) { Bars bars = new Bars(symbol, ds.Scale, ds.BarInterval); //bars.Add(new DateTime(2012, 04, 07), 2, 5, 1, 3, 5); //bars.Add(new DateTime(2010, 09, 06), 3, 6, 2, 2, 6); return bars; }
public MediatorServer(SystemConfiguration systemConfig, DataSource dataSource) { config = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Mediator).Value; controller = new Controller(dataSource); // bootstrapper = new MediatorBootstrapper(controller); bootstrapper = new ApiBootstrapper(controller); }
public override void ViewDidLoad() { base.ViewDidLoad (); _dataSource = new DataSource(this, _facebook); TableView.Delegate = new TableDelegate (this, _dataSource); TableView.DataSource = _dataSource; }
/// <inheritdoc /> protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement) { var invoker = new FixtureMemberInvoker<IEnumerable>(factoryType, scope, factoryMethodName); XDocument xdocument = OpenXDocument(codeElement); var parameters = new object[] { GetElementList(xdocument, xPath) }; var dataSet = new FactoryDataSet(() => invoker.Invoke(parameters), kind, columnCount); dataSource.AddDataSet(dataSet); }
public ConnectionManager(DataSource src) { this.modality = src.Modality; DaoFactory df = DaoFactory.getDaoFactory(DaoFactory.getConstant(src.Protocol)); Connection cxn = df.getConnection(src); cxnTbl = new IndexedHashtable(); addConnection(cxn); }
public XMLGigsRepository() { var xsr = new XmlSerializer(typeof(DataSource)); using(var fileStream = new FileStream(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["GigsXmlData"]), FileMode.Open)) { dataSource = xsr.Deserialize(fileStream) as DataSource; } }
public GaussianMixtureViewModel(DataSource dataSource) { this.dataSource = dataSource; this.gaussianMixtureModel = new GaussianMixtureModel(); this.InferCommand = new DelegateCommand<string>(selected => this.ExecuteInferCommand(selected), _ => true); this.DataSetNames = dataSource.GetDataSetsNames().ToList(); this.SelectedDataSetName = this.DataSetNames.FirstOrDefault(); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += this.OnSuspending; //initialization of DataModel data source DataModel = new DataSource(); }
public TableWidgetDialog(DataSource dataSource, IEnumerable<IFeatureAction> selectedFeatureActions, string caption) { InitializeComponent(); DataSource = dataSource == null ? OperationsDashboard.Instance.DataSources.First() : dataSource; SelectedFeatureActions = selectedFeatureActions == null ? AllFeatureActions : selectedFeatureActions; Caption = caption; FeatureActionList.FeatureActions = AllFeatureActions; FeatureActionList.SelectedFeatureActions = SelectedFeatureActions; }
public override AbstractConnection getConnection(DataSource dataSource) { XVistaConnection cxn = new XVistaConnection(dataSource); cxn.SaveResults = true; cxn.OverrideMockFile = "MDWS"; cxn.SaveAuthConnect = true; cxn.ConnectStrategy = new VistaDirectConnectStrategy(cxn); return cxn; }
public FinDataAdapter(FinAnalysisVM finAnalysisVm, string symbol, DataSource dataSource) { _finDataDao = new FinDataDao(); _priceDataDao = new PriceDataDao(); _dataSource = dataSource; _symbol = symbol; _finAnalysisVm = finAnalysisVm; _dcfDataDao = new DcfDataDao(); }
public static MvcHtmlString UxSelectWithDataSource(this HtmlHelper htmlHelper, DataSource dataSource, string selectedValue = null, SelectAppearanceType appearance = null, bool liveSearch = false, bool showTick = false, bool showArrow = false, bool autoWidth = true, string width = null, bool disabled = false, string header = null, string container = null, string clientId = null) { var select = new Select(selectedValue, dataSource, appearance, liveSearch, showTick, showArrow, autoWidth, width, disabled, header, container, clientId); MvcHtmlString start = htmlHelper.Partial("ControlTemplates/" + select.ViewTemplate + "Start", select); MvcHtmlString end = htmlHelper.Partial("ControlTemplates/" + select.ViewTemplate + "End", select); return MvcHtmlString.Create(start.ToHtmlString() + end.ToHtmlString()); }
public async Task Proc1_ToCollectionSet() { var result = await DataSource.Procedure(Proc1Name, new { @State = "CA" }).ToCollectionSet <Customer, Order>().ExecuteAsync(); }
public async Task Proc1_Object_Async_DataSet() { var result = await DataSource.Procedure(Proc1Name, new { @State = "CA" }).ToDataSet("cust", "order").ExecuteAsync(); Assert.AreEqual(2, result.Tables.Count); }
private void ConfigureDS(DataSource ds, ScanProfile scanProfile, ScanParams scanParams) { if (scanProfile.UseNativeUI) { return; } // Paper Source switch (scanProfile.PaperSource) { case ScanSource.Glass: ds.Capabilities.CapFeederEnabled.SetValue(BoolType.False); ds.Capabilities.CapDuplexEnabled.SetValue(BoolType.False); break; case ScanSource.Feeder: ds.Capabilities.CapFeederEnabled.SetValue(BoolType.True); ds.Capabilities.CapDuplexEnabled.SetValue(BoolType.False); break; case ScanSource.Duplex: ds.Capabilities.CapFeederEnabled.SetValue(BoolType.True); ds.Capabilities.CapDuplexEnabled.SetValue(BoolType.True); break; } // Bit Depth switch (scanProfile.BitDepth) { case ScanBitDepth.C24Bit: ds.Capabilities.ICapPixelType.SetValue(PixelType.RGB); break; case ScanBitDepth.Grayscale: ds.Capabilities.ICapPixelType.SetValue(PixelType.Gray); break; case ScanBitDepth.BlackWhite: ds.Capabilities.ICapPixelType.SetValue(PixelType.BlackWhite); break; } // Page Size, Horizontal Align PageDimensions pageDimensions = scanProfile.PageSize.PageDimensions() ?? scanProfile.CustomPageSize; if (pageDimensions == null) { throw new InvalidOperationException("No page size specified"); } float pageWidth = pageDimensions.WidthInThousandthsOfAnInch() / 1000.0f; float pageHeight = pageDimensions.HeightInThousandthsOfAnInch() / 1000.0f; var pageMaxWidthFixed = ds.Capabilities.ICapPhysicalWidth.GetCurrent(); float pageMaxWidth = pageMaxWidthFixed.Whole + (pageMaxWidthFixed.Fraction / (float)UInt16.MaxValue); float horizontalOffset = 0.0f; if (scanProfile.PageAlign == ScanHorizontalAlign.Center) { horizontalOffset = (pageMaxWidth - pageWidth) / 2; } else if (scanProfile.PageAlign == ScanHorizontalAlign.Left) { horizontalOffset = (pageMaxWidth - pageWidth); } ds.Capabilities.ICapUnits.SetValue(Unit.Inches); TWImageLayout imageLayout; ds.DGImage.ImageLayout.Get(out imageLayout); imageLayout.Frame = new TWFrame { Left = horizontalOffset, Right = horizontalOffset + pageWidth, Top = 0, Bottom = pageHeight }; ds.DGImage.ImageLayout.Set(imageLayout); // Brightness, Contrast // Conveniently, the range of values used in settings (-1000 to +1000) is the same range TWAIN supports if (!scanProfile.BrightnessContrastAfterScan) { ds.Capabilities.ICapBrightness.SetValue(scanProfile.Brightness); ds.Capabilities.ICapContrast.SetValue(scanProfile.Contrast); } // Resolution int dpi = scanProfile.Resolution.ToIntDpi(); ds.Capabilities.ICapXResolution.SetValue(dpi); ds.Capabilities.ICapYResolution.SetValue(dpi); // Patch codes if (scanParams.DetectPatchCodes) { ds.Capabilities.ICapPatchCodeDetectionEnabled.SetValue(BoolType.True); } }
public async Task <Response> GetAll(DataSource dataSource) { var list = _mapper.Map <IEnumerable <Reaper> >(await _reaperDAL.GetAll()).AsQueryable(); return(Helper.ToResult(list, dataSource)); }
private void Refresh() { if (Object.op_Inequality((Object)this.mScrollRect, (Object)null) && Object.op_Inequality((Object)this.mScrollRect.get_verticalScrollbar(), (Object)null)) { this.mScrollRect.get_verticalScrollbar().set_value(1f); } UnitData dataOfClass = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null); if (dataOfClass == null) { DebugUtility.LogError("UnitDataがBindされていません"); } else { this.mCurrentUnit = dataOfClass; if (this.mUnitVoiceData != null && this.mLastUnitUniqueID != -1L && this.mLastUnitUniqueID != this.mCurrentUnit.UniqueID) { this.mUnitVoiceData.Cleanup(); this.mUnitVoiceData = (UnitData.UnitPlaybackVoiceData)null; } this.mLastUnitUniqueID = this.mCurrentUnit.UniqueID; if (this.mUnitVoiceData != null) { this.mUnitVoiceData.Cleanup(); } this.mUnitVoiceData = this.mCurrentUnit.GetUnitPlaybackVoiceData(); if (this.mItems != null) { for (int index = 0; index < this.mItems.Count; ++index) { if (!Object.op_Equality((Object)this.mItems[index], (Object)null)) { this.mItems[index].SetActive(false); } } } if (Object.op_Equality((Object)this.ItemParent, (Object)null) || Object.op_Equality((Object)this.ItemTemplate, (Object)null)) { DebugUtility.LogError("リストテンプレートが存在しません"); } else { if (this.mUnitVoiceData.VoiceCueList.Count > this.mItems.Count) { int num = this.mUnitVoiceData.VoiceCueList.Count - this.mItems.Count; for (int index = 0; index < num; ++index) { GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate); if (!Object.op_Equality((Object)gameObject, (Object)null)) { gameObject.get_transform().SetParent((Transform)this.ItemParent, false); this.mItems.Add(gameObject); SRPG_Button componentInChildren = (SRPG_Button)gameObject.GetComponentInChildren <SRPG_Button>(); if (Object.op_Equality((Object)componentInChildren, (Object)null)) { DebugUtility.LogError("Buttonが存在しません"); } else { componentInChildren.AddListener(new SRPG_Button.ButtonClickEvent(this.OnSelect)); } } } } for (int index = 0; index < this.mUnitVoiceData.VoiceCueList.Count; ++index) { GameObject mItem = this.mItems[index]; PlayBackUnitVoiceItem componentInChildren = (PlayBackUnitVoiceItem)mItem.GetComponentInChildren <PlayBackUnitVoiceItem>(); if (Object.op_Equality((Object)componentInChildren, (Object)null)) { DebugUtility.LogError("PlayBackUnitVoiceItemが取得できません"); break; } componentInChildren.SetUp(this.mUnitVoiceData.VoiceCueList[index]); componentInChildren.Refresh(); componentInChildren.Unlock(); if (this.mUnitVoiceData.VoiceCueList[index].is_locked) { componentInChildren.Lock(); } ((Object)mItem).set_name((string)this.mUnitVoiceData.VoiceCueList[index].cueInfo.name); mItem.SetActive(true); } } } }
static void Main(string[] args) { if (args.Contains("-help")) { ApplicationHelp(); } //Setup the file to read in IDataSource DataSource = null; string FileName = DirectoryPath; try { if (args.Length == 0) { FileName += "SeasonData.csv"; //Default Filename DataSource = new FileDataSource(FileName); } else { if (args.Contains("-db")) { DataSource = new MySQLDataSource(); } else { FileName += args[0]; DataSource = new FileDataSource(FileName); } } } catch (Exception e) { Console.WriteLine("Error: " + e.Message + " Unable To continue"); Console.WriteLine("\nPress any key to close"); Console.ReadKey(); Environment.Exit(-1); } // Removed due to the map rotation changing mid season 21 //Maps.LoadMaps((string)ConfigurationManager.AppSettings["Map"]); Maps.ExcludedMaps((string)ConfigurationManager.AppSettings["ExcludedMaps"]); games = new List <Game>(); //Check that the data source is readable, and that it has some data in it if (DataSource.VerifySourceExists()) { games = DataSource.ReadExistingGamesSource(); } else { PopulateGameData(); } ConsoleKey keyPressed; do { Console.WriteLine("Please choose from the following options:\n"); Console.WriteLine("(A) to Add a new game\n(B) to Backup the game data\n(C) to Compress all backups\n(D) to Display the current stats\n" + "(O) to display an Overview\n(S) to Save the games details\n(X) to Exit without saving"); keyPressed = Console.ReadKey().Key; if (keyPressed == ConsoleKey.X) { Environment.Exit(0); } if (keyPressed == ConsoleKey.D) { DisplayGameData(); } if (keyPressed == ConsoleKey.O) { GamesOverview(); } if (keyPressed == ConsoleKey.A) { AddNewGame(); } if (keyPressed == ConsoleKey.B) { ArchiveGameData(); } if (keyPressed == ConsoleKey.C) { ArchiveToZipFile(); } } while (keyPressed != ConsoleKey.S); DataSource.SaveGamesToDataSource(games); Console.WriteLine("File Saved.\nPress Any key to exit"); Console.ReadKey(); }
public SplitInfos(DataSource src) { this.DataSource = src; }
private void Refresh() { ArtifactParam data1 = GlobalVars.ArtifactListItem.param; ArtifactData data2 = new ArtifactData(); data2.Deserialize(new Json_Artifact() { iname = GlobalVars.ArtifactListItem.param.iname, rare = GlobalVars.ArtifactListItem.param.rareini }); DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), data1); DataSource.Bind <ArtifactData>(((Component)this).get_gameObject(), data2); if (Object.op_Inequality((Object)this.AbilityListItem, (Object)null)) { MasterParam masterParam = MonoSingleton <GameManager> .Instance.MasterParam; GameObject abilityListItem = this.AbilityListItem; CanvasGroup component = (CanvasGroup)abilityListItem.GetComponent <CanvasGroup>(); bool flag = false; ArtifactParam artifactParam = data2.ArtifactParam; List <AbilityData> learningAbilities = data2.LearningAbilities; if (artifactParam.abil_inames != null) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type SelectArtifactInfo.\u003CRefresh\u003Ec__AnonStorey26F refreshCAnonStorey26F = new SelectArtifactInfo.\u003CRefresh\u003Ec__AnonStorey26F(); AbilityParam data3 = (AbilityParam)null; // ISSUE: reference to a compiler-generated field refreshCAnonStorey26F.abil_iname = (string)null; for (int index = 0; index < artifactParam.abil_inames.Length; ++index) { if (!string.IsNullOrEmpty(artifactParam.abil_inames[index]) && artifactParam.abil_shows[index] != 0) { // ISSUE: reference to a compiler-generated field refreshCAnonStorey26F.abil_iname = artifactParam.abil_inames[index]; data3 = masterParam.GetAbilityParam(artifactParam.abil_inames[index]); if (data3 != null) { break; } } } if (data3 == null) { component.set_alpha(this.ability_hidden_alpha); DataSource.Bind <AbilityParam>(this.AbilityListItem, (AbilityParam)null); DataSource.Bind <AbilityData>(this.AbilityListItem, (AbilityData)null); return; } DataSource.Bind <AbilityParam>(this.AbilityListItem, data3); DataSource.Bind <AbilityData>(abilityListItem, (AbilityData)null); if (Object.op_Inequality((Object)component, (Object)null) && learningAbilities != null && learningAbilities != null) { // ISSUE: reference to a compiler-generated method AbilityData data4 = learningAbilities.Find(new Predicate <AbilityData>(refreshCAnonStorey26F.\u003C\u003Em__2DE)); if (data4 != null) { DataSource.Bind <AbilityData>(abilityListItem, data4); flag = true; } } } if (flag) { component.set_alpha(this.ability_unlock_alpha); } else { component.set_alpha(this.ability_hidden_alpha); } } GameParameter.UpdateAll(((Component)this).get_gameObject()); }
public async Task <IActionResult> GetStationAccountsByStationId(long stationId, [FromBody] DataSource dataSource) => Ok(await _stationAccountDSL.GetAllByStationId(stationId, dataSource));
public async Task <IActionResult> GetAll([FromBody] DataSource dataSource) => Ok(await _stationAccountDSL.GetAll(dataSource));
public IActionResult Edit(int id) { var pt = DataSource.GetProductTypeByID(id); return(View(pt)); }
/// <summary> /// Initializes a new instance of the <see cref="ClientRepository"/> class. /// </summary> /// <param name="source">Data source</param> public ClientRepository(DataSource source) : base(source.Clients) { }
protected override RenderingWorkUnit CreateWorkItem(DataSource source, Configuration configuration) { return(new UrlWorkUnit(source.Uri, configuration)); }
public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource <string> source, List <string> testCases) { base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); }
public CustomDataSourceBuilder(DataSource dataSource, ViewContext viewContext, IUrlGenerator urlGenerator) : base(dataSource, viewContext, urlGenerator) { }
public override void DeleteSymbolDataFile(DataSource ds, string symbol) { l.Debug("DeleteSymbolDataFile " + symbol + " from " + ds.DSString); //this._dataStore.RemoveFile(symbol, ds.Scale, ds.BarInterval); }
public override void UpdateDataSource(DataSource ds, IDataUpdateMessage dataUpdateMsg) { base.UpdateDataSource(ds, dataUpdateMsg); l.Debug("UpdateDataSource"); }
public IActionResult Delete(int id) { DataSource.RemoveProductTypeByID(id); return(RedirectToAction("Index")); }
public List <ScannedImage> Scan(IWin32Window dialogParent, bool activate, ScanDevice scanDevice, ScanProfile scanProfile, ScanParams scanParams) { if (scanProfile.TwainImpl == TwainImpl.Legacy) { return(Legacy.TwainApi.Scan(scanProfile, scanDevice, dialogParent, formFactory)); } PlatformInfo.Current.PreferNewDSM = scanProfile.TwainImpl != TwainImpl.OldDsm; var session = new TwainSession(TwainAppId); var twainForm = formFactory.Create <FTwainGui>(); var images = new List <ScannedImage>(); Exception error = null; bool cancel = false; DataSource ds = null; int pageNumber = 0; session.TransferReady += (sender, eventArgs) => { Debug.WriteLine("NAPS2.TW - TransferReady"); if (cancel) { eventArgs.CancelAll = true; } }; session.DataTransferred += (sender, eventArgs) => { Debug.WriteLine("NAPS2.TW - DataTransferred"); pageNumber++; using (var output = Image.FromStream(eventArgs.GetNativeImageStream())) { using (var result = ScannedImageHelper.PostProcessStep1(output, scanProfile)) { if (blankDetector.ExcludePage(result, scanProfile)) { return; } var bitDepth = output.PixelFormat == PixelFormat.Format1bppIndexed ? ScanBitDepth.BlackWhite : ScanBitDepth.C24Bit; var image = new ScannedImage(result, bitDepth, scanProfile.MaxQuality, scanProfile.Quality); image.SetThumbnail(thumbnailRenderer.RenderThumbnail(result)); if (scanParams.DetectPatchCodes) { foreach (var patchCodeInfo in eventArgs.GetExtImageInfo(ExtendedImageInfo.PatchCode)) { if (patchCodeInfo.ReturnCode == ReturnCode.Success) { image.PatchCode = GetPatchCode(patchCodeInfo); } } } ScannedImageHelper.PostProcessStep2(image, result, scanProfile, scanParams, pageNumber); images.Add(image); } } }; session.TransferError += (sender, eventArgs) => { Debug.WriteLine("NAPS2.TW - TransferError"); if (eventArgs.Exception != null) { error = eventArgs.Exception; } else if (eventArgs.SourceStatus != null) { Log.Error("TWAIN Transfer Error. Return code = {0}; condition code = {1}; data = {2}.", eventArgs.ReturnCode, eventArgs.SourceStatus.ConditionCode, eventArgs.SourceStatus.Data); } else { Log.Error("TWAIN Transfer Error. Return code = {0}.", eventArgs.ReturnCode); } cancel = true; twainForm.Close(); }; session.SourceDisabled += (sender, eventArgs) => { Debug.WriteLine("NAPS2.TW - SourceDisabled"); twainForm.Close(); }; twainForm.Shown += (sender, eventArgs) => { if (activate) { // TODO: Set this flag based on whether NAPS2 already has focus // http://stackoverflow.com/questions/7162834/determine-if-current-application-is-activated-has-focus // Or maybe http://stackoverflow.com/questions/156046/show-a-form-without-stealing-focus twainForm.Activate(); } Debug.WriteLine("NAPS2.TW - TwainForm.Shown"); try { ReturnCode rc = session.Open(new WindowsFormsMessageLoopHook(dialogParent.Handle)); if (rc != ReturnCode.Success) { Debug.WriteLine("NAPS2.TW - Could not open session - {0}", rc); twainForm.Close(); return; } ds = session.FirstOrDefault(x => x.Name == scanDevice.ID); if (ds == null) { Debug.WriteLine("NAPS2.TW - Could not find DS - DS count = {0}", session.Count()); throw new DeviceNotFoundException(); } rc = ds.Open(); if (rc != ReturnCode.Success) { Debug.WriteLine("NAPS2.TW - Could not open DS - {0}", rc); twainForm.Close(); return; } ConfigureDS(ds, scanProfile, scanParams); var ui = scanProfile.UseNativeUI ? SourceEnableMode.ShowUI : SourceEnableMode.NoUI; Debug.WriteLine("NAPS2.TW - Enabling DS"); rc = ds.Enable(ui, true, twainForm.Handle); Debug.WriteLine("NAPS2.TW - Enable finished"); if (rc != ReturnCode.Success) { Debug.WriteLine("NAPS2.TW - Enable failed - {0}, rc"); twainForm.Close(); } } catch (Exception ex) { Debug.WriteLine("NAPS2.TW - Error"); error = ex; twainForm.Close(); } }; Debug.WriteLine("NAPS2.TW - Showing TwainForm"); twainForm.ShowDialog(dialogParent); Debug.WriteLine("NAPS2.TW - TwainForm closed"); if (ds != null && session.IsSourceOpen) { Debug.WriteLine("NAPS2.TW - Closing DS"); ds.Close(); } if (session.IsDsmOpen) { Debug.WriteLine("NAPS2.TW - Closing session"); session.Close(); } if (error != null) { Debug.WriteLine("NAPS2.TW - Throwing error - {0}", error); if (error is ScanDriverException) { throw error; } throw new ScanDriverUnknownException(error); } return(images); }
public async Task <bool> BringElementIntoView(Func <TItem, bool> selector, bool expand) { if (AsynchronousLoading) { return(false); } var existingItem = Data.Find(x => selector(x.Item)); if (existingItem != null) { AnchorToScrollTop = existingItem.Key; } var queryOptions = CreateQueryOptions(); try { queryOptions.PageNumber = 1; _pageNumber = 1; var found = false; while (true) { var result = await DataSource.Invoke(queryOptions); if (!string.IsNullOrEmpty(result.Error)) { UpdateUiWithResult(result); break; } var element = result.ResultData.FirstOrDefault(x => selector(x)); if (element != null) { found = true; UpdateUiWithResult(result); if (expand) { await ExpandElement(selector); } var processedItem = Data.Find(x => ReferenceEquals(x.Item, element)); if (processedItem != null) { AnchorToScrollTop = processedItem.Key; } StateHasChanged(); break; } if (!result.HasMoreData) { queryOptions.PageNumber = 1; _pageNumber = 1; result = await DataSource.Invoke(queryOptions); UpdateUiWithResult(result); break; } queryOptions.PageNumber++; _pageNumber++; } return(found); } catch (Exception ex) { Logger.LogError("Error bringing element into view {cause}", ex.Message); return(false); } }
public async Task Proc1_Dictionary_Async_DataSet() { var result = await DataSource.Procedure(Proc1Name, new Dictionary <string, object>() { { "State", "CA" } }).ToDataSet("cust", "order").ExecuteAsync(); Assert.AreEqual(2, result.Tables.Count); }
protected override GameObject CreateCategoryObject(Vector3[] path, int category) { Vector3[] newPath = new Vector3[path.Length + 1]; path.CopyTo(newPath, 0); newPath[path.Length] = path[0]; path = newPath; List <CanvasLines.LineSegement> seg = new List <CanvasLines.LineSegement>(); seg.Add(new CanvasLines.LineSegement(path)); RadarChartData.CategoryData cat = ((IInternalRadarData)DataSource).getCategoryData(category); GameObject container = ChartCommon.CreateChartItem(); ChartCommon.HideObject(container, hideHierarchy); container.transform.SetParent(transform, false); container.transform.localScale = new Vector3(1f, 1f, 1f); container.transform.localPosition = Vector3.zero; container.transform.localRotation = Quaternion.identity; if (cat.FillMaterial != null) { RadarFill fill = CreateFillObject(container); fill.material = cat.FillMaterial; fill.SetPath(path, Radius); } if (cat.LineMaterial != null && cat.LineThickness > 0) { CanvasLines lines = CreateLinesObject(container); lines.material = cat.LineMaterial; lines.Thickness = cat.LineThickness; lines.SetHoverPrefab(cat.LineHover); lines.SetLines(seg); } if (cat.PointMaterial != null && cat.PointSize > 0f) { CanvasLines points = CreateLinesObject(container); points.material = cat.PointMaterial; points.MakePointRender(cat.PointSize); points.SetHoverPrefab(cat.PointHover); points.SetLines(seg); string name = cat.Name; points.Hover += (int arg1, int t, object d, Vector2 arg2) => Points_Hover(name, arg1, arg2); points.Leave += () => Points_Leave(name); points.Click += (int arg1, int t, object d, Vector2 arg2) => Points_Click(name, arg1, arg2); } if (mCategoryLabels != null && mCategoryLabels.isActiveAndEnabled) { for (int i = 0; i < path.Length - 1; i++) { string group = DataSource.GetGroupName(i); double val = DataSource.GetValue(cat.Name, group); Vector3 labelPos = path[i]; Vector3 dir = labelPos.normalized; labelPos += dir * mCategoryLabels.Seperation; labelPos += new Vector3(mCategoryLabels.Location.Breadth, 0f, mCategoryLabels.Location.Depth); int fractionDigits = 2; if (mItemLabels != null) { fractionDigits = mItemLabels.FractionDigits; } string toSet = mCategoryLabels.TextFormat.Format(ChartAdancedSettings.Instance.FormatFractionDigits(fractionDigits, val), cat.Name, group); BillboardText billboard = ChartCommon.CreateBillboardText(null, mCategoryLabels.TextPrefab, transform, toSet, labelPos.x, labelPos.y, labelPos.z, 0f, null, hideHierarchy, mCategoryLabels.FontSize, mCategoryLabels.FontSharpness); TextController.AddText(billboard); AddBillboardText(cat.Name, billboard); } } return(container); }
public void Proc1_Object_DataSet() { var result = DataSource.Procedure(Proc1Name, new { @State = "CA" }).ToDataSet("cust", "order").Execute(); Assert.AreEqual(2, result.Tables.Count); }
private async Task SaveDataAsync(SaveAction saveAction) { if (DataType == null) { if (DataSource == null) { throw new BlazuiException(2, "DataType 或 DataSource 必须设置一个"); } DataType = DataSource.GetType().GetGenericArguments()[0]; } var row = Activator.CreateInstance(DataType); foreach (var header in Headers) { if ((!header.IsEditable && header.EditorRenderConfig == null) || (saveAction != SaveAction.Create && !CanEdit(header))) { if (header.Property != null && (header.Property.Name.Contains("Id") || header.Property.Name.Contains("Key")) && saveAction != SaveAction.Create) { header.Property.SetValue(row, header.Property.GetValue(header.RawValue)); } Clear(header); continue; } if (saveAction != SaveAction.Delete) { object cell = Convert.ChangeType(header.EditorRenderConfig.EditingValue, header.Property.PropertyType); if (header.EditorRenderConfig.IsRequired && cell == null) { Toast(header.EditorRenderConfig.RequiredMessage); editingTaskCompletionSource?.TrySetResult(-1); return; } header.Property.SetValue(row, cell); } Clear(header); } var tableSaveArg = new TableSaveEventArgs() { Action = saveAction, Data = row, Table = this, }; if (!OnSave.HasDelegate) { if (DataType == typeof(KeyValueModel)) { OnSave = EventCallback.Factory.Create <TableSaveEventArgs>(this, TableRender.DefaultSaverAsync); } else if (!string.IsNullOrWhiteSpace(Key)) { OnSave = EventCallback.Factory.Create <TableSaveEventArgs>(this, TableRender.DefaultSaverAsync); } else { Toast("OnSave 事件没有注册或数据源类型不是 KeyValueModel 或没指定 Key"); editingTaskCompletionSource?.TrySetResult(-1); return; } } tableSaveArg.Key = Key; tableSaveArg.DataType = DataType; if (editingTaskCompletionSource != null) { await OnSave.InvokeAsync(tableSaveArg); if (tableSaveArg.Cancel) { editingTaskCompletionSource.TrySetResult(-1); return; } editingRow = null; dataSourceUpdated = true; await RefreshDataSourceAsync(false); editingTaskCompletionSource.TrySetResult(0); SyncFieldValue(); } else { if (OnSave.HasDelegate) { await OnSave.InvokeAsync(tableSaveArg); if (tableSaveArg.Cancel) { editingTaskCompletionSource?.TrySetResult(-1); return; } editingRow = null; dataSourceUpdated = true; await RefreshDataSourceAsync(false); editingTaskCompletionSource?.TrySetResult(0); SyncFieldValue(); return; } editingTaskCompletionSource?.TrySetResult(-1); } }
public ConfigurationPageViewModel(DataSource source) : base(source) { }
public AbstractConnection(DataSource dataSource) { this._dataSource = dataSource; }
public static void getH(string DSMfile, string oriShp) { Console.WriteLine("开始提取建筑高度!"); Gdal.AllRegister(); Ogr.RegisterAll(); Stopwatch aTime = new Stopwatch(); aTime.Start(); //创建一个BUFFER,BUFFER距离为1米 string bufShp = bufferFile(oriShp, 1); //打开原文件和Buffer文件 OSGeo.OGR.Driver dr = Ogr.GetDriverByName("ESRI shapefile"); DataSource oriDs = dr.Open(oriShp, 1); DataSource bufDs = dr.Open(bufShp, 0); OSGeo.OGR.Layer bufLayer = bufDs.GetLayerByIndex(0); OSGeo.OGR.Layer oriLayer = oriDs.GetLayerByIndex(0); //判断原文件中是否有以下字段,没有就创建 if (oriLayer.FindFieldIndex("MIN", 1) == -1) { FieldDefn min = new FieldDefn("MIN", FieldType.OFTReal); oriLayer.CreateField(min, 1); } if (oriLayer.FindFieldIndex("MAX", 1) == -1) { FieldDefn max = new FieldDefn("MAX", FieldType.OFTReal); oriLayer.CreateField(max, 1); } if (oriLayer.FindFieldIndex("HIGHT", 1) == -1) { FieldDefn hight = new FieldDefn("HIGHT", FieldType.OFTReal); oriLayer.CreateField(hight, 1); } //打开栅格 Dataset dsmDs = Gdal.Open(DSMfile, Access.GA_ReadOnly); double[] transfrom = new double[6]; dsmDs.GetGeoTransform(transfrom); int allX = dsmDs.RasterXSize; int allY = dsmDs.RasterYSize; //开始计算每个Feature需要读取的栅格参数 int featCount = oriLayer.GetFeatureCount(0); for (int i = 0; i < featCount; i++) { int[] subRasterOff_Size = subRasterInfo(transfrom, allX, allY, bufLayer.GetFeature(i)); Feature oriFeat = oriLayer.GetFeature(i); Feature bufFeat = bufLayer.GetFeature(i); getMaxMinValue(dsmDs, oriFeat, bufFeat, subRasterOff_Size); oriLayer.SetFeature(oriFeat); oriFeat.Dispose(); Console.WriteLine("当前处理:{0}/{1}", i, featCount); } oriLayer.Dispose(); bufLayer.Dispose(); oriDs.Dispose(); bufDs.Dispose(); dsmDs.Dispose(); aTime.Stop(); Console.WriteLine("建筑高度值提取完成!用时:{0}", aTime.Elapsed.ToString()); }
//public abstract object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission); public abstract object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource);
public SampleAdapter(DataSource mDataSource) { _mDataSource = mDataSource; }
public IActionResult Index() { var types = DataSource.GetProductTypes(); return(View(types)); }