private void uploadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog OFDialog = new OpenFileDialog(); int size = -1; DialogResult result = OFDialog.ShowDialog(); // Show the dialog. OFDialog.DefaultExt = BellConstants.BellScheduleFileExtention; if (result == DialogResult.OK) // Test result. { string file = OFDialog.FileName; BellManager bellManager = new BellManager(); bellManager.UploadFile(file); if (BellConstants.IsSuccess) { MessageBox.Show("Upload file successfully."); } else if (!BellConstants.IsSuccess) { if (string.IsNullOrEmpty(BellConstants.ErrorMessage)) { MessageBox.Show("file is not uploaded due to some unknown reason, please try again."); } else { MessageBox.Show(BellConstants.ErrorMessage); } } } }
static void Main(string[] args) { //AppDomain.CurrentDomain.AssemblyResolve += (sender, args1) => { // String resourceName = "BellScheduler." + // new AssemblyName(args1.Name).Name + ".dll"; // using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) // { // Console.WriteLine("testing"); // Byte[] assemblyData = new Byte[stream.Length]; // Console.WriteLine("testing"); // stream.Read(assemblyData, 0, assemblyData.Length); // return Assembly.Load(assemblyData); // } //}; AppDomain.CurrentDomain.AssemblyResolve += AssembyResolver; Logger.Initialize(); AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper; if (args.Length != 0) // Console { // Run as console code BellManager bellManager = new BellManager(); bellManager.HandleConsoleRequest(args); } else { // Run as windows code FreeConsole(); //if (Environment.OSVersion.Version.Major == 6) //SetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new BellForm()); } }