private void ConfigurationForm_Load(object sender, EventArgs e) { string checkboxmsg = "If you check this feature then the program will start watching \n" + "the directories that you already have entered in the program immediately \n" + "following the program starting. If it is unchecked, then the program waits for \n" + "you to start it manually."; toolTip1.SetToolTip(cboxAutoStartCopyingFiles, checkboxmsg); string timermsg = "As your computer changes files it goes through several steps. \n" + "Each of those steps can trigger the copying mechanism. For efficiency purposes,\n" + "it is better to wait some time before attempting to copy a file, just in case it \n" + "is about to be changed again. If you are mostly changing small files, testing \n" + "has shown 3 seconds to be the best. Alternatively, If you are changing large \n" + "files a longer wait period is highly recommended."; toolTip1.SetToolTip(txtTimerLength, timermsg); toolTip1.SetToolTip(lblTimerLength, timermsg); string retrycntmsg = "Each time a file changes an attempt to copy that file is \n" + "made (after waiting the appropriate time as marked above). If that copy fails \n" + "for some reason, attempts will be made repeatedly until the file is either \n" + "copied or the limit entered here is reached."; toolTip1.SetToolTip(txtMaximumRetryCount, retrycntmsg); toolTip1.SetToolTip(lblMaximumRetryCount, retrycntmsg); ConfigurationBO bo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); cboxAutoStartCopyingFiles.Checked = bo.CContainer.AutoStart; txtMaximumRetryCount.Text = bo.CContainer.MaxRetryCount.ToString(); txtTimerLength.Text = bo.CContainer.WaitTime.ToString(); }
private void biMatchSelectedJob_Click(object sender, EventArgs e) { if (!MatchWarn()) { return; } pbProgress.Visible = true; lblProgress.Visible = true; DataGridViewRow row = GetSelectedRowFromCell(this.gridJobs); if (row != null) { JobsBO jbo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); JobContainer container = jbo.FindByName(row.Cells[0].Value.ToString()); if (container != null) { SynchronizeBO bo = (SynchronizeBO)SingletonManager.GetSingleton(typeof(SynchronizeBO)); bo.aSynchronizeDirectory( container.SourceDirectory, container.SourceDirectory, container.DestinationDirectory, container.WatchSubDirectories, true); //RefreshFiles(); } } else { MessageForm frm = new MessageForm(); frm.Msg = "No job was selected, please select a job by click on its name and try again."; frm.ShowDialog(); } }
void Update() { if (UnityEngine.Input.GetKeyDown(KeyCode.Space)) { SingletonManager.GetSingleton <SceneManager> ().LoadScene("Playground2"); } }
private void RefreshFiles() { if (gridJobs.Rows.Count == 0) { dataGridView1.Rows.Clear(); return; } DataGridViewRow row = GetSelectedRowFromCell(gridJobs); if (row == null || row.Cells[0].Value == null) { return; } lblLoadingFiles.Visible = true; JobsBO bo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); JobContainer container = bo.FindByName(row.Cells[0].Value.ToString()); if (container != null) { FileRefresher fr = new FileRefresher(container); fr.dataGridView1 = dataGridView1; fr.Finished += new FileRefresherFinishedEventHandler(fr_Finished); LatestJobForFiles = container; fr.Run(); } }
public AboutForm() { InitializeComponent(); VersionBO bo = (VersionBO)SingletonManager.GetSingleton(typeof(VersionBO)); this.msg = bo.ProgramName + " v" + bo.Version + "\n" + "By:\n" + "Volz Software"; }
private void SaveJob(DataGridView dgv, int rowIndex) { if (dgv.Rows.Count < rowIndex - 1) { return; } DataGridViewRow row = dgv.Rows[rowIndex]; if (row.Cells[0].Value != null && row.Cells[1].Value != null && row.Cells[2].Value != null && //row.Cells[3].Value != null && row.Cells[0].Value.ToString().CompareTo("") != 0 && row.Cells[1].Value.ToString().CompareTo("") != 0 && row.Cells[2].Value.ToString().CompareTo("") != 0 /*&& * row.Cells[3].Value.ToString().CompareTo("") != 0*/) { //ok to save JobsBO bo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); JobContainer container = bo.FindByName(row.Cells[0].Value.ToString()); if (container == null) { JobContainer container2 = new JobContainer(); container2.Name = row.Cells[0].Value.ToString(); bo.Add(container2); container = bo.FindByName(row.Cells[0].Value.ToString()); } container.SourceDirectory = row.Cells[1].Value.ToString(); container.DestinationDirectory = row.Cells[2].Value.ToString(); container.WatchSubDirectories = (bool)row.Cells[3].EditedFormattedValue; bo.Save(); } }
private void Delete() { QuestionForm frm = new QuestionForm(); frm.Msg = "Delete this job?"; if (frm.ShowDialog() == DialogResult.OK) { DataGridViewRow row = GetSelectedRowFromCell(gridJobs); if (row == null) { return; } gridJobs.Rows.Remove(row); if (row.Cells[0].Value == null) { //RefreshFiles(); ClearFiles(); return; } string name = row.Cells[0].Value.ToString(); JobsBO bo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); JobContainer container = bo.FindByName(name); if (container != null) { bo.Delete(container); bo.Save(); //RefreshFiles(); } } }
static void Main() { try { mutex = Mutex.OpenExisting(mutexName); //fail if no exception is thrown MessageForm frm = new MessageForm(); VersionBO bo = (VersionBO)SingletonManager.GetSingleton(typeof(VersionBO)); frm.Msg = String.Format( "There is already a copy of {0} v{1} running.\n\n" + "I'll close this one, so you can use the other one.\n" + "Please check your task bar and system tray for the active copy.", bo.ProgramName, bo.Version); frm.ShowDialog(); Environment.Exit(0); } catch { mutex = new Mutex(true, mutexName); LicenseBO bo = (LicenseBO)SingletonManager.GetSingleton(typeof(LicenseBO)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (bo.IsActive()) { Application.Run(new MainForm()); } } }
private bool DoneTrying() { ConfigurationBO cbo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); ConfigurationContainer container = cbo.CContainer; return(this.RetryCount > container.MaxRetryCount); }
public void ResetTimer() { this.QTimer.Stop(); ConfigurationBO cbo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); this.QTimer.Interval = Convert.ToInt32(cbo.CContainer.WaitTime); this.QTimer.Start(); }
private void SynchronizeAll() { pbProgress.Visible = true; lblProgress.Visible = true; SynchronizeBO bo = (SynchronizeBO)SingletonManager.GetSingleton(typeof(SynchronizeBO)); bo.aSynchronizeAll(); }
public virtual void CloseUIPage() { _component.Dispose(); if (SingletonManager.GetSingleton <UIManager>().UIPages.ContainsKey(_pageName)) { SingletonManager.GetSingleton <UIManager>().UIPages.Remove(_pageName); } ClearUIPage(); }
public HandlerBO() : base() { this.Copier = new SimpleCopy(); ConfigurationBO cbo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); this.QTimer = new Timer(Convert.ToInt32(cbo.CContainer.WaitTime)); this.QTimer.AutoReset = true; this.QTimer.Elapsed += new ElapsedEventHandler(this.Timer_Tick); }
public void SynchronizeFile(string oFile) { this.timerCheckReporter.Start(); SynchronizeBO sbo = (SynchronizeBO)SingletonManager.GetSingleton(typeof(SynchronizeBO)); sbo.FinishedSynch += new EventHandler(this.HandleSynchFinished); sbo.aSynchronizeFile(oFile); this.ShowDialog(); }
private void Save() { ConfigurationBO bo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); ConfigurationContainer container = bo.CContainer; container.AutoStart = cboxAutoStartCopyingFiles.Checked; container.MaxRetryCount = Int32.Parse(txtMaximumRetryCount.Text); container.WaitTime = Int32.Parse(txtTimerLength.Text); bo.Save(); }
public void Initialize() { DamagerController.DisableCollider(); return; for (int i = 0; i < Combos[0].AttackList.Count; i++) { attackPool = SingletonManager.GetSingleton <PoolManager> ().CreatePool(Combos[0].AttackList[i].AttackName, Combos[0].AttackList[i].projectile, 5); } }
private void Initiate() { _currentHealth = _playerData.StartingHealth; _currentHorror = _playerData.StartingHorror; _currentResources = _playerData.StartingResources; SingletonManager.GetSingleton <SpriteHelper>().GetSpriteFromUrl("https://orig00.deviantart.net/d8a6/f/2016/137/5/f/native_tongue_by_nakanoart-da2sfjn.jpg", (sprite) => { _mainArt.sprite = sprite; }); }
private void MatchAll() { if (!MatchWarn()) { return; } pbProgress.Visible = true; lblProgress.Visible = true; SynchronizeBO bo = (SynchronizeBO)SingletonManager.GetSingleton(typeof(SynchronizeBO)); bo.aMatchAll(); }
public void LoadCampaign(Campaign newCampaign, int scenarioIndex) { _campaign = newCampaign; if (_campaign == null || scenarioIndex < 0 || scenarioIndex >= _campaign.CampaignSteps.Count) { Debug.LogError("CampaignManager.LoadCampaign :: Campaign is not set up properly or was null"); return; } SingletonManager.GetSingleton <SkillCheckManager>().InitiateManager(_campaign.CampaignSteps[scenarioIndex].ChaosBag); _currentGamePhase = 1; // Campaigns begin on phase 2 }
public void aSynchronizeDirectory(string oDirectory) { JobsBO bo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); List <JobContainer> selected = bo.JContainer.Jobs.FindAll(delegate(JobContainer j){ return(Path.GetDirectoryName(j.SourceDirectory).ToLower().CompareTo(oDirectory) == 0); }); foreach (JobContainer container in selected) { this.aSynchronizeDirectory(oDirectory, oDirectory, container.DestinationDirectory, container.WatchSubDirectories, false); } this.OnFinishedSynch(EventArgs.Empty); }
public void Save() { try { string jobsfile = SharedBO.GetJobsFile(); //MoreXmlSerializer.Serialize<JobsContainer>(jContainer, jobsfile); WriteJobs(jContainer, jobsfile); ListenerBO bo = (ListenerBO)SingletonManager.GetSingleton(typeof(ListenerBO)); bo.RestartListeners(); } catch { /*(Exception e){ * System.Windows.Forms.MessageBox.Show(e.ToString());*/ } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; this.WindowState = FormWindowState.Minimized; } else { JobsBO jbo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); jbo.Save(); } }
public void aSynchronizeFile(string oFile) { JobsBO bo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); List <JobContainer> selected = bo.JContainer.Jobs.FindAll(delegate(JobContainer j) { return(Path.GetDirectoryName(j.SourceDirectory).ToLower().CompareTo(Path.GetDirectoryName(oFile)) == 0); }); foreach (JobContainer container in selected) { this.aSynchronizeFile(oFile, Path.Combine(Path.GetDirectoryName(container.DestinationDirectory), Path.GetFileName(oFile))); } this.OnFinishedSynch(EventArgs.Empty); }
private void LicenseControl_Load(object sender, EventArgs e) { LicenseBO bo = (LicenseBO)SingletonManager.GetSingleton(typeof(LicenseBO)); if (bo.IsLicensed()) { this.Visible = false; } else { this.Visible = true; bo.Licensed += new EventHandler(bo_Licensed); } }
private void btnMMExit_Click(object sender, EventArgs e) { ListenerBO bo = (ListenerBO)SingletonManager.GetSingleton(typeof(ListenerBO)); bo.StopListeners(); JobsBO jbo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); jbo.Save(); ConfigurationBO cbo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); cbo.Save(); //this.Close(); Application.Exit(); }
void lbo_StatusChanged(object sender, EventArgs e) { ListenerBO lbo = (ListenerBO)SingletonManager.GetSingleton(typeof(ListenerBO)); if (lbo.Started) { lblStatus.ForeColor = Color.DarkGreen; lblStatus.Text = "Status: Active"; } else { lblStatus.ForeColor = Color.DarkRed; lblStatus.Text = "Status: Inactive"; } }
private void WriteLog(ActionReportContainer container) { ConfigurationBO cbo = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO)); string logfile = SharedBO.GetLogFile(); StreamWriter sw = null; FileInfo fi = new FileInfo(logfile); lock (this.SyncRoot) { try { sw = fi.AppendText(); if (container.OriginalPath.CompareTo("") != 0) { sw.WriteLine("File: \t\t" + container.OriginalPath); } if (container.CopyPath.CompareTo("") != 0) { sw.WriteLine("Copy to:\t" + container.CopyPath); } sw.WriteLine("Action: \t\t" + container.Action.ToString()); sw.WriteLine("Result: \t\t" + container.ActionResult.ToString()); sw.WriteLine("Comment:\t" + container.ActionResultDescription); sw.WriteLine("Occured at:\t" + container.OccuredAt.ToString("f")); sw.Flush(); } catch (Exception) { //TODO: IReporter.FirstReporter.WriteLog() //System.Windows.Forms.Form eForm = new LlamaCarbonCopy.Controls.Forms.ErrorMessageForm( // String.Format( // OBBO.blah(), // logfile), // OBBO.err() // ); //eForm.ShowDialog(); } finally { if (sw != null) { sw.Close(); } } } }
public void Initialize() { rb = GetComponent <Rigidbody2D> (); animator = GetComponentInChildren <Animator> (); AttackController = GetComponentInChildren <PlayerAttackController> (); TentacleController = GetComponentInChildren <TentacleController> (); groundMask = LayerMask.GetMask(GROUND_LAYER); inputManager = SingletonManager.GetSingleton <InputManager> (); jumpKey = inputManager.GetKey(OctoKey.JUMP); tentacleKey = inputManager.GetKey(OctoKey.TENTACLE); jumpKey.OnKeyDown += Jump; tentacleKey.OnKeyDown += () => TentacleController.ThrowTentacle(); AttackController.Initialize(this, inputManager); TentacleController.Initialize(this, inputManager); }
public void StartListeners() { if (this.Started) { return; } JobsBO jbo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); foreach (JobContainer container in jbo.JContainer.Jobs) { if (container.SourceDirectory.Length > 0 && container.DestinationDirectory.Length > 0) { if (Directory.Exists(container.SourceDirectory) && Directory.Exists(container.DestinationDirectory)) { try { FileSystemWatcher watcher = new FileSystemWatcher(container.SourceDirectory); watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.DirectoryName | NotifyFilters.CreationTime; watcher.IncludeSubdirectories = container.WatchSubDirectories; watcher.Created += new FileSystemEventHandler(Watcher_Event); //watcher.Deleted += new FileSystemEventHandler(Watcher_Event); watcher.Renamed += new RenamedEventHandler(Watcher_Renamed); watcher.Changed += new FileSystemEventHandler(Watcher_Event); watcher.EnableRaisingEvents = true; lock (this.Watchers) { Watchers.Add(container, watcher); } lock (this.WatcherContainers) { this.WatcherContainers.Add(container.SourceDirectory, container); } } catch (Exception ex) { IReporter reporter = ReporterManager.GetReporter(); reporter.AddReport(new ActionReportContainer(ActionType.Notify, ActionReportResult.Noted, ex.ToString())); } } else { IReporter reporter = ReporterManager.GetReporter(); reporter.AddReport(new ActionReportContainer(ActionType.Notify, ActionReportResult.Noted, "There was an error finding one or more of the two following directories:\n" + container.SourceDirectory + "\n" + container.DestinationDirectory)); } } } this.Started = true; OnStatusChanged(EventArgs.Empty); }
public void SynchronizeAll() { JobsBO bo = (JobsBO)SingletonManager.GetSingleton(typeof(JobsBO)); SynchProgressCount = 0; foreach (JobContainer container in bo.JContainer.Jobs) { SynchTotalFileCount += countFiles(container.SourceDirectory, container.WatchSubDirectories); } foreach (JobContainer container in bo.JContainer.Jobs) { SynchronizeDirectory( container.SourceDirectory, container.SourceDirectory, container.DestinationDirectory, container.WatchSubDirectories, false); } this.OnFinishedSynch(EventArgs.Empty); }