static void Main(string[] args) { TrimApplication.Initialize(); Stopwatch watch = new Stopwatch(); watch.Start(); DatabasePoolEntry poolEntry = DatabasePool.Instance.AcquirePoolEntry("J1", "itu_tadmin"); Console.WriteLine(poolEntry.TrimDatabase.CurrentUser.SortName); DatabasePool.Instance.ReleasePoolEntry(poolEntry.Id); watch.Stop(); Console.WriteLine(watch.ElapsedMilliseconds); watch.Restart(); poolEntry = DatabasePool.Instance.AcquirePoolEntry("J1", "itu_tadmin"); Console.WriteLine(poolEntry.TrimDatabase.CurrentUser.SortName); DatabasePool.Instance.ReleasePoolEntry(poolEntry.Id); watch.Stop(); Console.WriteLine(watch.ElapsedMilliseconds); DatabasePool.Instance.Dispose(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new SampleForm()); //Calling initialize() loads the Content Manager runtime environment and reports errors if there are any. TrimApplication.Initialize(); }
static TrimHelper() { TrimApplication.TrimBinariesLoadPath = System.Configuration.ConfigurationManager.AppSettings["trimPath"]; TrimApplication.SetAsWebService(System.Configuration.ConfigurationManager.AppSettings["workPath"]); TrimApplication.Initialize(); Database.AllowAccessFromMultipleThreads = true; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { TrimApplication.TrimBinariesLoadPath = "d:\\trunk\\x64\\debug"; Database.AllowAccessFromMultipleThreads = true; TrimApplication.Initialize(); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddSingleton <TrimService>(); }
public CreateLocationVM() { TrimApplication.Initialize(); _database = new Database(); _database.Connect(); this.PropertyChanged += CreateLocationVM_PropertyChanged; NewLocationType = (int)LocationType.Person; }
static BaseController() { TrimApplication.TrimBinariesLoadPath = ConfigurationManager.AppSettings["trimBinariesLoadPath"]; if (TrimApplication.ServiceType != ServiceTypes.WebService) { TrimApplication.SetAsWebService(ConfigurationManager.AppSettings["workPath"]); } TrimApplication.Initialize(); }
static void doSomething() { TrimApplication.Initialize(); Database db = new Database(); db.WorkgroupServerName = "local"; db.Id = "L1"; db.Connect(); Console.WriteLine(db.CurrentUser.SortName); }
private void Application_Startup(object sender, StartupEventArgs e) { try { TrimApplication.Initialize(); string uris = null; string dbid = null; for (int counter = 0; counter < e.Args.Length; counter++) { if (e.Args[counter] == "--dbid") { dbid = e.Args[counter + 1]; } if (e.Args[counter] == "--uris") { uris = e.Args[counter + 1]; } } if (string.IsNullOrEmpty(uris)) { MessageBox.Show("Please tag one or more records.", "Addin", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (string.IsNullOrEmpty(dbid)) { MessageBox.Show("Addin incorrectly configured, no database ID sent.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } // if uris is a comma separated list do nothing, otherwise read the file containing the list of URIs long tmp; if (!Int64.TryParse(uris.Split(',').First(), out tmp)) { // the temp file contains a Newline separated list of URIs, so I replace newlines with commas which is what MainWindow expects. uris = System.IO.File.ReadAllText(uris).Replace(System.Environment.NewLine, ","); } MainWindow wnd = new MainWindow(dbid, uris); wnd.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public MainWindow() { InitializeComponent(); DataContext = this; try { // I call Initialize here to make sure any errors connecting to the core code get report at the start TrimApplication.Initialize(); if (!string.IsNullOrEmpty(Properties.Settings.Default["dbid"] as string)) { // rather than doing this I should probably create a Factory to connect the Database and get the Origin both here and // in the background thread Database.AllowAccessFromMultipleThreads = true; Database = new Database(); Database.Id = Properties.Settings.Default["dbid"].ToString(); Database.Connect(); IsDatabaseAvailable = Database.IsValid; } long originUri = Convert.ToInt64(Properties.Settings.Default["origin_uri"]); if (originUri > 0) { SelectedOrigin = new Origin(Database, originUri); } SourceFolder = Properties.Settings.Default["source_folder"] as string; if ((int)Properties.Settings.Default["interval"] > 0) { Interval = Properties.Settings.Default["interval"].ToString(); } IsOnSchedule = (bool)Properties.Settings.Default["on_schedule"]; if (IsOnSchedule) { _scheduler = new Scheduler(new Importer(SelectedOrigin, SourceFolder), Convert.ToInt32(Interval)); _scheduler.Start(); } } catch (Exception ex) { System.Windows.MessageBox.Show("Error starting application: " + ex.Message); this.Close(); } }
public MainWindow() { InitializeComponent(); try { TrimApplication.Initialize(); _database = new Database(); _database.Connect(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Application_Startup(object sender, StartupEventArgs e) { try { TrimApplication.Initialize(); if (e.Args.Length < 4) { MessageBox.Show("Please tag one or more records."); } else { MainWindow wnd = new MainWindow(e.Args[1], e.Args[3]); wnd.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }