How can i calculate the percentages and update the progressBar in the splash screen form ?
I created a splash screen form:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
namespace GetHardwareInfo
public partial class SplashScreen : Form
public SplashScreen()
InitializeComponent();
private Mutex mutex = new Mutex();
public void SyncedClose()
mutex.WaitOne();
this.Close();
mutex.ReleaseMutex();
public void UpdateProgressBar(int percentage)
if (this.InvokeRequired)
mutex.WaitOne();
if (!IsDisposed)
this.BeginInvoke(new Action<int>(UpdateProgresPRV), percentage);
mutex.ReleaseMutex();
else
UpdateProgresPRV(percentage);
private void UpdateProgresPRV(int per)
if (progressBar1.IsDisposed) return;
progressBar1.Value = per;
private void SplashScreen_Load(object sender, EventArgs e)
The SplashScreen form have in the designer image and on the image a progressBar1.
Then in form1 i did in the top:
List<string> WmiClassesKeys = new List<string>();
IEnumerable<Control> controls;
string comboBoxesNames;
SplashScreen splash = new SplashScreen();
And in the constructor:
controls = LoopOverControls.GetAll(this, typeof(ComboBox));
string[] lines = File.ReadAllLines(@"c:\wmiclasses\wmiclasses1.txt");
foreach (string line in lines)
foreach (ComboBox comboBox in controls.OfType<ComboBox>())
if (line.StartsWith("ComboBox"))
comboBoxesNames = line.Substring(14);
else
if (line.StartsWith("Classes"))
if (comboBox.Name == comboBoxesNames)
comboBox.Items.Add(line.Substring(14));
foreach (ComboBox comboBox in controls.OfType<ComboBox>())
comboBox.SelectedIndex = 0;
The method GetAll is to loop over specific controls:
public static IEnumerable<Control> GetAll(Control control, Type type)
var controls = control.Controls.Cast<Control>();
return controls.SelectMany(ctrl => GetAll(ctrl, type))
.Concat(controls)
.Where(c => c.GetType() == type);
When i'm running the program it's taking some time to make the foreach loops in this time i need to show the SplashScreen and update the progressBar untill the foreach loops over.
Don't use Application.Doevents. It's not required and can cause problems.
I do not really grasp the approach you are taking here. So let me make a different suggestion:
SplashScreen:
using System;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
public partial class SplashScreen : Form
private static SplashScreen DefaultInstance;
public SplashScreen()
InitializeComponent();
public static void ShowDefaultInstance()
Thread t = new Thread(TMain);
t.Name = "SplashUI";
t.Start();
public static void CloseDefaultInstance()
DefaultInstance.Invoke(new Action(DefaultInstance.Close));
private static void TMain()
DefaultInstance = new SplashScreen();
DefaultInstance.Show();
Application.Run(DefaultInstance);
public static void UpdateProgress(int Progress)
if (DefaultInstance.InvokeRequired)
DefaultInstance.Invoke(new Action<int>(UpdateProgress), Progress);
else
DefaultInstance.progressBar1.Value = Progress;
Form1:
using System.Windows.Forms;
namespace WindowsFormsApplication1
public partial class Form1 : Form
public Form1()
InitializeComponent();
SplashScreen.ShowDefaultInstance();
for (int i = 1; i<=100; i++)
System.Threading.Thread.Sleep(20); // simulates work
SplashScreen.UpdateProgress(i);
SplashScreen.CloseDefaultInstance();
EDIT: Please note that the progressbar itself is being animated by the system, so it might look slower than it really is. To workaround this, there are solutions available (you'll find them) that first set the value one higher than necessary, then
back to the actual value.
Edit #2: You do need a different thread, otherwise the UI is locked while the loop is running in your Form1's constructor.
Armin
Similar Messages
-
How can i calculate manually fact and dimensional table ralations?
hi friends,
how can i know the information dimension table >15 of fact table, how can i calculate thses percentages manually?
regards
suneel.hi Suneel,
it's another topic, to improve query performance, we evaluate if aggregate help or not, to justify we use bw statistic or ST03N, where summarization ratio is > 10;
the summarization ratio = number of record read from database / number of record transferred,
we need also the other parameter 'percentage of db time', time spent on database / total query runtime.
check
SAP BW Query Performance Tuning with Aggregates
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3f66ba90-0201-0010-ac8d-b61d8fd9abe9
hope this helps. -
How can I listen to itunes and play a game at the same time on my ipad 4?
How can I listen to itunes and play a game at the same time on my ipad 4? This means I need to run 2 apps at the same time itunes and my game. The game has its own sound control so I can turn off its sound while i listen to itunes tracks. But I don't know how to set it up so the ipad does both.
Anytime you open an app that has a persistant sound stream - a movie, a podcast, some games - it will overide the music app's stream. nothiong you can do to change it.
-
How can you listen to music and play a game at the same time?
How can you listen to music and play a game at the same time?
I am playing music, by starting the Crash Baandicoot Nitro Kart 3D game it shuts off the music playing. Is there a way around this?
It seems like this should be possible.
Message was edited by: RuthlessVengeance
Message was edited by: RuthlessVengeanceSelect the music play list you want to listen to and start it playing. Go back to the home screen and start the app you want to use, music will stop. Press the home button two time quickly and it will bring up a simple control for controling the music. This works for me with all of the apps I have purchased including games. Just a note you can pull up the same music control if the iPod is a sleep and locked by pressing the button three times quickly.
Mike -
How can i download photoshop elements and premiere elements 10 using the serial number not the cd?
I tried downloading the trial elements 11 and entering the serial number but it wouldn't work, i cannot find a trial for elements 10.
Thankshttp://prodesigntools.com/photoshop-elements-10-direct-download-links-pse-premiere-pre.htm l
Follow the instructions on that page carefully before you click the download link. -
I have an ipod touch 3rd generation and a new computer. How can i add all purchased and non purchased songs into the new computers itune library? The old computer is dead! Will not even turn on. Help!!!!!!!! I'm going crazy.
Look into downloading some type of iRip software! Allows you to transfer music from iPod to iTunes.
-
How can I save my media and photo data before restoring? My phone screen is blocked on "plug to itunes", thanks
Once the Device is asking to be Restored with iTunes... it is too late to save anything...
See Here > http://support.apple.com/kb/HT1808
You may need to try this More than Once... Be sure to Follow ALL the Steps...
After you have Recovered your Device...
Re-Sync your Content or Restore from the most recent Backup...
Restore from Backup > http://support.apple.com/kb/ht1766 -
How can I get my iPod to update when it says the server cannot be connected?
Whenever I try to update my iPod it says, "The iPod software update server could not be contacted. Make sure your network settings are correct and your network connection is active, or try again later." It does this every time. How can I get it to update? Any help is much appreciated, thanks!
Update Server
Try:
- Powering off and then back on your router.
- iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server
- Change the DNS to either Google's or Open DNS servers
Public DNS — Google Developers
OpenDNS IP Addresses
- For one user uninstalling/reinstalling iTunes resolved the problem
- Try on another computer/network
- Wait if it is an Apple problem -
How can I repackage Adobe Air and updates to it in PKG format for deployment to Macs?
We have about 200 Macs in our organization and do push deployments to them using JAMF Casper (which requires that installers be in PKG format). I am periodically asked by our security department to apply updates to Adobe Air for security reasons. So my question is - how can I repackage the AIR installer and updates to PKG format so I can deploy them from Casper?
I've looked at Adobe Application Manager Enterprise Edition - and it doesn't even recognize the AIR installer as an Adobe installer.
Any info you can provide would be much appreciated.
Bob Reed
AARPYou might be able to do this by creating a bootstrapping application to launch the installer. Here's some documentation on distributing AIR in enterprise environments along with a link to our distribution agreement.
http://www.adobe.com/products/air/runtime-distribution1.html
http://help.adobe.com/en_US/air/redist/WS485a42d56cd19641-70d979a8124ef20a34b-8000.html -
How can i calculate my planned and actual labour cost with fields from tab
Hi,
i want to calculate my planned labour cost for all operations in my production order. how can i retrive form the tables and how the actual planned cost gets calcualted. where can i see the overhed calcualtion of the material and labour.
please suggest.
regards
madanHi,
Planned cost is nothing but the Standard values which you give for each opearation in the routing.
The actual values from the confirmation for production order
The following table and fields you can get the values
PLPO, AFVC - look for setup time,labor time,machine time fields
AFRU - look for the required fields setup,labor,mcahine time etc
Thanks and regards
Murugesa -
I have updated to the supposed newest version for my touch.
But it still will not sync and update my Strange Rain app.
How can I get this back?According to the product description the latest version of this app requires ios 4.3 or later.
You would have to use your copy of the older version. -
How can I get mouse pressed and mouse released positions on the desktop whi
Hello All,
I am generating a Frame using Swing API. My requirement is I need to capture the mouse pressed and mouse released positions, whenever user drags the mouse on desktop region (i.e. outside of the Frame). I require these points to find the rectangle region user has generated starting from mouse pressed to mouse released position. I need to pass that rectangle to Robot class in order to capture that desktop region.
Can anybody help me out how can I achieve this using java on MAC, Linux and Windows platforms?
Thanks in advance.
Regards,
VPKVLVPKVL wrote:
DarrylBurke wrote:
Can't be done in Java.I don't think that there is something which can't be done using java. When searched over net, found few applications which are using java for implementing this feature but not free, asking for license fee. I checked by downloading the demo version.
Just want to know the hint how it can be achieved so that I can move further on that lines.
Your thoughts ?They use JNI with the OS API. -
I wanted to back up my phone as have bought a new 6 so went to settings I cloud then back up but it wouldn't turn on . I went in to view the backups and it wasn't done since September last year , then I clicked on my phone detail and made a mistake of pressing delete back up . the phone now isn't listed just my ipad which is linked to the phone . So how can I back this phone up please and perhaps restore the phone detail in backups
Your title asks "How do I get my iPhone information back on my (iPhone)?
You also said "I have yet to back it up." Therefore, all your information that had been on your iPhone is now gone.
Your iPhone has (and will continue to) been refreshed from iTunes. -
I only recently learned/read about SharePoint's JavaScript Client Object Model. I'm reading online trying to figure this out but not having much luck.
On newform.aspx (and dispform.aspx) I want to get the
current list,
the last item created, and it's attachments. I now the CAML query I need to get the last item created, but first I have to get the current list and I am not sure how to do that.
I tried this but it returns null:
SP.ListOperation.Selection.getSelectedList()Hi,
For your issue, you can get the list name from the new form url and retrieve the list last created item :
https://social.msdn.microsoft.com/Forums/office/en-US/b90a64f8-2255-41b0-9d91-78335dd4a4cf/get-list-name-from-list-url-through-javascript?forum=sharepointdevelopmentprevious
http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
Best Regards,
Eric
Eric Tao
TechNet Community Support -
I news identici row and column in numbers over and left as in Excel. How can I do?
Hi Roanto,
Welcome to Apple Support Communities.
We're all feeling out way around in this newly designed environment, but I think I've discovered that the iWork applications for iPad are still in a community separate from those for the Mac versions of the iWork appplications.
Seeing as you question is about Numbers for iPad, you might find it better served in the https://discussions.apple.com/community/ipad/iwork_for_ipad>Numbers for iPad Community area. The link will take you to the front page of that community.
Regards,
Barry
PS: You might also consider rewriting your question. I'm having some difficulty deternmining exactly what you want to accomplish.
B
Maybe you are looking for
-
I think Oracle JDBC Thin driver has many problems
I developed application & applet using Oracle JDBC/Thin Drivers for use with JDK 1.2 and SUN JDK 1.2.2. In my computer, application runs correctly. On the other hand, applet isn't run and throws error "Cannot find class java/util/Map" on connecting t
-
Oracle 9i release 2 link shows machine code
I get gobbldy gook when I go to http://otn.oracle.com/documentation/oracle9i.html Its now 12:30 PM April 9, 2003
-
Hello, Somehow, a black box has showed up on my screen, it tells me things that I already know, like where I am. I also has a nasty habit of skipping a outling of a box around the screen I DO NOT CARE WHAT IT IS I JUST WANT IT GONE. Can somebody hw
-
When I press the top row of buttons it types a q!
When I press the Appliction button, Trackball, !, 1, 2 , 3 and . buttons a Q is typed! I've tried taking the battery out and re-installing the software! I've also taken it apart incase there was dust or dirt under the buttons! Please help!
-
I just bought a new mac book pro. it has just been 2 days when I started getting a message saying that I need to restart my computer. My computer will just hang (and a dim light on the screen will appear with the message). The message is in the middl