Exemple #1
0
        /// <summary>
        /// Make zip file from with file in a specified path
        /// </summary>
        /// <param name="sourcePath">Folder to save</param>
        public static void makeZipSite(string sourcePath, IWin32Window own)
        {
            var saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "Fichier Zip|*zip";
            saveFileDialog1.Title  = "Sauvegarde";
            saveFileDialog1.ShowDialog();

            if (saveFileDialog1.FileName != "")
            {
                if (Path.GetExtension(saveFileDialog1.FileName) == "")
                {
                    saveFileDialog1.FileName += ".zip";
                }

                try
                {
                    var _wf = new WaitingForm(makeZipSiteWorker)
                    {
                        Text        = TabloidWizard.Properties.Resources.Saving,
                        progressBar = { Style = ProgressBarStyle.Marquee }
                    };

                    _wf.Wr.RunWorkerAsync(new string[] { saveFileDialog1.FileName, sourcePath });
                    _wf.ShowDialog();
                }
                catch (Exception ex)
                {
                    MetroMessageBox.Show(own, Properties.Resources.SavingError + ex, Properties.Resources.Erreur, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #2
0
        public static bool Attempt(TcpClient client, string ip, int port)
        {
            bool closed = false;

            WaitingForm.BeginWait("Connecting to host...", ev =>
            {
                while (!client.Connected)
                {
                    try
                    {
                        client.Connect(ip, port);
                    }
                    catch (SocketException)
                    {
                        if (closed || !ConnectionFailure())
                        {
                            break;
                        }
                    }
                }
            }, () =>
            {
                closed = true;
                client.Close();
                return(true);
            });

            if (closed || !client.Connected)
            {
                return(false);
            }

            return(true);
        }
Exemple #3
0
 public override void Finish()
 {
     base.Finish();
     WaitingForm.Hide();
     ErrorForm.Hide();
     MessageBoxForm.Hide();
 }
Exemple #4
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var lstModInfos = _gridUiHelper.ParseAllTables();

            bool success;

            try
            {
                // start the process
                WaitingForm.ShowForm(this);

                success = TranslationManager.SaveGridData(_configHelper.GetLastPathOfDataFiles(), lstModInfos);

                WaitingForm.CloseForm();
            }
            catch (Exception exception)
            {
                Logger.Log(exception.Message);
                throw;
            }

            if (success)
            {
                Logger.Log(Resources.GridUI_saveToolStripMenuItem_Click_Successfully_saved);
            }
        }
Exemple #5
0
 public static void startWaitingForm(WaitingForm waitForm)
 {
     new Thread((ThreadStart)delegate
     {
         Application.Run(waitForm);
     }).Start();
 }
Exemple #6
0
        public static void LoadNews()
        {
            string savePath = $"{Helper.directory}temp/news.txt";

            string news = null;

            WaitingForm.BeginWait("Downloading notices...", ev =>
            {
                try
                {
                    using (var wc = new WebClient())
                    {
                        wc.DownloadFile($"https://github.com/CosmoleonGit/RevisionHub/raw/master/News.rtf", savePath);
                    }

                    news = File.ReadAllText(savePath);

                    File.Delete(savePath);
                }
                catch (WebException ex)
                {
                    Helper.Error("Failed to load pack data.", ex.Message);
                }
            });

            if (news != null)
            {
                var newsForm = new NewsForm(news);
                newsForm.Show();
            }
        }
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Multiselect = true;
            dlg.Filter = "Fichiers png (*.png)|*.png";
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitingForm form = new WaitingForm();
                form.Show();
                Application.DoEvents();

                for (int i = 0; i < dlg.FileNames.Count(); i++)
                {
                    using (XNAUtils utils = new XNAUtils())
                    {
                        byte[] data = File.ReadAllBytes(dlg.FileNames[i]);
                        Image image = byteArrayToImage(data);
                        Battler battler = new Battler(dlg.SafeFileNames[i], utils.ConvertToTexture(image));
                        LIST_Battlers.Items.Add(battler);
                    }
                }

                form.Close();
            }
        }
Exemple #8
0
 /// <summary>
 /// 关闭画面
 /// </summary>
 public static void CloseForm(WaitingForm window)
 {
     if (window != null)
     {
         window.Close();
         Application.Current.MainWindow.Activate();
     }
 }
Exemple #9
0
 private void CloseCallBack(WaitingForm form)
 {
     Application.Current.Dispatcher.Invoke((Action)(() =>
     {
         form.Close();
         Application.Current.MainWindow.Activate();
     }));
 }
		public MainForm(IList<IProcessManager> processManagers, VersionsManager phpVersions, WaitingForm waitingForm)
		{
			this.processManagers = processManagers;
			this.phpVersions = phpVersions;
			this.waitingForm = waitingForm;

			this.InitializeComponent();
			this.InitializeMainMenu();
		}
Exemple #11
0
        static void Do(bool quiet = false)
        {
            string savePath = $"{Helper.directory}temp/info.txt";

            string newVer = null;

            WaitingForm.BeginWait("Checking for updates...", ev =>
            {
                try
                {
                    using (var wc = new WebClient())
                    {
                        wc.DownloadFile($"https://github.com/CosmoleonGit/RevisionHub/raw/master/info.txt", savePath);
                    }

                    using (var sr = new StreamReader(savePath))
                    {
                        newVer = sr.ReadLine();
                    }
                }
                catch (WebException ex)
                {
                    if (!quiet)
                    {
                        Helper.Error("Failed to load pack data.", ex.Message);
                    }
                } finally
                {
                    File.Delete(savePath);
                }
            });

            if (newVer != null)
            {
                var ver = Assembly.GetEntryAssembly().GetName().Version;

                string curVer = Application.ProductVersion.Substring(0, Application.ProductVersion.LastIndexOf('.'));

                if (curVer != newVer)
                {
                    if (MsgBox.ShowWait($"There is a new version of Revision Hub (v{newVer}).\n\nWould you like to go to the download page?",
                                        "Check for Updates",
                                        MsgBox.Options.yesNo,
                                        MsgBox.MsgIcon.INFO) == "Yes")
                    {
                        Process.Start("https://github.com/CosmoleonGit/RevisionHub/releases/tag/" + newVer);
                    }
                }
                else if (!quiet)
                {
                    MsgBox.ShowWait("You are running the latest version of Revision Hub.",
                                    "Check for Updates",
                                    null,
                                    MsgBox.MsgIcon.TICK);
                }
            }
        }
Exemple #12
0
 private void btnImport_Click(object sender, EventArgs e) {
   var waitingForm = new WaitingForm();
   waitingForm.Show();
   var worker = new BackgroundWorker();
   worker.DoWork += (o, args) => this.LogRunningOperation(o, args);
   worker.OnWorkComplete += (o, args) => {
     waitingForm.Close();
     worker.Dispose();
   };
   worker.RunWorkerAsync();
Exemple #13
0
        private static string m_RunPath = ""; //���ó�������(���)·��

        #endregion Fields

        #region Constructors

        public Constant()
        {
            //
            // TODO: �ڴ˴���ӹ��캯���߼�
            //
            WaitingForm = new WaitingForm();
            if (m_RunPath.Trim().Length == 0)
            {
                m_RunPath = System.Environment.CurrentDirectory;
            }
        }
 //更新等待条界面
 public void Waiting(string caption, string description, object ctrl)
 {
     if (WaitTask == null || WaitingForm == null)
     {
         return;
     }
     if (!WaitIdentities.ContainsKey(ctrl))
     {
         WaitIdentities.Add(ctrl, null);
     }
     WaitingForm?.Waiting(caption, description, ctrl);
 }
Exemple #15
0
        private void StartParsingProcess(string folderName)
        {
            try
            {
                // start the process
                WaitingForm.ShowForm(this);

                var tc = TranslationManager.GetGridData(new DirectoryInfo(folderName));

                if (tc == null)
                {
                    WaitingForm.CloseForm();
                    MessageBox.Show(Resources.GridUI_No_stringtable_xml_files_found);
                    return;
                }

                SuspendLayout();
                tabControl1.Hide();

                _gridUiHelper = new GridUiHelper(this);
                _gridUiHelper.Cleanup();
                _gridUiHelper.ShowData(tc);

                ResumeLayout();
                tabControl1.Show();
                WaitingForm.CloseForm();

                saveToolStripMenuItem.Enabled        = true;
                findToolStripMenuItem.Enabled        = true;
                addLanguageToolStripMenuItem.Enabled = true;
                statisticsToolStripMenuItem.Enabled  = true;

                _configHelper.SetLastPathOfDataFiles(new DirectoryInfo(folderName));

                _stringtablesLoaded = true;
            }
            catch (AggregateException ae)
            {
                foreach (var ex in ae.Flatten().InnerExceptions)
                {
                    if (ex is DuplicateKeyException duplicateKeyException)
                    {
                        MessageBox.Show(string.Format(Resources.GridUI_Duplicate_key_found, duplicateKeyException.KeyName, duplicateKeyException.FileName, duplicateKeyException.EntryName), Resources.GridUI_Duplicate_key_found_title);
                    }

                    if (ex is GenericXmlException xmlException)
                    {
                        MessageBox.Show(string.Format(Resources.GridUI_Generic_xml_exception, xmlException.KeyName, xmlException.FileName, xmlException.EntryName), Resources.GridUI_Generic_xml_exception_title);
                    }
                }
            }
        }
 public static void Show(string caption)
 {
     if (instance == null)
     {
         instance = new WaitingForm();
     }
     iconCount = 0;
     instance.ImgPrinter.Image = instance.PrintImgList.Images[iconCount++];
     instance.Text = caption;
     instance.Show();
     instance.Refresh();
     instance.IconChangeTimer.Start();
 }
Exemple #17
0
 /// <summary>
 /// Zeigt einen Form, dass gearbeitet wird
 /// </summary>
 public static void Wait()
 {
     try
     {
         var form = new WaitingForm();
         form.ShowDialog();
     }
     catch
     {
     }
     finally
     {
     }
 }
Exemple #18
0
 public void Show()
 {
     try
     {
         arg = new ThreadWaiting();
         arg.theForm = theForm;
         ThreadStart ts = new ThreadStart(arg.Run);
         theThread = new Thread(ts);
         theThread.Name = "Waiting";
         theThread.Start();
         theForm = arg.theForm;
     }
     catch { }
 }
Exemple #19
0
        public static void ShowPacks()
        {
            Directory.CreateDirectory(Helper.directory + "temp");

            bool worked = false;

            WaitingForm.BeginWait("Downloading pack data...", ev =>
            {
                try
                {
                    using (var wc = new WebClient())
                    {
                        wc.DownloadFile($"https://github.com/CosmoleonGit/RevisionHub/raw/master/Packs/_List.txt", savePath);
                    }

                    worked = true;
                }
                catch (Exception ex)
                {
                    Helper.Error("Failed to load pack data.", ex.Message);
                }
            });

            if (worked)
            {
                var packList  = new List <Pack>();
                var lineQueue = new Queue <string>();

                string[] lines = File.ReadAllLines(savePath);

                File.Delete(savePath);

                foreach (string line in Helper.SplitByLine(lines, "-"))
                {
                    lineQueue.Enqueue(line);
                }

                while (lineQueue.Count > 0)
                {
                    string name = lineQueue.Dequeue();
                    string desc = lineQueue.Dequeue();

                    packList.Add(new Pack(name, desc));
                }

                var packsForm = new PacksForm(packList.ToArray());
                packsForm.Show();
            }
        }
Exemple #20
0
 public void CompleteRecording()
 {
     if (recording)
     {
         WaitingForm wait = new WaitingForm(); //This should really be in its own thread to avoid hanging the gui.
         wait.Show();
         wait.Refresh();
         frame--;
         outputBlobWriter.Close();
         outputBlobWriter = null;
         BinaryReader outputBlobReader = new BinaryReader(File.OpenRead(outputPath));
         byte[] header = new byte[54];
         BinaryWriter headerBuilder = new BinaryWriter(new MemoryStream(header));
         int bmpSize = width * height * 3;
         headerBuilder.Write('B');//BMP Header
         headerBuilder.Write('M');
         headerBuilder.Write((uint)(54 + bmpSize));
         headerBuilder.Write((ushort)(0));
         headerBuilder.Write((ushort)(0));
         headerBuilder.Write((uint)(54));
         headerBuilder.Write((uint)(40));//DIB Header
         headerBuilder.Write((int)(width));
         headerBuilder.Write((int)(height));
         headerBuilder.Write((ushort)(1));
         headerBuilder.Write((ushort)(24));
         headerBuilder.Write((int)(0));
         headerBuilder.Write((uint)(bmpSize));
         headerBuilder.Write((int)(2835));//Random values for pixels/meter that I stole from a sample, hopefully they are reasonable.
         headerBuilder.Write((int)(2835));
         headerBuilder.Write((int)(0));
         headerBuilder.Write((int)(0));
         headerBuilder.Close();
         string frameStringLength = frame.ToString().Length.ToString();
         string framePath = Path.ChangeExtension(outputPath, null);
         for (int i = 0; i <= frame; i++)
         {
             FileStream frameFile = File.Create(framePath + "-" + i.ToString("D" + frameStringLength) + ".bmp");
             BinaryWriter frameWriter = new BinaryWriter(frameFile);
             frameWriter.Write(header);
             frameWriter.Write(outputBlobReader.ReadBytes(bmpSize));
             frameWriter.Close();
             wait.ReportProgress((int)((i / (frame * 1.0)) * 100));
         }
         outputBlobReader.Close();
         File.Delete(outputPath);
         recording = false;
         wait.Close();
     }
 }
Exemple #21
0
		private static void Main()
		{
			try
			{
				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);

				var processManagers = new List<IProcessManager>();

				var exePath = System.Reflection.Assembly.GetEntryAssembly().Location;
				var configPath = exePath.Substring(0, exePath.Length - 3) + "json";
				var config = new ConfigLoader().Load(configPath);

				config.Services?.ForEach(service =>
				{
					processManagers.Add(new ServiceManager(service.Name, service.Label));
				});

				config.Executables?.ForEach(exe =>
				{
					List<ProcessManager> processes;

					if (exe.Multiple == null)
					{
						processes = new List<ProcessManager>() {
							new ProcessManager(exe.Path, exe.Args, exe.Label)
						};
					}
					else
					{
						processes = exe.Multiple
							.Select(child => new ProcessManager(child.Path, child.Args, child.Label, exe.Label))
							.ToList();
					}

					processes.ForEach(process => processManagers.Add(process));
					injectRunningProcesses(processes, processes[0].FileName);
				});

				var phpVersions = new VersionsManager(config.PhpDir, processManagers);
				var waitingForm = new WaitingForm();
				new MainForm(processManagers, phpVersions, waitingForm);
				Application.Run();
			}
			catch (Exception ex)
			{
				MessageBox.Show("Something went wrong!\n" + ex.Message, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}
Exemple #22
0
        private void ShowThread()
        {
            WaitingForm waitingform = new WaitingForm();

            waitingform.Text  = this.formCaption;
            waitingform.Label = this.formText;

            if (this.parentCenter != null)
            {
                waitingform.StartPosition = FormStartPosition.Manual;
                waitingform.Location      = new Point(parentCenter.X - waitingform.Width / 2, parentCenter.Y - waitingform.Height / 2);
            }
            ;

            waitingform.Show();
            waitingform.Refresh();

            while (showForm)
            {
                Application.DoEvents();

                if (waitingform.Text != this.formCaption)
                {
                    waitingform.Text = this.formCaption;
                }
                if (waitingform.Label != this.formText)
                {
                    waitingform.Label = this.formText;
                }
                waitingform.Refresh();

                if (isModal && ApplicationIsActive())
                {
                    waitingform.BringToFront();
                    waitingform.Activate();
                    waitingform.Focus();
                    waitingform.Refresh();
                }
                ;

                System.Threading.Thread.Sleep(50);
            }
            ;
            waitingform.Close();
            waitingform.Dispose();
            waitingform = null;
        }
Exemple #23
0
        /// <summary>
        /// 检索类型的提交
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="reqModel"></param>
        /// <returns></returns>
        public void PostSearch <T>(string url, object reqModel, AfterResponseDelegate afterResponseCallBack)
        {
            var form = new WaitingForm();

            form.Show();

            var thread = new Thread(new ParameterizedThreadStart(PrivatePostSearch <T>));
            var items  = new object[3];

            items[0] = url;
            items[1] = reqModel;
            items[2] = form;
            thread.Start(items);

            _CloseWaiting  = CloseCallBack;
            _AfterResponse = afterResponseCallBack;
        }
Exemple #24
0
        /// <summary>
        /// 检索类型的提交
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="reqModel"></param>
        /// <returns></returns>
        public void GetSearch <T>(string url, AfterResponseDelegate afterResponseCallBack, Dictionary <string, string> paramDic = null)
        {
            var form = new WaitingForm();

            form.Show();

            var thread = new Thread(new ParameterizedThreadStart(PrivateGetSearch <T>));
            var items  = new object[3];

            items[0] = url;
            items[1] = null;
            items[2] = form;
            thread.Start(items);

            _CloseWaiting  = CloseCallBack;
            _AfterResponse = afterResponseCallBack;
        }
Exemple #25
0
 private void btImportGerber_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
     ofd.Filter = "Gerber file (*.gbr;*.gbx) | *.gbr;*.gbx; | All files (*.*)|*.*";
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         WaitingForm wait = new WaitingForm("Rendering...");
         Thread      st   = new Thread(() =>
         {
             mModel.GetNewGerber(ofd.FileName);
             UpdateListImportedFile();
             ShowAllLayerImb(ActionMode.Render);
             wait.KillMe = true;
         });
         st.Start();
         wait.ShowDialog();
     }
 }
Exemple #26
0
        protected void SendApiCommand(ApiCommandBase command,
                                      bool blockUI = true,
                                      Action <ApiResponse> callback = null,
                                      bool showSuccessPopUp         = false)
        {
            Action <CommandBase> finishHandler = null;

            finishHandler = delegate(CommandBase targetCommand)
            {
                targetCommand.CommandFinished -= finishHandler;
                if (blockUI)
                {
                    WaitingForm.Hide(targetCommand);
                }
                if (command.Response.IsSuccessful)
                {
                    if (showSuccessPopUp)
                    {
                        Controller.SoundManager.Play(MarketSoundType.SuccessNotification);
                        MessageBoxForm.Show("Success", "Request sent");
                    }
                }
                else if (command.Response.ErrorCode == ErrorCode.DMarketAccountNotVerified)
                {
                    Controller.SoundManager.Play(MarketSoundType.ErrorNotification);
                    MessageBoxForm.Show("Verify your account", "Your DMarket account is not verified so you can't perform this action. Please verify your account via email", "OK"); //TODO: refactor this: add catalog and enum of messages for message box
                }
                else
                {
                    Controller.SoundManager.Play(MarketSoundType.ErrorNotification);
                    ErrorForm.Show("Error", command.Response.ErrorTxt);
                }
                callback.SafeRaise(command.Response);
            };
            command.CommandFinished += finishHandler;

            if (blockUI)
            {
                WaitingForm.Show(command);
            }

            ApplyCommand(command);
        }
Exemple #27
0
        /// <summary>
        /// 保存删除的回调函数
        /// </summary>
        /// <param name="item"></param>
        /// <param name="isCloseOnly"></param>
        private void AfterDeleteCallBack(object item, bool isCloseOnly)
        {
            var model = item as DialogModel;

            if (model._Result == MessageBoxResult.Yes)
            {
                var form = new WaitingForm();
                form.Show();

                var thread = new Thread(new ParameterizedThreadStart(PrivatePostDelete));
                var items  = new object[3];
                items[0] = this.Url;
                items[1] = this.ReqModel;
                items[2] = form;
                thread.Start(items);

                _CloseWaiting = CloseCallBack;
            }
        }
        private void ReadXLS()
        {
            if (CurrentXLSStructure == null || string.IsNullOrEmpty(CurrentXLSStructure.FileName))
            {
                return;
            }

            var waitingForm = new WaitingForm(ReadXLS)
            {
                Text        = Properties.Resources.FileAnalysis,
                progressBar = { Style = ProgressBarStyle.Marquee }
            };

            waitingForm.Wr.RunWorkerAsync(new object[] { });

            waitingForm.ShowDialog();

            cmbField.Enabled    = cmbSheet.Enabled = true;
            cmbSheet.DataSource = CurrentXLSStructure.WorkBooks;
        }
Exemple #29
0
        /// <summary>
        /// Copy tabloid engine to selected path
        /// </summary>
        /// <param name="destinationPath">destination path</param>
        static void publication(ConfigFilesCollection config, publishConfig cfg, IWin32Window own)
        {
            //var wf = new WaitingForm(wrPublication);
            //wf.sho();
            //Thread.Sleep(2000);
            try
            {
                var _wf = new WaitingForm(wrPublication)
                {
                    Text        = Properties.Resources.Publishing,
                    progressBar = { Style = ProgressBarStyle.Marquee }
                };

                _wf.Wr.RunWorkerAsync(new object[] { config, cfg, own });
                _wf.ShowDialog();
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(own, Properties.Resources.SavingError + ex, Properties.Resources.Erreur, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Multiselect = true;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitingForm form = new WaitingForm();
                form.Show();
                Application.DoEvents();

                for (int i = 0; i < dlg.FileNames.Count(); i++)
                {
                    byte[] data = File.ReadAllBytes(dlg.FileNames[i]);
                    Sound sound = new Sound() { Data = data, Name = dlg.SafeFileNames[i] };

                    SoundBundle.Sounds.Add(sound);
                    LIST_Sounds.Items.Add(sound);
                }
                form.Close();
            }
        }
Exemple #31
0
        /// <summary>
        /// 保存确认的回调函数
        /// </summary>
        /// <param name="item"></param>
        /// <param name="isCloseOnly"></param>
        private void AfterSaveCallBack(object item, bool isCloseOnly, bool comfirm)
        {
            var model = item as DialogModel;

            if (model._Result == MessageBoxResult.Yes)
            {
                if (_BeforeSave != null)
                {
                    _BeforeSave();
                }
                var form = new WaitingForm();
                form.Show();

                var thread = new Thread(new ParameterizedThreadStart(PrivatePostSaveNoComfirm));
                var items  = new object[3];
                items[0] = this.Url;
                items[1] = this.ReqModel;
                items[2] = form;
                thread.Start(items);

                _CloseWaiting = CloseCallBack;
            }
        }
Exemple #32
0
        private void btnFindTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabCalculateTable");

            string regFileName = cbxRegDoc.Text;
            string tablename = cbxTableList.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else
            {
                if ((!regFileName.Equals(preRegFileName) || !testFileName.Equals(preTestFileName)
                    || cbxTableListChanged == true))
                {
                    dataView.Rows.Clear();
                    rbTableTest.Clear();

                    WaitingForm wf = new WaitingForm();
                    HandleWaitingForm.startWaitingForm(wf);

                    string path = System.Environment.CurrentDirectory;
                    string name = regFileName;
                    name = path + "\\resources\\" + name + ".doc";

                    Document regDoc = new Document();
                    HandleDocument handleDocument = new HandleDocument();

                    
                    if (!testDocIsOpen)
                    {
                        testDocIsOpen = true;
                        testDoc = handleDocument.openDocument(testFileName, testWord);
                    }

                    regDoc = handleDocument.openDocument(name, testWord);
                    showItemInfo.Clear();
                    flagList.Clear();//清空标记合并单元格的标志
                    if (tablename != "")
                    {
                        calTables(1, regDoc, wf, tablename);
                    }
                    else
                    {
                        calTables(tableName.Length, regDoc, wf, "");
                    }
                    rbTableTest.Text = "请选择关键字";
                    KeyWord keyWord = new KeyWord();
                    //keyWord.highLightRichString(rbTableTest, testWord, testDoc, keyItemList);
                    rtbStandard.Text = keyWord.getStandardList();
                    generatekeyItemCombox();
                    
                    Object saveChanges = false;
                    object unknow = Type.Missing;

                    regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                    HandleWaitingForm.closeWaitingForm(wf);

                    plTOC.Hide();
                    plKeyWord.Hide();
                    plMultiInfo.Hide();

                    plTableTest.Show();
                    showTableTreeView();
                    hideTOCTreeView();

                    cbxTableListChanged = false;
                    preRegFileName = regFileName;
                    preTestFileName = testFileName;

                    isMultiple = false;
                    tabControl2.Show();
                    tabControlMulti.Hide();
                }
            }

        }
Exemple #33
0
        private void btnTestTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabPageTest");

            string regFileName = cbxRegDoc.Text;
            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else if (!isTextMode())
            {
                MessageBox.Show("非文本文档检测模式不支持表格匹配,请在目录检测中选择文本模式");
            }
            else
            {
                HandleTable handleTable = new HandleTable(testWord);

                string path = System.Environment.CurrentDirectory;
                string name = regFileName;
                name = path + "\\resources\\" + name + ".doc";

                Document regDoc = new Document();
                HandleDocument handleDocument = new HandleDocument();

                WaitingForm wf = new WaitingForm();
                HandleWaitingForm.startWaitingForm(wf);

                if (!testDocIsOpen)
                {
                    testDocIsOpen = true;
                    testDoc = handleDocument.openDocument(testFileName, testWord);
                }

                regDoc = handleDocument.openDocument(name, testWord);

                handleTable.contrastTablesOfDocs(regDoc, testDoc, showItemInfo, tvRegTable
                    , tvTestTable, null, null, null);

                Object saveChanges = false;
                object unknow = Type.Missing;

                regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                HandleWaitingForm.closeWaitingForm(wf);

                plTOC.Hide();
                plKeyWord.Hide();
                plMultiInfo.Hide();

                plTableTest.Show();
                showTableTreeView();
                hideTOCTreeView();

                isMultiple = false;
                tabCalculateTable.Show();
                tabControlMulti.Hide();
            }
        }
Exemple #34
0
 public static void closeWaitingForm(WaitingForm waitForm)
 {
     waitForm.Invoke((EventHandler)delegate { waitForm.Close(); });
     waitForm = null;
 }
Exemple #35
0
 // Выход игрока со стола. IsSelf - сам ли игрок вышел со стола
 public void ExitFromTable(bool IsSelf)
 {
     if (IsSelf)
         serverActions.ExitPlayerFromTable(Place);
     SetPreGameHandlers(false);
     ChangeCurrentTable(null);
     ChangeCurrentPlace(-1);
     waitingForm.Close();
     waitingForm = null;
     userForm = new MainUserForm(this);
     userForm.UpdateTables();
     userForm.Show();
 }
Exemple #36
0
 public void CreateTable(int Bet, bool PlayersVisibility, bool Chat, int MinimalLevel, bool TableVisibility,
     bool VIPOnly, bool Moderation, bool AI)
 {
     Table t = serverActions.CreateTable(this.Player.Profile.Id, Bet, PlayersVisibility, Chat, MinimalLevel, TableVisibility,
         VIPOnly, Moderation, AI);
     if (t != null)
     {
         //MessageBox.Show("Создание стола прошло успешно!");
         ChangeCurrentTable(t);
         ChangeCurrentPlace(1);
         if (userForm != null)
         {
             userForm.Close();
             userForm = null;
         }
         waitingForm = new WaitingForm(this);
         SetPreGameHandlers(true);
         waitingForm.UpdateLabels();
         waitingForm.Show();
     }
     else
     {
         MessageBox.Show("Не удалось создать игровой стол");
     }
 }
        static void Main()
        {
            Application.EnableVisualStyles();

            //Add firewall exception otherwise, will cause update image failed in windows vista

            string name = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;

            if (!Reader.Net.Firewall.AddAplication(name, "CS203 CALLBACK API DEMO"))
            {
                MessageBox.Show("Add firewall exception fail");
            }
            //First Step
            while (true)
            {
                using (NetFinderForm finder = new NetFinderForm())
                {
                    if (finder.ShowDialog() == DialogResult.OK)
                    {
                        IP = finder.ConnectIP;
                        MAC = finder.MAC;
                    }
                    else
                    {
                        return;
                    }
                }

                using (WaitingForm waiting = new WaitingForm())
                {
                    rfid.Constants.Result ret = rfid.Constants.Result.OK;
                    waiting.Show();
                    Application.DoEvents();

                    if ((ret = ReaderCE.StartupReader(IP, 0)) != rfid.Constants.Result.OK)
                    {
                        ReaderCE.ShutdownReader();
                        MessageBox.Show(String.Format("StartupReader Failed{0}", ret));
                        return;//exit
                    }
                }

                //Load settings
                string path = Application.StartupPath;//Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                if (File.Exists(path + @"\settings.txt"))
                {
                    using (FileStream file = new FileStream(path + @"\settings.txt", FileMode.Open))
                    using (StreamReader sr = new StreamReader(file))
                    {
                        LocalSettings.ServerIP = sr.ReadLine();
                        LocalSettings.ServerName = sr.ReadLine();
                        LocalSettings.DBName = sr.ReadLine();
                        LocalSettings.UserID = sr.ReadLine();
                        LocalSettings.Password = sr.ReadLine();
                    }
                }
                else
                {
                    //Set to default
                    LocalSettings.ServerName = "SQLEXPRESS";
                }

                //Open MainForm and EnableVisualStyles
                Application.Run(new MenuForm());

                //Save settings
                using (FileStream file = new FileStream(path + @"\settings.txt", FileMode.Create))
                using (StreamWriter sw = new StreamWriter(file))
                {
                    sw.WriteLine(LocalSettings.ServerIP);
                    sw.WriteLine(LocalSettings.ServerName);
                    sw.WriteLine(LocalSettings.DBName);
                    sw.WriteLine(LocalSettings.UserID);
                    sw.WriteLine(LocalSettings.Password);
                }

                ReaderCE.ShutdownReader();

                ReaderCE.Dispose();
                Reader.Net.Firewall.Close();
            }

           // Reader.Net.Firewall.Close();
        }
Exemple #38
0
        private void anyOneDocHighLigth(string multiFilePath, ApplicationClass testWord, string keyWord, RichTextBox rtbHightLight,
            Label count, RichTextBox StatisticsInfor, HandleDocument handleDocument)
        {
            WaitingForm wf = new WaitingForm();
            HandleWaitingForm.startWaitingForm(wf);

            Document doc = handleDocument.openDocument(multiFilePath, testWord);
            highLightKeyWords(keyWord, testWord, doc, rtbHightLight, count, StatisticsInfor);
            closeDoc(doc);

            HandleWaitingForm.closeWaitingForm(wf);
        }
Exemple #39
0
		/// <summary>
		/// Connects to a server as a client
		/// </summary>
		private void connectAsClient() 
		{
			// prepare listen thread
			connectingToClientThread = new Thread(new ThreadStart(connectingToClient));
			connectingToClientThread.Name = "ConnectingToClient";

			// prepare "Waiting..." form
			waitingForm = new WaitingForm(listenForConnectionThread, version,"Connecting to " + startupForm.ClientIP + ":" + connectionPort + "...");

			// show Waiting form
			waitingForm.TopLevel = true;
			waitingForm.Show();
			
			// hide main window
			this.Hide();

			// start to attempt to connect
			connectingToClientThread.Start();
		}
Exemple #40
0
 private void nnnToolStripMenuItem_Click(object sender, EventArgs e)
 {
     WaitingForm wform = new WaitingForm();
     wform.MdiParent = this;
     wform.Show();
 }
Exemple #41
0
		/// <summary>
		/// Attempts to connect to client
		/// </summary>
		private void connectingToClient() 
		{
			tcpClient = null;

			// hide main form
			this.Invoke(setMainFormVisibilityDelegate, new object[] { false });

			try 
			{
				// attempt to connect
				tcpClient = new TcpClient(startupForm.ClientIP.ToString(), connectionPort);

				// set up IO streams
				NetworkStream oSocketStream = tcpClient.GetStream();
				outputStream = new StreamWriter(oSocketStream); 
				inputStream = new StreamReader(oSocketStream);	
				outputStream.AutoFlush = true;

				// enable send button
				this.Invoke(setSendButtonStateDelegate, new object[] {true});
				this.Invoke(setStatusBarTextDelegate, new object[] {"Connection established."});

				// start to listen to incoming messages
				listenForMessagesThread = new Thread(new ThreadStart(listenToIncomingMessages));
				listenForMessagesThread.Name = "ListenForMessages";
				listenForMessagesThread.Start();
			} 
			catch (ThreadAbortException) 
			{
				this.Invoke(setStatusBarTextDelegate, new object[] {"Connecting process was aborted."});
			} 
			catch (SocketException) 
			{
				this.Invoke(setStatusBarTextDelegate, new object[] {"Connection to client could not have been established."});
			} 
			finally 
			{
				// close the waiting form if necessary
				if (waitingForm != null) 
				{
					waitingForm.Close();
					waitingForm.Dispose();
					waitingForm = null;
				}

				// show main form
				this.Invoke(setMainFormVisibilityDelegate, new object[] { true });
			}
		}
Exemple #42
0
        private void OpenForm(object sender, EventArgs e)
        {
            var btn  = (Button)sender;
            var text = btn.Text;

            CatelogForm form = null;

            if (Application.OpenForms.OfType <CatelogForm>().Count() != 0)
            {
                form = Application.OpenForms.OfType <CatelogForm>().LastOrDefault();
            }
            if (form != null)
            {
                var gbo = form.pnlFill;
                form.Skip = true;
                gbo.Controls.Clear();

                if (text == "Worker")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <WorkerListForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <WorkerListForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new WorkerListForm()
                            {
                                TopLevel    = false,
                                Dock        = DockStyle.Fill,
                                AutoScroll  = true,
                                CatelogForm = form
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new WorkerListForm()
                        {
                            TopLevel    = false,
                            Dock        = DockStyle.Fill,
                            AutoScroll  = true,
                            CatelogForm = form
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "Category")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <Category>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <Category>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                        }
                        var selectionForm = new Category()
                        {
                            TopLevel   = false,
                            Dock       = DockStyle.Fill,
                            AutoScroll = true
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new Category()
                        {
                            TopLevel   = false,
                            Dock       = DockStyle.Fill,
                            AutoScroll = true
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "Patient")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <PatientListForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <PatientListForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new PatientListForm()
                            {
                                TopLevel    = false,
                                Dock        = DockStyle.Fill,
                                AutoScroll  = true,
                                Account     = _account,
                                CatelogForm = form
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}

                    else
                    {
                        var selectionForm = new PatientListForm()
                        {
                            TopLevel    = false,
                            Dock        = DockStyle.Fill,
                            AutoScroll  = true,
                            Account     = _account,
                            CatelogForm = form
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "CheckIn")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <CheckInsForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <CheckInsForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new CheckInsForm
                            {
                                TopLevel   = false,
                                Dock       = DockStyle.Fill,
                                AutoScroll = true
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new CheckInsForm
                        {
                            TopLevel   = false,
                            Dock       = DockStyle.Fill,
                            AutoScroll = true
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "Sample")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <SamplesForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <SamplesForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new SamplesForm()
                            {
                                TopLevel   = false,
                                Dock       = DockStyle.Fill,
                                AutoScroll = true,
                                Account    = _account
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new SamplesForm()
                        {
                            TopLevel   = false,
                            Dock       = DockStyle.Fill,
                            AutoScroll = true,
                            Account    = _account
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "Management")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <Managements>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <Managements>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new Managements()
                            {
                                TopLevel   = false,
                                Dock       = DockStyle.Fill,
                                AutoScroll = true
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new Managements()
                        {
                            TopLevel   = false,
                            Dock       = DockStyle.Fill,
                            AutoScroll = true
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "Medical")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <MedicalsForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <MedicalsForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            gbo.Controls.Add(firstOrDefault);
                            firstOrDefault.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new MedicalsForm()
                        {
                            TopLevel    = false,
                            Dock        = DockStyle.Fill,
                            AutoScroll  = true,
                            Account     = _account,
                            CatelogForm = form
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "WaitingList")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <WaitingForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <WaitingForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new WaitingForm()
                            {
                                TopLevel    = false,
                                Dock        = DockStyle.Fill,
                                AutoScroll  = true,
                                Account     = _account,
                                CatelogForm = form
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new WaitingForm()
                        {
                            TopLevel    = false,
                            Dock        = DockStyle.Fill,
                            AutoScroll  = true,
                            Account     = _account,
                            CatelogForm = form
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
                if (text == "Report")
                {
                    if (Application.OpenForms.OfType <HistorysForm>().Count() != 0)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <HistorysForm>().LastOrDefault();
                        if (firstOrDefault != null)
                        {
                            if (firstOrDefault.NewMedical || firstOrDefault.Editing)
                            {
                                var result = MessageBox.Show(@"Do you really want to leave this? leaving this document will delete all your current work.", @"Leave", MessageBoxButtons.YesNo);
                                if (result == DialogResult.No)
                                {
                                    gbo.Controls.Add(firstOrDefault);
                                    firstOrDefault.CatelogForm.Skip = false;
                                    firstOrDefault.Show();
                                    return;
                                }
                                if (result == DialogResult.Yes)
                                {
                                    firstOrDefault.Close();
                                }
                            }
                        }
                    }
                    if (Application.OpenForms.OfType <WaitingForm>().Count() == 1)
                    {
                        var firstOrDefault = Application.OpenForms.OfType <WaitingForm>().FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            firstOrDefault.Close();
                            var selectionForm = new Report()
                            {
                                TopLevel   = false,
                                Dock       = DockStyle.Fill,
                                AutoScroll = true,
                            };
                            gbo.Controls.Add(selectionForm);
                            selectionForm.Show();
                        }
                    }
                    //if (Application.OpenForms.OfType<MedicalsForm>().Count() == 1)
                    //{
                    //    var firstOrDefault = Application.OpenForms.OfType<MedicalsForm>().FirstOrDefault();
                    //    if (firstOrDefault != null)
                    //    {
                    //        firstOrDefault.Clear();
                    //        firstOrDefault.Close();
                    //    }
                    //}
                    else
                    {
                        var selectionForm = new Report()
                        {
                            TopLevel   = false,
                            Dock       = DockStyle.Fill,
                            AutoScroll = true,
                        };
                        gbo.Controls.Add(selectionForm);
                        selectionForm.Show();
                    }
                }
            }
        }
Exemple #43
0
 public void Run()
 {
     if (theForm == null || theForm.IsDisposed)
     {
         theForm = new WaitingForm();
         theForm.WindowState = FormWindowState.Normal;
         theForm.StartPosition = FormStartPosition.CenterScreen;
         theForm.Text = string.Empty;
         theForm.ControlBox = false;
         theForm.FormBorderStyle = FormBorderStyle.None;
     }
     try
     {
         Application.Run(theForm);
     }
     catch { }
 }
Exemple #44
0
 /// <summary>
 /// Se muestra la ventana WaitingForm, con el mensaje que se muestra como argumento
 /// </summary>
 /// <param name="mensaje">Mensaje a mostrar en pantalla</param>
 public void ShowWaiting(string mensaje)
 {
     if (!this.abiertoWaitingForm)
     {
         waitingForm = new WaitingForm();
         waitingForm.lblTexto.Text = mensaje;
         abiertoWaitingForm = true;
         waitingForm.Show();
         Application.DoEvents();
     }
     else
     {
         waitingForm.lblTexto.Text = mensaje;
         Application.DoEvents();
     }
 }
Exemple #45
0
        private void calTables(int number, Document regDoc, WaitingForm wf, string tName)
        {
            string errormsg = "";
            for (int i = 0; i < number; i++)
            {
                string title = tableName[i];
                if (number == 1)
                {
                    title = tName;
                }
                CalculateTable calTable = new CalculateTable();

                Table normalTable = calTable.getTableByName(regDoc, title, testWord);

                Table comTable = calTable.getTableByName(testDoc, title, testWord);

                if (normalTable == null)
                {
                    errormsg += regDoc.Name + "文档不存在该表格:\r" + title+"\r\r";
                    MessageBox.Show(regDoc.Name + "文档不存在该表格:\r\r" + title);
                    continue;
                }
                if (!calTable.isNormalTable(normalTable))
                {
                    errormsg += regDoc.Name + "中:\r" + title + "不符合标准格式,无法计算\r\r";
                    MessageBox.Show(regDoc.Name + "中:\r\r" + title + "不符合标准格式,无法计算");
                    continue;
                }
                if (comTable == null)
                {
                    errormsg += testDoc.Name + "文档不存在该表格:\r" + title + "\r\r";
                    MessageBox.Show(testDoc.Name + "文档不存在该表格:\r\r" + title);
                    continue;
                }
                if (!calTable.isNormalTable(comTable))
                {
                    errormsg += testDoc.Name + "中:\r" + title + "不符合标准格式,无法计算\r\r";
                    MessageBox.Show(testDoc.Name + "中:\r\r" + title + "不符合标准格式,无法计算");
                    continue;
                }

                List<string> keyList=calTable.calTableShowMssing(comTable, normalTable, dataView, showItemInfo, title,flagList);
                generateKeyItemList(keyList);
                
            }
            errormsg += showItemInfo.Text;

            if (!tableMSG.Contains(errormsg))
                tableMSG += errormsg;
        }
Exemple #46
0
        private void DownloadBtn_Click(object sender, EventArgs e)
        {
            string packName = PacksList.SelectedItem.ToString();

            string savePath = $"{Helper.directory}temp/{packName}.zip";

            string moveToPath = $"{Helper.directory}Revision/Downloaded Packs/{packName}";

            // Check if a folder with that name already exists.
            if (OverwritePanel.Visible)
            {
                if (MsgBox.ShowWait($"A folder with this name already exists." +
                                    $"\n\n" +
                                    $"Do you want to overwrite it?",
                                    "Overwrite File",
                                    MsgBox.Options.yesNo,
                                    MsgBox.MsgIcon.EXCL) == "Yes")
                {
                    Directory.Delete(moveToPath, true);
                }
                else
                {
                    return;
                }
            }

            // Download the pack from GitHub.
            bool worked = false;

            WaitingForm.BeginWait("Downloading and extracting pack...", ev =>
            {
                try
                {
                    using (var wc = new WebClient())
                    {
                        wc.DownloadFile($"https://github.com/CosmoleonGit/RevisionProgram/raw/master/Packs/{packName}.zip", savePath);
                    }

                    worked = true;
                }
                catch (WebException ex)
                {
                    Helper.Error("Failed to download pack.", ex.Message);
                }

                if (worked)
                {
                    worked = false;

                    try
                    {
                        Directory.CreateDirectory($"{Helper.directory}Revision/Downloaded Packs");

                        ZipFile.ExtractToDirectory(savePath,
                                                   moveToPath);

                        File.Delete(savePath);
                        worked = true;
                    }
                    catch (Exception ex)
                    {
                        Helper.Error("Failed to download pack.", ex.Message);
                    }
                }
            });

            // If downloading was successful, extract the file.
            if (worked)
            {
                if (MsgBox.ShowWait($"Successfully downloaded {packName}! You will find it in your Revision folder." +
                                    $"\n\n" +
                                    $"Would you like to go to it now?",
                                    "Finished",
                                    MsgBox.Options.yesNo,
                                    MsgBox.MsgIcon.TICK) == "Yes")
                {
                    RevisionHub.OpenExplorer();
                    RevisionHub.explorer.OpenDir($"Downloaded Packs/{packName}");
                    Close();
                }
                else
                {
                    PacksList.SelectedIndex = -1;
                }
            }
        }
Exemple #47
0
        private void SaveTemplate(TemplateType type)
        {
            WaitingForm  frmWaiting     = null;
            WdCursorType originalCursor = WdCursorType.wdCursorNormal;

            try
            {
                originalCursor = Wkl.MainCtrl.CommonCtrl.CommonProfile.App.System.Cursor;
                TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo;

                if (templateInfo.IsProntoDoc)
                {
                    string filter = string.Empty;
                    switch (type)
                    {
                    case TemplateType.Pdw:
                        filter = PdwFilter;
                        break;

                    case TemplateType.Pdh:
                        filter = PdhFilter;
                        break;

                    case TemplateType.Pdz:
                        filter = PdzFilter;
                        break;

                    //HACK:FORM CONTROLS - TEMPORARY INSTEAD OF TemplateType.Pdm
                    case TemplateType.Pdm:
                        filter = PdmFilter;
                        break;

                    default:
                        break;
                    }

                    SaveFileDialog saveDialog = new SaveFileDialog {
                        Filter = filter
                    };

                    if (saveDialog.ShowDialog() == DialogResult.OK)
                    {
                        // set wating cursor
                        Wkl.MainCtrl.CommonCtrl.CommonProfile.App.System.Cursor = WdCursorType.wdCursorWait;
                        frmWaiting = new WaitingForm();
                        frmWaiting.Show();

                        Context.ContextManager contextMgr = new Context.ContextManager();
                        contextMgr.SaveAsTemplate(Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc, saveDialog.FileName);

                        if (File.Exists(Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc.FullName))
                        {
                            MessageBox.Show(MessageUtils.Expand(Properties.Resources.ipm_M006,
                                                                Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc.FullName));
                        }
                    }
                }
                else
                {
                    MessageBox.Show(MessageUtils.Expand(Properties.Resources.ipm_NotIsProntoDoc,
                                                        Properties.Resources.ipe_NotIsProntoDoc));
                }
            }
            catch (BaseException baseExp)
            {
                ManagerException mgrExp = new ManagerException(ErrorCode.ipe_SavePdwError);
                mgrExp.Errors.Add(baseExp);

                LogUtils.LogManagerError(mgrExp);
            }
            finally
            {
                try
                {
                    if (frmWaiting != null)
                    {
                        frmWaiting.Close();
                        frmWaiting.Dispose();
                    }

                    Wkl.MainCtrl.CommonCtrl.CommonProfile.App.System.Cursor = originalCursor;
                }
                catch { }
            }
        }
        public override bool Setup()
        {
            try
            {
                server.Start();
            } catch (SocketException)
            {
                MsgBox.ShowWait("Failed to start server. Is there already a server listening on that port?",
                                "Error",
                                null,
                                MsgBox.MsgIcon.ERROR);

                return(false);
            }

            WaitingForm.BeginWait("Waiting for client to connect...", ev =>
            {
                while (true)
                {
                    try
                    {
                        var waiting = Task.Run(async delegate { await Task.Delay(timeout); });

                        while (!server.Pending() && !waiting.IsCompleted)
                        {
                        }

                        if (server.Pending())
                        {
                            client = server.AcceptTcpClient();
                            socket = client.Client;
                            socket.SendBufferSize    = bufferSize;
                            socket.ReceiveBufferSize = bufferSize;
                            stream             = client.GetStream();
                            stream.ReadTimeout = timeout;

                            break;
                        }
                        else
                        {
                            throw new TimeoutException();
                        }
                    }
                    catch (TimeoutException)
                    {
                        if (!ConnectionFailure())
                        {
                            break;
                        }
                    } catch (ObjectDisposedException)
                    {
                        break;
                    }
                }
            }, () =>
            {
                server.Stop();

                return(true);
            });

            if (socket != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #49
0
        public void DataTableToExcel(System.Data.DataTable tmDataTable, string strFileName)
        {
            WaitingForm wtForm = new WaitingForm();

            waitingBool = true;
            wtForm.Show();
            if (strFileName == null)
            {
                return;
            }
            int RowNum      = tmDataTable.Rows.Count;
            int ColumnNum   = tmDataTable.Columns.Count;
            int RowIndex    = 2;
            int ColumnIndex = 0;

            Microsoft.Office.Interop.Excel.Application xlapp = new Microsoft.Office.Interop.Excel.Application();

            //打开Excel应用
            xlapp.DefaultFilePath = "";
            xlapp.DisplayAlerts   = true;
            Microsoft.Office.Interop.Excel.Workbooks workbooks = xlapp.Workbooks;
            Microsoft.Office.Interop.Excel.Workbook  workbook  =
                workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet); //创建一个Excel文件
            Microsoft.Office.Interop.Excel.Worksheet worksheet =
                (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1];

            //拿到那个工作表
            //foreach (DataColumn dc in tmDataTable.Columns)
            //{
            //    ColumnIndex++;
            //    worksheet.Cells[RowIndex, ColumnIndex] = dc.ColumnName;
            //}

            //给两列写列名
            worksheet.Columns.HorizontalAlignment = XlHAlign.xlHAlignCenter; //水平居中
            worksheet.Columns.ColumnWidth         = 20;

            Microsoft.Office.Interop.Excel.Range mergeRange;
            mergeRange = worksheet.get_Range("A1", "B1");
            mergeRange.Merge(0);
            if (comboBox4.Text == "")
            {
                worksheet.Cells[1, 1] = comboBox1.Text + "-" + comboBox2.Text + "-" + comboBox3.Text;
            }
            else
            {
                worksheet.Cells[1, 1] = comboBox1.Text + "-" + comboBox2.Text + "-" + comboBox3.Text + "-" + comboBox4.Text;
            }

            worksheet.Cells[2, 1] = "值";
            worksheet.Cells[2, 2] = "时间";

            //添加寄存器对应的监控点名称
            for (int i = 0; i < RowNum; i++)
            {
                RowIndex++;
                ColumnIndex = 0;
                for (int j = 1; j < 3; j++)
                {
                    ColumnIndex++;
                    worksheet.Cells[RowIndex, ColumnIndex] = tmDataTable.Rows[i][j].ToString();
                }
            }
            waitingBool = false;
            workbook.SaveCopyAs(strFileName + ".xlsx");


            MessageBox.Show("Excle表格导出成功,保存为" + strFileName);

            //退出关闭EXCLE.EXE线程
            xlapp.Quit();
            IntPtr t = new IntPtr(xlapp.Hwnd);
            int    k = 0;

            GetWindowThreadProcessId(t, out k);
            System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(k);
            p.Kill();
        }
Exemple #50
0
        private void keyTableItemList_SelectedIndexChanged(object sender, EventArgs e)
        {
            WaitingForm wf = new WaitingForm();
            HandleWaitingForm.startWaitingForm(wf);
            List<string> list = new List<string>();
            if (!testDocIsOpen)
            {
                testDocIsOpen = true;
                testDoc = handleDocument.openDocument(testFileName, testWord);
            }
            list.Add((string)keyTableItemList.SelectedItem);
            KeyWord keyWord = new KeyWord();
            keyWord.highLightRichString(rbTableTest, testWord, testDoc,list);

            HandleWaitingForm.closeWaitingForm(wf);
        }
Exemple #51
0
 // Обработка начала игры
 public void StartGameHandler(Message Msg)
 {
     SetPreGameHandlers(false);
     if (waitingForm != null)
     {
         waitingForm.Close();
         waitingForm = null;
     }
     gameForm = new GameForm(this);
     gameForm.Show();
     SetGameHandlers(true);
 }
Exemple #52
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            string regFileName = cbxRegDoc.Text;
            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else
            {
                ////改为察看系统中所有规程,现在为察看是否在列表中。当前列表显示所有规程,以后改为显示前n项
                if (cbxRegDoc.Items.Contains(regFileName))
                {
                    if (isTextMode())
                    {
                        WaitingForm wf = new WaitingForm();
                        HandleWaitingForm.startWaitingForm(wf);
                        if (!testDocIsOpen)
                        {
                            testDocIsOpen = true;
                            testDoc = handleDocument.openDocument(testFileName, testWord);
                        }

                        //////获得规程文档目录内容  
                        //////如果规程文档与上次相同则不重新载入
                        //if (preRegFileName != regFileName)
                        //{
                            if (regDocSForm != null && regDocSForm.isAddNewRegDoc())
                                regTOCContents = regDocSForm.getRegTOCContents();
                            else
                            {
                                regTOCContents = tableOfContents.getTOCContentsByName(regFileName);
                            }
                            writeRegToListBox(regTOCContents, regTreeView);
                       // }

                        
                        //////获得测试文档目录内容
                        //////如果测试文档与上次相同则不重新载入
                        if ((preTestFileName != testFileName) || !tocTestStarted)
                        {
                            testTOCContents = handleDocument.getTestTextDocTOC(testDoc, testWord);
                        }

                        Dictionary<string, List<string>> msgContentList = new Dictionary<string, List<string>>();
                        msgContentList.Add("error", new List<string>());
                        msgContentList.Add("spare", new List<string>());
                        msgContentList.Add("missing", new List<string>());

                        writeTocTOListBox(testTOCContents, testTreeView, regTreeView, msgContentList);

                        tableOfContents.update(cbxRegDoc);
                        tabControl2.SelectTab("tabPageTest");

                        ////记录本次操作的规程文档和测试文档文件名
                        preRegFileName = regFileName;
                        preTestFileName = testFileName;
                        HandleWaitingForm.closeWaitingForm(wf);

                        ////显示错误报告项目
                        List<string> list = msgContentList["error"];
                        int c = list.Count;
                        //MessageBox.Show(c.ToString());
                        list = msgContentList["spare"];
                        c = list.Count;
                        //MessageBox.Show(c.ToString());
                        list = msgContentList["missing"];
                        c = list.Count;
                       // MessageBox.Show(c.ToString());



                        if(!reportMSG.Contains(textTOCMSG))
                            reportMSG += textTOCMSG;

                    }
                    else if (isSpecificationMode())
                    {
                        WaitingForm wf = new WaitingForm();
                        HandleWaitingForm.startWaitingForm(wf);

                        if (!testDocIsOpen)
                        {
                            testDocIsOpen = true;
                            testDoc = handleDocument.openDocument(testFileName, testWord);
                        }

                        //////获得规程文档目录内容  
                        //////如果规程文档与上次相同则不重新载入
                        if (preRegFileName != regFileName)
                        {
                            Dictionary<string, List<string>> specificationDict = null;
                            if (regDocSForm != null && regDocSForm.isAddNewRegDoc())
                                specificationDict = regDocSForm.getSpecificationTOCContents();
                            else
                            {
                                specificationDict = tableOfContents.getSpecificationTOCContentsByName(regFileName);
                            }
                            writeRegSpecipicationToListBox(specificationDict, regTreeView);
                        }


                        //////获得测试文档目录内容
                        //////如果测试文档与上次相同则不重新载入
                        if (preTestFileName != testFileName)
                        {
                            testTOCContents = handleDocument.getTestSpecificationDocTOC(testDoc, testWord);
                            writeSpecificationTocTOListBox(testTOCContents, testTreeView, regTreeView);
                        }
                        tableOfContents.update(cbxRegDoc);
                        tabControl2.SelectTab("tabPageTest");

                        ////记录本次操作的规程文档和测试文档文件名
                        preRegFileName = regFileName;
                        preTestFileName = testFileName;

                        HandleWaitingForm.closeWaitingForm(wf);

                        if(!reportMSG.Contains(specifiTOCMSG))
                        reportMSG += specifiTOCMSG;
                    }
                    else
                    {
                        MessageBox.Show("请选择一种比较方法");
                    }

                    plKeyWord.Hide();
                    plTableTest.Hide();

                    hideTableTreeView();
                    hideTableTreeView();
                    tabControlMulti.Hide();

                    tabControl2.Show();
                    showTOCTreeView();
                    plTOC.Show();

                    if(testDocIsOpen)
                        closeTestDoc();

                }
                else
                {
                    MessageBox.Show("选择的规程文档不存在");
                }
                //closeTestDoc();
            }
        }
Exemple #53
0
 // Посадка на игровой стол
 public void EnterTheTable(int PlayerPlace, int TableID)
 {
     if (Tables[TableID] == null)
         return;
     if (serverActions.AddPlayerToTable(TableID, PlayerPlace))
     {
         ChangeCurrentTable(serverActions.GetTable(TableID));
         ChangeCurrentPlace(PlayerPlace);
         if (userForm != null)
         {
             userForm.Close();
             userForm = null;
         }
         waitingForm = new WaitingForm(this);
         waitingForm.UpdateLabels();
         SetPreGameHandlers(true);
         waitingForm.Show();
         serverActions.TestFullfillTable();
     }
     else
     {
         MessageBox.Show("Не удалось сесть на игровой стол");
         userForm.UpdateTables();
     }
 }
Exemple #54
0
        private Boolean ifExecuted = false;//判断单文档关键字查询是否执行了

        private void btnFindKeyWord_Click(object sender, EventArgs e)
        {
            string keyword = cbxKeyWord.Text;
            if (keyword.Trim() != "")
            {
                KeyWordCache.putKeyWordInCache(keyword, KeyWordCache.KEYWORD);
                KeyWordCache.update(cbxKeyWord, KeyWordCache.KEYWORD);

                tabControl2.SelectTab("tabPageFind");

                if (checkKeyWordInput(testFileName, multiTestFilePath, multiRegFilePath, multiSpecFilePath) == true)//检查输入不为空
                {
                    KeyWord keyWord = new KeyWord();
                    if (!isMultiple)//danwendang
                    {
                        if (testDoc != null)
                        {
                            if (!testFileName.Equals(preTestFileName) || keywordChanged)//如果路径改变或者关键字改变则认为关键字查询没有执行
                            {
                                ifExecuted = false;
                            }
                            if (!testFileName.Equals(preTestFileName) || keywordChanged || !ifExecuted)
                            {
                                WaitingForm wf = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(wf);
                                if (!testDocIsOpen)
                                {
                                    testDocIsOpen = true;
                                    testDoc = handleDocument.openDocument(testFileName, testWord);
                                }

                                keyWord.highLightKeyWords(cbxKeyWord.Text, testWord, testDoc, richTxbTestDoc, lbCountItems, rtbKeyWord);

                                HandleWaitingForm.closeWaitingForm(wf);
                                ifExecuted = true;

                                preTestFileName = testFileName;

                                /////查询关键字对应的标准规范值
                                string value = keyWord.getExistStandard(keyword);
                                lbKeyWordSingle.Text = keyword;
                                if (value != null)
                                    lbKeyWordValueSingle.Text = value;
                                else
                                    lbKeyWordValueSingle.Text = "";
                            }
                        }
                    }
                    else
                    {
                        keyWord.multiHightLigthKeyWord(preMultiTestFilePath, preMultiRegFilePath, preMultiSpecFilePath, multiTestFilePath, multiRegFilePath, multiSpecFilePath, keyword, testWord, rtbTestDoc, rtbRegDoc,
                            rtbSpecificationDoc, null, null, null, rtxMultiTestDoc, rtbMultiRegDoc, rtbMultiSpecDoc, handleDocument, keywordChanged);
                        updatePreFilePath();

                        /////查询关键字对应的标准规范值
                        string value = keyWord.getExistStandard(keyword);
                        lbKeyWord.Text = keyword;
                        if (value != null)
                            lbKeyWordValue.Text = value;
                        else
                            lbKeyWordValue.Text = "无标准数值信息";
                    }

                }

                plTableTest.Hide();
                plTOC.Hide();
                if (!isMultiple)
                {
                    plMultiInfo.Hide();
                    plKeyWord.Show();
                }
                else
                {
                    plKeyWord.Hide();
                    plMultiInfo.Show();
                }
                keywordChanged = false;
            }
            else
            {
                MessageBox.Show("请输入关键字");
            }
        }
Exemple #55
0
		/// <summary>
		/// Listens as a server for incoming connection
		/// </summary>
		private void listenAsServer() 
		{
			tcpClient = null;

			// prepare listen thread
			listenForConnectionThread = new Thread(new ThreadStart(listenToIncomingConnection));
			listenForConnectionThread.Name = "ListenForConnection";

			// prepare "Waiting..." form
			waitingForm = new WaitingForm(listenForConnectionThread, version,"Waiting for incoming connection on " + startupForm.ServerIP.ToString() + ":" + connectionPort + " ...");

			// show Waiting form
			waitingForm.TopLevel = true;
			waitingForm.Show();
			
			// hide main window
			this.Hide();

			// start listen for connection thread
			listenForConnectionThread.Start();
		}
Exemple #56
0
        private void btnAddNewDoc_Click(object sender, EventArgs e)
        {
            if (rbText.Checked || rbSpecification.Checked)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Word文件|*.doc";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    regFileName = openFileDialog.FileName;
                    string filename = regFileName.Substring(regFileName.LastIndexOf("\\") + 1, regFileName.LastIndexOf(".") - regFileName.LastIndexOf("\\") - 1);
                    if (rbText.Checked)
                    {
                        if (!textResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            regTOCContents = toc.AddRegToSysResource(regFileName);
                            addNewRegDoc = true;
                            textResults.Add(filename);
                            txbDocName.Text = filename;
                            tvRegDoc.Nodes.Add(filename);
                            tvRegDoc.Update();

                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if (MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {

                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                regTOCContents = toc.AddRegToSysResource(regFileName);
                                addNewRegDoc = true;
                                txbDocName.Text = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            }
                            else
                            {
                                //
                            }
                        }
                    }
                    else
                    {
                        if (!specificationResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            HandleDocument handleDocument = new HandleDocument();
                            ////获得说明书规程文档目录
                            ////将说明书目录存入系统
                            specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);
                            
                            addNewRegDoc = true;
                            specificationResults.Add(filename);
                            txbDocName.Text = filename;
                            tvSpecificationDoc.Nodes.Add(filename);
                            tvSpecificationDoc.Update();
                            
                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if(MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                HandleDocument handleDocument = new HandleDocument();
                                ////获得说明书规程文档目录
                                ////将说明书目录存入系统
                                specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);
                                addNewRegDoc = true;
                                txbDocName.Text = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            } 
                            else
                            {
                                //
                            }
                        }
                        
                    }
                    toc.update(cbx);
                }               
            }
            else
            {
                MessageBox.Show("请选择一种规程类型");
            }
        }
Exemple #57
0
        public void SaveTemplate(Workbook workbook)
        {
            WaitingForm    frmWaiting     = null;
            XlMousePointer originalCursor = XlMousePointer.xlDefault;

            try
            {
                originalCursor = workbook.Application.Cursor;

                //if (templateInfo.IsProntoDoc)
                //{
                string filter = "Pronto Document Excel|*.pde";
                //switch (type)
                //{
                //    case TemplateType.Pdw:
                //        filter = PdwFilter;
                //        break;
                //    case TemplateType.Pdh:
                //        filter = PdhFilter;
                //        break;
                //    case TemplateType.Pdz:
                //        filter = PdzFilter;
                //        break;
                //    default:
                //        break;
                //}

                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.Filter = filter;
                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    // set wating cursor
                    workbook.Application.Cursor = XlMousePointer.xlWait;
                    frmWaiting = new WaitingForm();
                    frmWaiting.Show();

                    //save the map information between excel table/cell and business domain tree into customer xml part of file.
                    process.SaveMapInfo(workbook);

                    //save exported items into customer xml part
                    if (export.exportItems != null && export.exportItems.Count > 0)//there is some data to export.
                    {
                        export.SaveExportInfo(workbook);
                        export.ExportXsd(workbook);
                    }

                    //save condition goal seek information into customer xml part.
                    if (condGS.cgsInfo.CGSInfos.Count > 0)
                    {
                        condGS.SaveCGSInfo(workbook);
                    }

                    workbook.SaveAs(saveDialog.FileName);

                    if (File.Exists(workbook.FullName))
                    {
                        MessageBox.Show(string.Format("ProntoDoc template {0} saved.", workbook.FullName));
                    }
                }
                //}
                //else
                //    MessageBox.Show(MessageUtils.Expand(Properties.Resources.ipm_NotIsProntoDoc,
                //        Properties.Resources.ipe_NotIsProntoDoc));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //catch (BaseException baseExp)
            //{
            //    ManagerException mgrExp = new ManagerException(ErrorCode.ipe_SavePdwError);
            //    mgrExp.Errors.Add(baseExp);

            //    LogUtils.LogManagerError(mgrExp);
            //}
            finally
            {
                try
                {
                    if (frmWaiting != null)
                    {
                        frmWaiting.Close();
                        frmWaiting.Dispose();
                    }

                    workbook.Application.Cursor = originalCursor;
                }
                catch { }
            }
        }
Exemple #58
0
		/// <summary>
		/// Listens for one incoming connection
		/// </summary>
		private void listenToIncomingConnection()
		{

			// hide main form
			this.Invoke(setMainFormVisibilityDelegate, new object[] { false });

			try 
			{

				// sets up socket listener
				TcpListener listener = new TcpListener(startupForm.ServerIP,connectionPort);

				// starts to listen to specified port
				listener.Start();

				// wait until there is an incoming connection
				
				// I usually don't do this "busy-loop", but I wanted to be
				// responsive to the Cancel button, so I need to sleep this thread
				// every once in a while
				while (!listener.Pending()) 
					System.Threading.Thread.Sleep(1000);

				// accept the server connection
				tcpClient = listener.AcceptTcpClient();
				
				// set up IO streams
				outputStream = new StreamWriter(tcpClient.GetStream());
				inputStream = new StreamReader(tcpClient.GetStream());
				outputStream.AutoFlush = true;

				// enable send button
				this.Invoke(setSendButtonStateDelegate, new object[] { true });

				// start to listen to incoming messages
				listenForMessagesThread = new Thread(new ThreadStart(listenToIncomingMessages));
				listenForMessagesThread.Start();
			} 
			catch (ThreadAbortException) 
			{
				this.Invoke(setStatusBarTextDelegate, new object[] {"Listening process was aborted."});
			} 
			finally 
			{
				// close the waiting form if necessary
				if (waitingForm != null) 
				{
					waitingForm.Close();
					waitingForm.Dispose();
					waitingForm = null;
				}

				// show main form
				this.Invoke(setMainFormVisibilityDelegate, new object[] { true });
			}
		}