public override async Task Execute() { var stepConfig = this._StepConfig; // using (var topicAdapter = new TopicAdapter(stepConfig.TopicName, stepConfig.ConnectionString)) // { var topicAdapter = new TopicAdapter(stepConfig.TopicName, stepConfig.ConnectionString); await topicAdapter.SendAtOnce(stepConfig.MessageContents.ToList()); //} }
protected override void Dispose(bool disposing) { if (this.disposed) { return; } if (!disposing) { return; } this.adapter?.Dispose(); this.adapter = null; base.Dispose(true); }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(ApplicationContext); base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.record); SupportActionBar.Title = StringResources.recording_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var instructionsHeader = FindViewById <TextView>(Resource.Id.recordInstructionsHeader); instructionsHeader.Text = StringResources.recording_ui_instructions_header; InterviewSessionID = Guid.NewGuid().ToString(); var _prefs = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); ConsentType = _prefs.GetString("SESSION_CONSENT", ""); SelectedProjectID = _prefs.GetInt("SelectedProjectID", 0); langId = _prefs.GetInt("SESSION_LANG", 1); var selectedProject = Queries.ProjectById(SelectedProjectID); RecyclerView promptRecyclerView = FindViewById <RecyclerView>(Resource.Id.prompts); promptRecyclerView.SetLayoutManager(new GridLayoutManager(this, 1)); Content project = LanguageChoiceManager.ContentByLanguage(selectedProject, langId); List <Topic> activeTopics = project.Topics.Where((p) => p.IsActive).ToList(); themes = activeTopics; adapter = new TopicAdapter(themes); adapter.ProjectClicked += CheckRecPerm; promptRecyclerView.SetAdapter(adapter); record = FindViewById <FloatingActionButton>(Resource.Id.start); FindViewById <TextView>(Resource.Id.themeTitle).Text = project.Title; Color highlightColor = new Color(ContextCompat.GetColor(this, Resource.Color.colorControlHighlight)); ViewCompat.SetBackgroundTintList(record, Android.Content.Res.ColorStateList.ValueOf(highlightColor)); record.Enabled = false; timer = FindViewById <TextView>(Resource.Id.timer); timer.SetTextColor(highlightColor); record.Click += HandleRecordClick; }
public TopicRepository(IProgressConnection connection) { this.adapter = new TopicAdapter(connection); this.Cono = this.adapter.Cono; this.OnCreated(); }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(ApplicationContext); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.record); SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.toolbar)); SupportActionBar.Title = StringResources.recording_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var instructionsHeader = FindViewById <TextView>(Resource.Id.recordInstructionsHeader); instructionsHeader.Text = StringResources.recording_ui_instructions_header; InterviewSessionID = Guid.NewGuid().ToString(); var _prefs = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); ConsentType = _prefs.GetString("SESSION_CONSENT", ""); SelectedProjectID = _prefs.GetInt("SelectedProjectID", 0); var selectedProject = Queries.ProjectById(SelectedProjectID); var promptRecyclerView = FindViewById <RecyclerView>(Resource.Id.prompts); promptRecyclerView.SetLayoutManager(new GridLayoutManager(this, 1)); themes = selectedProject.Prompts; adapter = new TopicAdapter(themes); adapter.ProjectClicked += ProjectSelected; promptRecyclerView.SetAdapter(adapter); var record = FindViewById <FloatingActionButton>(Resource.Id.start); ViewCompat.SetBackgroundTintList(record, Android.Content.Res.ColorStateList.ValueOf(Color.LightGray)); record.Enabled = false; var timer = FindViewById <TextView>(Resource.Id.timer); timer.SetTextColor(Color.LightGray); // Note: record has two states: start and stop record. record.Click += delegate { LOG_EVENT("RECORD_CLICKED"); // Change icon between record to stop. record.Selected = !record.Selected; if (record.Selected) { // Override path for re-use as user may record many audios. Store only once. if (string.IsNullOrWhiteSpace(_path)) { var personal = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); _path = System.IO.Path.Combine(personal, DateTimeOffset.Now.ToUnixTimeSeconds() + ".mp3"); } StartRecording(); // TODO: do we want users to record for as long as they desire? RunOnUiThread(async() => { _seconds = 0; while (_isrecording) { SupportActionBar.Title = StringResources.recording_ui_title_active; timer.Text = Queries.FormatFromSeconds(_seconds++); await Task.Delay(1000); } }); } else { ModalToVerifyRecordingEnd(); // This ensures that the state of the Play/Stop icon does not change record.Selected = true; } }; }