public void Ads() { Advertisement.AddListener(this); if (Ready) { Advertisement.Show(myPlacementId); } else { pressed = true; PanelWait.SetActive(true); timeWait = Time.time; } }
//=====================obsługa wielowątkowości=========================================== private void ThreadOCR1() { while (ProgramWork) { WorkThreadOCR1.Priority = ThreadPriority.Lowest; while (OCRWork1) { Invoke(new Action(() => { PanelWait.Show(); })); WorkThreadOCR1.Priority = ThreadPriority.Highest; foreach (string file in FileList) { _process = new Klasy.Process(); _process.InsertDate(file); } OCRWork1 = false; Invoke(new Action(() => { PanelWait.Hide(); })); } } }
void CheckPanelWait() { if (pressed) { if (Ready) { pressed = false; Advertisement.Show(myPlacementId); PanelWait.SetActive(false); this.gameObject.SetActive(false); canvas.SetActive(true); } if (Time.time - timeWait > 10) { pressed = false; PanelWait.SetActive(false); PanelCanceled.SetActive(true); } } }
private void button1_Click(object sender, EventArgs e) { lblAnalyzing.Text = ""; PrintStatus("Start analyzing..."); PanelFolderSync.Visible = false; checkGreen1.Visible = false; checkGreen2.Visible = false; PanelMatchingFolders.Visible = false; btnNextStep.Visible = false; PanelWait.Visible = true; Refresh(); PanelWait.Refresh(); var listAdd = new List <ListView>(); var lblTotal = new List <Label>(); var dir = new List <string>(); var folders = new List <List <Folder> >(); //target folders var missing = new List <string>(); //missing folders Folder folder; var f = 0; //incrm for list of target folders var i = 0; //incrm for list of folder paths found var m = 0; var s = 0; var total = 0; var countdown = 0; var missingCount = 0; var changedCount = 0; var matches = false; var findchanges = checkChangedFolders.Checked; var path = ""; var matchpath = ""; List <Folder> paths; DirectoryInfo dirInfo; DirectoryInfo[] dirList; ListViewItem lvItem; dir.Add(textBox1.Text); dir.Add(textBox2.Text); folders.Add(new List <Folder>()); //sfolder paths folders.Add(new List <Folder>()); //folder paths folders[0].Add(NewFolder(dir[0], -1)); folders[1].Add(NewFolder(dir[1], -1)); listAdd.Add(ListAdd1); listAdd.Add(ListAdd2); lblTotal.Add(lblTotal1); lblTotal.Add(lblTotal2); foreach (var list in listAdd) { list.Items.Clear(); } //get list of folders & sub folders for both directories while (f < folders.Count) { //get a list of folders lblCurrentTarget.Text = folders[f][0].name; i = 0; while (i < folders[f].Count) { if (i == 0) { path = dir[f]; } else { path = GetPath(folders[f], i); } if (!Directory.Exists(path)) { MessageBox.Show("Directory '" + path + "' does not exist."); return; } //add list of sub-folders dirInfo = new DirectoryInfo(path); try { dirList = dirInfo.GetDirectories(); foreach (DirectoryInfo info in dirList) { folder = new Folder(); folder.name = info.Name; if (findchanges == true) { //only get folder size if checking filesize changes while matching foreach (var file in info.EnumerateFiles()) { folder.size += file.Length / 1024; } } folder.parent = i; folders[f].Add(folder); } total += dirList.Length; lblTotal[f].Text = (folders[f].Count - 1).ToString(); lblTargetFolders.Text = lblTotal[f].Text; lblTotalFolders.Text = total.ToString(); PanelWait.Refresh(); } catch (Exception ex) { } i++; } PrintStatus(dir[f] + " contains " + lblTotal[f].Text + " sub-folders"); PanelWait.Refresh(); f++; } checkGreen1.Visible = true; PanelMatchingFolders.Visible = true; ProgressMatching.Visible = true; ProgressMatching.Maximum = total; ProgressMatching.Value = 0; lblMatchesLeft.Text = total.ToString(); Refresh(); //find missing folders f = 0; countdown = total; while (f < folders.Count) { //loop through each target folder missingCount = 0; changedCount = 0; for (i = 1; i < folders[f].Count; i++) { //loop through all subfolders in selected target folder paths = FolderPath(folders[f], i); for (var x = 0; x < folders.Count; x++) { //loop through target folders (except for selected folder) if (x != f) { //match path with target folder m = 0; matches = true; for (var y = 1; y < paths.Count; y++) { //go through folder paths to match with target s = folders[x].FindIndex(c => c.parent == m && c.name == paths[y].name); if (s > 0) { m = s; //path matches so far } else { //path part doesn't exist matches = false; break; } } if (matches == false) { //folder doesn't exist path = GetPath(folders[f], i); if (missing.FindIndex(c => path.IndexOf(c) == 0) < 0) { lvItem = new ListViewItem(); lvItem.Text = GetPath(folders[f], i); listAdd[x].Items.Add(lvItem); missing.Add(path); missingCount++; } } else { //folder exists, now match filesize if (findchanges == true && f == 0) { if (folders[x][m].size != folders[f][i].size) { //find changed files path = GetPath(folders[f], i); matchpath = GetPath(folders[x], m); lvItem = new ListViewItem(); lvItem.Text = path; ListChangedFiles.Items.Add(lvItem); changedCount++; } } } } } //count down matches left countdown--; lblMatchesLeft.Text = countdown.ToString(); if (ProgressMatching.Value < ProgressMatching.Maximum) { ProgressMatching.Value += 1; } PanelWait.Refresh(); } PrintStatus("Found " + missingCount.ToString() + " missing folder(s) " + (findchanges == true && f == 0 ? "and " + changedCount.ToString() + " changed folder(s)" : "") + " within '" + dir[f] + "'."); f++; } checkGreen2.Visible = true; btnNextStep.Visible = true; PrintStatus("Done Analyzing Folders! Continue onto the next step..."); }