/// <summary>
 /// 导入物料
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button5_Click(object sender, EventArgs e)
 {
     #region 勾选客户
     DataGridViewSelectedRowCollection rowCollection = dataGridView1.SelectedRows;
     DataGridViewRow row = null;
     if (rowCollection.Count != 1)
     {
         MessageBox.Show("请选中一条客户进行添加物料备案", "Warning");
         return;
     }
     row = rowCollection[0];
     int clientOid = 0;
     clientOid = int.TryParse(row.Cells[0].Value.ToString().Trim(), out clientOid) ? clientOid : 0;
     string clientUniqueCode = row.Cells[2].Value.ToString().Trim();
     #endregion
     #region 导入Excel
     OpenFileDialog openFile = new OpenFileDialog();
     openFile.Filter           = "Excel(*.xlsx)|*.xlsx|Excel(*.xls)|*.xls";
     openFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     openFile.Multiselect      = false;
     if (openFile.ShowDialog() == DialogResult.Cancel)
     {
         return;
     }
     LoadingHelper.ShowLoadingScreen();
     Task.Run(() => ImportMaterialExcel(openFile.FileName, clientOid, clientUniqueCode));
     #endregion
 }
Esempio n. 2
0
        private void button6_Click(object sender, RibbonControlEventArgs e)
        {
            Excel.Range range;

            range = Globals.ThisAddIn.Application.Selection;
            if (range.Cells.Count != 1)
            {
                return;
            }
            Excel.Range cell   = range.Item[1][1];
            string      filter = (string)cell.Value2;

            if (string.IsNullOrEmpty(filter))
            {
                return;
            }
            if (filter.Contains(","))
            {
                filter = filter.Replace(",", "','");
            }

            ParameterizedThreadStart thread = new ParameterizedThreadStart(UpdateReferenceComponents);

            LoadingHelper.ShowLoading("正在处理中,请稍候...", null, thread, new ReferencePipeline {
                objectId     = "1681888161170880.23546",
                fileId       = "1681888161170880",
                filterSystem = filter
            });
            refercomponents.ShowDialog();
        }
Esempio n. 3
0
        // TODO Load MyEffects then RealEffects so load order doesn't mess things up
        internal void Load()
        {
            string origLoadStage = LoadingHelper.GetLoadStage();

            LoadingHelper.SetLoadStage("Registering ItemEffects...");
            string lastModName = "";

            //ItemsToLoad.Add(ModContent.GetModItem(ModContent.ItemType<Terraria.ModLoader.Default.AprilFools>()));

            for (int i = 0; i < ItemsToLoad.Count; i++)
            {
                ModItem item = ItemsToLoad[i];

                if (item.mod.Name != lastModName)
                {
                    lastModName = item.mod.Name;
                    LoadingHelper.SetSubText(lastModName);
                }

                //Thread.Sleep(5000);

                if (item is ModularEffectItem mItem)
                {
                    mItem.RegisterItemEffects();
                }

                LoadingHelper.SetProgress((float)i / ItemsToLoad.Count);
            }

            LoadingHelper.SetLoadStage(origLoadStage);
            LoadingHelper.SetSubText("");
            LoadingHelper.SetProgress(0f);
            ItemsToLoad.Clear();
        }
Esempio n. 4
0
        public void ExtractToExcel(List <ExtractInventoryTool_PickUpDemandDetails> demandList)
        {
            if (demandList == null || demandList.Count == 0)
            {
                return;
            }
            string path       = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            string sourceFile = path + "取货计划.xlsx";

            if (!File.Exists(sourceFile))
            {
                MessageBox.Show("取货计划模板不存在", "Error");
            }
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.Description = "请选择文件保存路径";
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string        foldPath     = dialog.SelectedPath;
            StringBuilder newExcelName = new StringBuilder();

            newExcelName
            .Append("取货计划")
            .Append(DateTime.Now.ToString("yyyy-MMdd-HHmmss"))
            .Append(".xlsx");
            //File.Copy(sourceFile, Path.Combine(foldPath, newExcelName.ToString()), true);
            LoadingHelper.ShowLoadingScreen("正在导出..");
            new NPOIHelper().WriteToPickUpDemandExcel(sourceFile, Path.Combine(foldPath, newExcelName.ToString()), demandList);
            LoadingHelper.CloseForm();
            MessageBox.Show("导出成功!", "Success");
            return;
        }
        public void SaveMaterialExcelCallback(bool isSucceed, string errorMessage)
        {
            LoadingHelper.CloseForm();
            if (!string.IsNullOrEmpty(errorMessage))
            {
                if (!isSucceed)
                {
                    MessageBox.Show(errorMessage, "Error");
                    this.DialogResult = DialogResult.None;
                    this.Close();
                    return;
                }
                DialogResult isDelete = MessageBox.Show(errorMessage, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (isDelete != DialogResult.Yes)
                {
                    this.DialogResult = DialogResult.None;
                    this.Close();
                    return;
                }
                LoadingHelper.ShowLoadingScreen();
                Task.Run(() => SaveMaterialExcel(_excelData, true));
                return;
            }
            _excelData = null;//初始化导入数据
            MessageBox.Show("导入成功!", "Success");
            DataGridViewSelectedRowCollection clientRowCollection = dataGridView1.SelectedRows;

            QueryMaterialByClientID(clientRowCollection[0].Cells[0].Value.ToString());
        }
        private void BtnOutFile_Click(object sender, EventArgs e)
        {
            if (FileId == -1)
            {
                MessageBoxCustom.Show("请选择需要导出的文件!", "提示", this);
                return;
            }

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.Description = "请选择保存文件路径";

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string foldPath = dialog.SelectedPath;
                Result result   = null;
                LoadingHelper.ShowLoading("文件导出中...", this, o =>
                {
                    PersonFileBLL personFileBLL = new PersonFileBLL();

                    result = personFileBLL.OutFile(FileId, foldPath);
                    FileId = -1;
                });

                FileStatus(result, "文件导出");
            }
        }
Esempio n. 7
0
 protected override void OnClosing(CancelEventArgs e)
 {
     using (var loading = new LoadingHelper(LoadingType.Progress))
     {
         Thread.Sleep(100);
         loading.SetPosition(1, "正在保存标签页".GetL());
         Thread.Sleep(100);
         var files = new List <UncloseFileModel>();
         foreach (TabItemClose item in tabcontol.Items)
         {
             var npage = FindNewPage.GetPage(item);
             if (npage is null)
             {
                 continue;
             }
             var m = new UncloseFileModel
             {
                 FileName = (string)item.Header,
                 FilePath = npage.FilePath,
                 FileText = npage.tb.Text
             };
             files.Add(m);
         }
         Strings.Write(JsonConvert.SerializeObject(files), "Models/unclosefileconfig.json");
         loading.SetPosition(50, "正在保存数据链接".GetL());
         Thread.Sleep(100);
         vm.Idb?.CloseAllTable(vm.TreeSource);
         Strings.Write(JsonConvert.SerializeObject(vm.TreeSource), "Models/dbconfig.json");
         loading.SetPosition(100, "保存完成".GetL());
         Thread.Sleep(500);
     }
 }
            // ---------------------------------------------------------------------------
            // Create a New Grid in the Hierarchy from the Grid Prefab
            // ---------------------------------------------------------------------------
            static void CreateNewGrid()
            {
                // Create new Grid GameObject
                gridGameObject = GameObject.CreatePrimitive(PrimitiveType.Plane);
                gridGameObject.transform.position = new Vector3(0f, 0f, 0f);
                gridGameObject.name  = Const.Grid.defaultName;
                gridGameObject.layer = Const.Grid.gridLayer;

                // Configure Grid GameObject MeshRenderer
                MeshRenderer gridMeshRenderer = gridGameObject.GetComponent <MeshRenderer>();

                gridMeshRenderer.lightProbeUsage      = UnityEngine.Rendering.LightProbeUsage.Off;
                gridMeshRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
                gridMeshRenderer.shadowCastingMode    = UnityEngine.Rendering.ShadowCastingMode.Off;
                gridMeshRenderer.receiveShadows       = false;

                // Configure Grid GameObject Material
                if (gridMaterial == null)
                {
                    gridMaterial = LoadingHelper.GetGridMaterial();
                }
                gridMaterial.SetColor("_Color", Settings.Data.gui.grid.tintColor);
                gridMeshRenderer.material = gridMaterial;

                // Add MAST_Grid_Component script to grid and pass grid preferences to it
                UpdateGridSettings();

                // Return the grid to its last saved height
                MoveGridToNewHeight();

                // Hide the grid in the hierarchy
                gridGameObject.hideFlags = HideFlags.HideInHierarchy;
            }
 /// <summary>
 /// 上传BOM
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     #region 勾选客户
     ExtractInventoryTool_Client selectedPrint = (ExtractInventoryTool_Client)comboBox1.SelectedItem;
     if (selectedPrint == null)
     {
         MessageBox.Show("请选中一条客户进行导入BOM", "Warning");
         return;
     }
     string regexRule = selectedPrint.RegexRule;
     #endregion
     #region 导入Excel
     OpenFileDialog openFile = new OpenFileDialog();
     openFile.Filter           = "Excel(*.xlsx)|*.xlsx|Excel(*.xls)|*.xls";
     openFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     openFile.Multiselect      = false;
     if (openFile.ShowDialog() == DialogResult.Cancel)
     {
         return;
     }
     textBox1.Text = openFile.FileName;
     LoadingHelper.ShowLoadingScreen();
     Task.Run(() => ImportBOMExcel(openFile.FileName, selectedPrint));
     //ImportBOMExcel(openFile.FileName, selectedPrint);
     #endregion
 }
 public void SaveBOMExcelCallback(bool isSucceed, string errorMessage)
 {
     LoadingHelper.CloseForm();
     if (!string.IsNullOrEmpty(errorMessage))
     {
         if (!isSucceed)
         {
             MessageBox.Show(errorMessage, "Error");
             this.DialogResult = DialogResult.None;
             this.Close();
             return;
         }
         DialogResult isDelete = MessageBox.Show(errorMessage, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (isDelete != DialogResult.Yes)
         {
             this.DialogResult = DialogResult.None;
             this.Close();
             return;
         }
         LoadingHelper.ShowLoadingScreen();
         Task.Run(() => SaveBOMExcel(_excelData, true));
         return;
     }
     _excelData = null;
     MessageBox.Show("导入成功!", "Success");
     this.DialogResult = DialogResult.OK;
     this.Close();
     return;
 }
Esempio n. 11
0
        /// <summary>
        /// 发送Post 请求
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendPost_Click(object sender, EventArgs e)
        {
            txtPostResult.Text = "";
            string url  = txtPostUrl.Text;
            string data = txtPostData.Text;

            if (string.IsNullOrWhiteSpace(url))
            {
                MessageBox.Show("Post Url 未填写");
                return;
            }

            if (string.IsNullOrWhiteSpace(data))
            {
                MessageBox.Show("Post Data 未填写");
                return;
            }

            var postResultStr = "";

            LoadingHelper.ShowLoading("请求数据中,请耐心等待......", this, o =>
            {
                postResultStr = PostMethod(url, data);
            });
            //txtPostResult.Text = JsonConvert.SerializeObject(postResultStr);
            txtPostResult.Text = postResultStr;
        }
Esempio n. 12
0
        public void Load()
        {
            Loaded  = false;
            Loading = true;

            AveragedValues = new Dictionary <int, int>();

            string origLoadStage = LoadingHelper.GetLoadStage();

            LoadingHelper.SetLoadStage("Averaging treasure bag prices...");

            for (int i = 0; i < ItemLoader.ItemCount; i++)
            {
                Item item = new Item();
                item.SetDefaults(i);

                if ((item.IsVanilla() && !VanillaBossBags.Contains(item.type)) ||
                    (item.modItem != null && item.modItem.BossBagNPC == 0)) // 0 is the default
                {
                    continue;
                }

                Player dummy = new Player(false);

                LoadingHelper.SetSubText(Lang.GetItemName(i).Value);

                TempInfo = new TreasureBagOpeningInfo(1); // I need this one because otherwise it calls the default paramless ctor
                for (int j = 0; j < PboneUtilsConfig.Instance.AverageBossBagsSlider; j++)
                {
                    try
                    {
                        if (item.IsVanilla())
                        {
                            dummy.OpenBossBag(item.type);
                            ItemLoader.OpenVanillaBag("bossBag", dummy, item.type);
                        }
                        else // Modded
                        {
                            item.modItem.OpenBossBag(dummy);
                        }
                    }
                    catch (Exception e)
                    {
                        PboneUtils.Log.Debug($"Non-fatal error '{e}' encountered while averaging treasure bag (ID: {item.type}, Name: {item.Name})");
                        PboneUtils.Log.Debug("Skipping bag...");
                    }
                }

                // TODO values are still 0
                AveragedValues.Add(item.type, (int)TempInfo.GetAverageValue());
            }

            LoadingHelper.SetLoadStage(origLoadStage);
            LoadingHelper.SetSubText("");
            LoadingHelper.SetProgress(0f);

            Loading = false;
            Loaded  = true;
        }
Esempio n. 13
0
            // Change visualizer to eraser
            public static void ChangePrefabToEraser()
            {
                // Remove any existing visualizer
                Visualizer.RemoveVisualizer();

                // Create a new visualizer with eraser
                Visualizer.CreateVisualizer(LoadingHelper.GetEraserPrefab());
            }
Esempio n. 14
0
        //收取信件
        private void button1_Click(object sender, EventArgs e)
        {
            bool isGetAllMail = false;      //是否成功获取信件

            LoadingHelper.ShowLoading("正在获取邮件,请稍等", this, (obj) =>
            {
                // 如果目前的状态是未连接
                if (DataService.pop3.State != Pop3STATE.CONNECTED)
                {
                    // 就需要登录
                    DataService.pop3.Login(DataService.pop3.User);
                }
                //连接后获取邮件
                int ret = DataService.pop3.GetAllMail();
                if (ret == 1)
                {
                    isGetAllMail = true;
                }
                else if (ret == 0)
                {
                    isGetAllMail = true;
                    // 提示一下没收完
                    MessageForm messageForm = new MessageForm("提醒", "获取邮件部分失败", "确定");
                    messageForm.ShowDialog();
                    if (messageForm.DialogResult == DialogResult.Cancel)
                    {
                        messageForm.Dispose();
                    }
                }
            });
            if (isGetAllMail)
            {
                comboBox_date.SelectedIndex = comboBox_date.Items.Count - 1;
                receivedMails = DataService.pop3.User.ReceivedMails;
                ReverseUpdate();
                ShowMailText(GetSelectedMail());
                panel_hello.Visible = false;
                panel_write.Visible = false;
                panel_receive.Show();
            }
            else
            {
                //程序显示登录界面
                MessageForm messageForm = new MessageForm("提醒", "登录信息失效!", "注销", "取消");
                messageForm.ShowDialog();
                //显示主界面
                if (messageForm.DialogResult == DialogResult.OK)
                {
                    messageForm.Dispose();
                    Logout();
                }
                else if (messageForm.DialogResult == DialogResult.Cancel)
                {
                    messageForm.Dispose();
                }
            }
        }
 public void ImportMaterialExcelCallBack(List <ExtractInventoryTool_Material> excelData, string errorMessage)
 {
     if (!string.IsNullOrEmpty(errorMessage))
     {
         LoadingHelper.CloseForm();
         MessageBox.Show(errorMessage, "Error");
         return;
     }
     Task.Run(() => SaveMaterialExcel(_excelData, false));
 }
Esempio n. 16
0
        public string OCR_Trans()
        {
            LoadingHelper.ShowLoadingScreen();//显示
            var    OCRresult = "";
            string token     = "24.5142d6d4850be2c098165f677b8fe68b.2592000.1603087490.282335-22701901";
            //string host = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=" + token;
            string         host     = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic?access_token=" + token;
            Encoding       encoding = Encoding.Default;
            HttpWebRequest request  = (HttpWebRequest)WebRequest.Create(host);

            request.Method    = "post";
            request.Timeout   = 4000;
            request.KeepAlive = true;

            var rect = new Rectangle(_rect.X, _rect.Y, _rect.Width + 1, _rect.Height + 1);

            using (var img = new Bitmap(rect.Width, rect.Height))
            {
                using (var g = Graphics.FromImage(img))
                {
                    g.DrawImage(this.BackgroundImage,
                                new Rectangle(0, 0, rect.Width, rect.Height),
                                rect,
                                GraphicsUnit.Pixel);
                    try
                    {
                        // 图片的base64编码
                        string base64 = ImageToBase64(img);
                        String str    = "image=" + HttpUtility.UrlEncode(base64);
                        byte[] buffer = encoding.GetBytes(str);
                        request.ContentLength = buffer.Length;
                        request.GetRequestStream().Write(buffer, 0, buffer.Length);
                        HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                        StreamReader    reader     = new StreamReader(response.GetResponseStream(), Encoding.Default);
                        string          result     = reader.ReadToEnd();
                        var             ocr_result = JsonHelper.ConvertJson(result);
                        for (int i = 0; i < ocr_result["words_result"].Count(); i++)
                        {
                            OCRresult = OCRresult + ocr_result["words_result"][i]["words"].ToString() + "\r\n";
                        }
                        OCRresult = TranslateAPISingle.Translate(OCRresult);
                        new OCR_Form(img, OCRresult).Show();
                    }
                    catch
                    {
                        Console.WriteLine("网络异常");
                    }
                    finally
                    {
                        LoadingHelper.CloseForm();//关闭
                    }
                }
            }
            return(OCRresult);
        }
 public void ImportBOMExcelCallback(List <ExtractInventoryTool_BOM> excelData, string errorMessage)
 {
     if (!string.IsNullOrEmpty(errorMessage))
     {
         LoadingHelper.CloseForm();
         MessageBox.Show(errorMessage, "Error");
         this.DialogResult = DialogResult.None;
         this.Close();
         return;
     }
     Task.Run(() => SaveBOMExcel(_excelData, false));
 }
Esempio n. 18
0
        public string OCR_Latx()
        {
            string LaTeXRresult = "";

            try
            {
                LoadingHelper.ShowLoadingScreen();//显示

                var rect = new Rectangle(_rect.X, _rect.Y, _rect.Width + 1, _rect.Height + 1);
                using (var img = new Bitmap(rect.Width, rect.Height))
                {
                    using (var g = Graphics.FromImage(img))
                    {
                        g.DrawImage(this.BackgroundImage,
                                    new Rectangle(0, 0, rect.Width, rect.Height),
                                    rect,
                                    GraphicsUnit.Pixel);

                        Dictionary <string, string> headers = new Dictionary <string, string>();
                        headers.Add("Timeout", "6000");
                        headers.Add("ContentType", "application/json");
                        headers.Add("UserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");
                        headers.Add("Method", "POST");
                        string LaTeX_MMS_url = "https://www.latexlive.com:5001/api/mathpix/posttomathpix?";
                        var    postData      = "{\"src\":\"data:image/png;base64," + ImageToBase64(img) + "\"}";

                        Request Response       = new Request(LaTeX_MMS_url, headers, postData);
                        var     text           = Response.GetText();
                        var     json_LaTeX_MMS = JsonHelper.ConvertJson(text);
                        LaTeXRresult = json_LaTeX_MMS["latex_styled"]?.ToString();
                        //var Text = json_LaTeX_MMS["text"]?.ToString();

                        if (LaTeXRresult != "" && !String.IsNullOrEmpty(LaTeXRresult))
                        {
                            Clipboard.SetText(LaTeXRresult);
                            new OCR_Form(img, "公式已经复制到剪切板,使用CTRL+V黏贴至MathType中使用:\r\n-------------\r\n" + LaTeXRresult).Show();
                        }
                        else
                        {
                            new OCR_Form(img, "选中区域无法检测到公式,请重新框定公式。").Show();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            LoadingHelper.CloseForm();//关闭
            return(LaTeXRresult);
        }
Esempio n. 19
0
        private void btnRename_Click(object sender, EventArgs e)
        {
            var dia = MessageBox.Show("请确认是否进行重命名操作,请注意,如果遇到冲突的地方,本程序将使用默认设置为您解决(将会忽略有冲突的文件)", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dia == DialogResult.No)
            {
                return;
            }
            renameExcute = true;
            LoadingHelper.ShowLoading("正在进行中,请稍候。", this, o =>
            {
                this.Invoke((Action)ExcuteRename);
            });
        }
Esempio n. 20
0
    public void CheckRecommendedIntegrations()
    {
        // Missing Integrations?
        RecommendedIntegration[]? integrations;

        try {
            integrations = Helper.Data.ReadJsonFile <RecommendedIntegration[]>("assets/recommended_integrations.json");
            if (integrations == null)
            {
                Log("No recommendations found. Our data file seems to be missing.");
                return;
            }
        } catch (Exception ex) {
            Log($"Unable to load recommended integrations data file.", LogLevel.Warn, ex);
            return;
        }

        LoadingHelper.CheckIntegrations(this, integrations);
    }
Esempio n. 21
0
        public override void Load()
        {
            base.Load();
            LoadingHelper.Load();

            Instance  = ModContent.GetInstance <PboneUtils>();
            textures  = new ModTextureManager();
            recipes   = new ModRecipeManager();
            ui        = new ModUIManager();
            bagValues = new TreasureBagValueCalculator();

            modPacketManager = new ModPacketManager(this);
            crossModManager  = new CrossModManager();
            crossModManager.Load();

            Load_IL();
            Load_On();
            textures.Initialize();
            ui.Initialize();
        }
Esempio n. 22
0
        /// <summary>
        /// 发送Get 请求
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendGet_Click(object sender, EventArgs e)
        {
            txtGetResult.Text = "";
            string url  = txtGetUrl.Text;
            string data = txtGetData.Text;

            if (string.IsNullOrWhiteSpace(url))
            {
                MessageBox.Show("Get Url 未填写");
                return;
            }

            var getResultStr = "";

            LoadingHelper.ShowLoading("请求数据中,请耐心等待......", this, o =>
            {
                getResultStr = GetMethod(url, data);
            });
            txtGetResult.Text = getResultStr;
        }
Esempio n. 23
0
            // Start paint area
            public static void StartPaintArea()
            {
                if (Visualizer.GetGameObject() != null)
                {
                    // Set painting area to true
                    paintingArea = true;

                    // Record paint area start location
                    paintAreaStart   = Visualizer.GetGameObject().transform.position;
                    paintAreaStart.y = Settings.Data.gui.grid.gridHeight *
                                       Settings.Data.gui.grid.yUnitSize + Const.Grid.yOffsetToAvoidTearing;

                    // Create new Paint Area Visualizer
                    paintAreaVisualizer = GameObject.CreatePrimitive(PrimitiveType.Plane);
                    paintAreaVisualizer.transform.position = new Vector3(0f, 0f, 0f);
                    paintAreaVisualizer.name = "MAST_Paint_Area_Visualizer";

                    // Configure Paint Area Visualizer MeshRenderer
                    MeshRenderer paintAreaMeshRenderer = paintAreaVisualizer.GetComponent <MeshRenderer>();
                    paintAreaMeshRenderer.lightProbeUsage      = UnityEngine.Rendering.LightProbeUsage.Off;
                    paintAreaMeshRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
                    paintAreaMeshRenderer.shadowCastingMode    = UnityEngine.Rendering.ShadowCastingMode.Off;
                    paintAreaMeshRenderer.receiveShadows       = false;

                    // Configure Paint Area Visualizer Material
                    if (paintAreaMaterial == null)
                    {
                        paintAreaMaterial = LoadingHelper.GetPaintAreaMaterial();
                    }
                    paintAreaMeshRenderer.material = paintAreaMaterial;

                    // Hide the Paint Area Visualizer in the hierarchy
                    paintAreaVisualizer.hideFlags = HideFlags.HideInHierarchy;

                    // Update the paint area
                    UpdatePaintArea();
                }
            }
Esempio n. 24
0
        private void BtnAddFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog
            {
                Multiselect = false,
                Title       = "请选择文件",
                Filter      = "所有文件(*.*)|*.*"
            };

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                string filePath = openFile.FileName;
                Result result   = null;
                LoadingHelper.ShowLoading("文件上传中...", this, o =>
                {
                    //这里写处理耗时的代码,代码处理完成则自动关闭该窗口
                    PersonFileBLL personFileBLL = new PersonFileBLL();
                    result = personFileBLL.Add(PersonBasic.id, filePath);
                });

                FileStatus(result, "文件添加");
            }
        }
Esempio n. 25
0
        //个人基本建档记录历史表  关联传参调查询的方法
        private void querypBasicInfo()
        {
            time1 = this.dateTimePicker1.Text.ToString() + " 00:00:00"; //开始时间
            time2 = this.dateTimePicker2.Text.ToString() + " 23:59:59"; //结束时间
            this.dataGridView1.DataSource = null;
            LoadingHelper.myCaption       = "正在查询...";
            LoadingHelper.myLabel         = "正在查询数据...";
            LoadingHelper.ShowLoadingScreen();
            Thread.Sleep(50);
            try
            {
                DataTable dt = pBasicInfo.queryPersonalBasicInfo(pCa, time1, time2, xcuncode);
                //这里处理下对应的记录
                DataTable dtfinished = CreateDataTable();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dtfinished.NewRow();
                    dr[0] = dt.Rows[i][0].ToString();
                    dr[1] = dt.Rows[i][1].ToString();
                    dr[2] = dt.Rows[i][2].ToString();
                    dr[3] = dt.Rows[i][3].ToString();

                    #region 处理特殊标签
                    String _teshubiaoqian = "";
                    String _tmp           = dt.Rows[i]["age"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) >= 65)
                    {
                        _teshubiaoqian = "老";
                    }
                    else
                    {
                        if (int.Parse(_tmp) <= 6)
                        {
                            _teshubiaoqian = "儿童";
                        }
                    }


                    _tmp = dt.Rows[i]["is_gravida"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) != 0)
                    {
                        _teshubiaoqian = _teshubiaoqian + " 孕";
                    }

                    _tmp = dt.Rows[i]["is_hypertension"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) != 0)
                    {
                        _teshubiaoqian = _teshubiaoqian + " 高";
                    }

                    _tmp = dt.Rows[i]["is_diabetes"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) != 0)
                    {
                        _teshubiaoqian = _teshubiaoqian + " 糖";
                    }

                    _tmp = dt.Rows[i]["is_psychosis"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) != 0)
                    {
                        _teshubiaoqian = _teshubiaoqian + " 精";
                    }

                    _tmp = dt.Rows[i]["is_tuberculosis"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) != 0)
                    {
                        _teshubiaoqian = _teshubiaoqian + " 结";
                    }

                    _tmp = dt.Rows[i]["is_poor"].ToString();
                    if (_tmp == "")
                    {
                        _tmp = "0";
                    }
                    if (int.Parse(_tmp) != 0)
                    {
                        _teshubiaoqian = _teshubiaoqian + " 贫";
                    }
                    #endregion

                    dr[4] = _teshubiaoqian.Trim();
                    dr[5] = dt.Rows[i][4].ToString();
                    dr[6] = dt.Rows[i][5].ToString();
                    dr[7] = dt.Rows[i][6].ToString();
                    dtfinished.Rows.Add(dr);
                }
                this.dataGridView1.DataSource = dtfinished;
                dataGridView1.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("微软雅黑", 12, System.Drawing.FontStyle.Regular);
                this.dataGridView1.Columns[0].Visible            = false;
                this.dataGridView1.Columns[1].HeaderCell.Value   = "姓名";
                this.dataGridView1.Columns[2].HeaderCell.Value   = "档案编号";
                this.dataGridView1.Columns[3].HeaderCell.Value   = "身份证号";
                this.dataGridView1.Columns[4].HeaderCell.Value   = "重点人群标签";
                this.dataGridView1.Columns[5].HeaderCell.Value   = "创建人";
                this.dataGridView1.Columns[6].HeaderCell.Value   = "创建时间";
                this.dataGridView1.Columns[7].HeaderCell.Value   = "责任医生";

                this.dataGridView1.ReadOnly = true;
                this.dataGridView1.RowsDefaultCellStyle.ForeColor = Color.Black;
                this.dataGridView1.AllowUserToAddRows             = false;
                this.dataGridView1.AutoSizeColumnsMode            = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
                for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
                {
                    this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                }
                LoadingHelper.CloseForm();
            }
            catch (Exception ex)
            {
                LoadingHelper.CloseForm();
                MessageBox.Show("出错,请联系请联系管理员!" + ex.Message + "/r/n" + ex.StackTrace);
            }
        }
Esempio n. 26
0
        /// <summary>
        ///音频合成 点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnTextToVoice_Click(object sender, EventArgs e)
        {
            try
            {
                //登录参数,自己注册后获取的appid
                string login_configs = "appid=5983daf6";
                string text          = txtInput.Text.Trim();//待合成的文本
                uint   audio_len     = 0;

                if (string.IsNullOrEmpty(txtInput.Text.Trim()))
                {
                    txtInput.Text = "请输入合成语音的内容";
                    return;
                }

                var speekerCode = IFYDll.GetSpeekerCode(cboSpeeker.SelectedIndex);
                LoadingHelper.ShowLoading("加载中", this, o =>
                {
                    SynthStatus synth_status = SynthStatus.MSP_TTS_FLAG_STILL_HAVE_DATA;

                    //第一个参数为用户名,第二个参数为密码,第三个参数是登录参数,用户名和密码需要在http://open.voicecloud.cn
                    this.BeginInvoke(updateStatus, "登录接口");
                    ret = IFYDll.MSPLogin("*****@*****.**", "jkljlk123", login_configs);
                    //MSPLogin方法返回失败
                    if (ret != (int)ErrorCode.MSP_SUCCESS)
                    {
                        return;
                    }

                    string _params = $"ssm=1,ent=sms16k,vcn={speekerCode},spd=medium,aue=speex-wb;7,vol=x-loud,auf=audio/L16;rate=16000";
                    session_ID     = IFYDll.QTTSSessionBegin(_params, ref ret);
                    //QTTSSessionBegin方法返回失败
                    if (ret != (int)ErrorCode.MSP_SUCCESS)
                    {
                        return;
                    }

                    //发送待合成音频文本
                    this.BeginInvoke(updateStatus, "发送文字");
                    ret = IFYDll.QTTSTextPut(Ptr2Str(session_ID), text, (uint)Encoding.Default.GetByteCount(text), string.Empty);
                    //QTTSTextPut方法返回失败
                    if (ret != (int)ErrorCode.MSP_SUCCESS)
                    {
                        return;
                    }

                    //分块获取合成音频流
                    this.BeginInvoke(updateStatus, "获取合成语音");
                    MemoryStream memoryStream = new MemoryStream();
                    memoryStream.Write(new byte[44], 0, 44);
                    while (true)
                    {
                        IntPtr source = IFYDll.QTTSAudioGet(Ptr2Str(session_ID), ref audio_len, ref synth_status, ref ret);
                        byte[] array  = new byte[(int)audio_len];
                        if (audio_len > 0)
                        {
                            Marshal.Copy(source, array, 0, (int)audio_len);
                        }
                        memoryStream.Write(array, 0, array.Length);
                        Thread.Sleep(1000);
                        if (synth_status == SynthStatus.MSP_TTS_FLAG_DATA_END || ret != 0)
                        {
                            break;
                        }
                    }

                    WAVE_Header wave_Header = getWave_Header((int)memoryStream.Length - 44);
                    byte[] array2           = this.StructToBytes(wave_Header);
                    memoryStream.Position   = 0L;
                    memoryStream.Write(array2, 0, array2.Length);
                    memoryStream.Position = 0L;

                    //播放器 播放音频流
                    SoundPlayer soundPlayer = new SoundPlayer(memoryStream);
                    soundPlayer.Stop();
                    soundPlayer.Play();

                    //将音频流 保存为文件
                    if (filename != null)
                    {
                        FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write);
                        memoryStream.WriteTo(fileStream);
                        memoryStream.Close();
                        fileStream.Close();
                    }
                });
                this.BeginInvoke(updateStatus, "就绪");
            }
            catch (Exception ex)
            {
                txtInput.Text = ex.Message;
            }
            finally
            {
                //主动结束本次音频合成
                ret = IFYDll.QTTSSessionEnd(Ptr2Str(session_ID), "");

                //退出登录
                ret = IFYDll.MSPLogout();
            }
        }
Esempio n. 27
0
        string filename = $"Call.wav"; //合成的语音文件

        #endregion

        #region 事件处理

        /// <summary>
        /// 本地语音识别
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLocalVoice_Click(object sender, EventArgs e)
        {
            //业务流程:
            //1.调用 MSPLogin(...)接口登入,可以只登入一次,但是必须保证在调用其他接口前先登入;
            //2.调用 QISRSessionBegin(...)开始一次语音听写;
            //3.循环调用 QISRAudioWrite(...) 分块写入音频数据
            //4.循环调用 QISRGetResult(...) 接口返回听写结果
            //5.调用 QISRSessionEnd(...) 主动结束本次听写
            //6.不再使用服务的时候 调用MSPLogout()登出,避免不必要的麻烦。

            try
            {
                //识别结果
                string text = String.Empty;
                //登录参数,自己注册后获取的appid
                string login_configs = "appid=5983daf6";
                //语音路径
                var voicePath = AppDomain.CurrentDomain.BaseDirectory + filename;
                //检测文件是否存在
                if (!File.Exists(voicePath))
                {
                    MessageBox.Show("文件" + voicePath + "不存在!");
                }
                //读取音频文件
                using (FileStream fileStream = new FileStream(voicePath, FileMode.OpenOrCreate))
                {
                    IntPtr intPtr = Marshal.AllocHGlobal(BUFFER_NUM);
                    byte[] array  = new byte[BUFFER_NUM];


                    LoadingHelper.ShowLoading("加载中", this, o =>
                    {
                        AudioStatus audioStatus = AudioStatus.MSP_AUDIO_SAMPLE_CONTINUE;
                        EpStatus epStatus       = EpStatus.MSP_EP_LOOKING_FOR_READY;
                        RsltStatus recogStatus  = RsltStatus.MSP_REC_STATUS_FOR_READY;

                        //MSPLogin(...)接口登入
                        this.BeginInvoke(updateStatus, "登录接口");
                        ret = IFYDll.MSPLogin("*****@*****.**", "jkljlk123", login_configs);
                        if (ret != (int)ErrorCode.MSP_SUCCESS)
                        {
                            return;
                        }

                        //QISRSessionBegin 开始一次语音识别
                        this.BeginInvoke(updateStatus, "开始一次语音识别");
                        string _params = $"domain=iat,sub=iat,aue=speex-wb;7,sample_rate=16000,result_type=plain";
                        session_ID     = IFYDll.QISRSessionBegin(null, _params, ref ret);
                        if (ret != (int)ErrorCode.MSP_SUCCESS)
                        {
                            return;
                        }

                        //QISRAudioWrite 写入本次识别的音频。
                        this.BeginInvoke(updateStatus, "分块写入识别的音频");
                        while (fileStream.Position != fileStream.Length)
                        {
                            int waveLen = fileStream.Read(array, 0, BUFFER_NUM);
                            Marshal.Copy(array, 0, intPtr, array.Length);
                            ret = IFYDll.QISRAudioWrite(Ptr2Str(session_ID), intPtr, (uint)waveLen, audioStatus, ref epStatus, ref recogStatus);
                            if (ret != 0)
                            {
                                fileStream.Close();
                                throw new Exception("QISRAudioWrite err,errCode=" + ret);
                            }
                            Thread.Sleep(500);
                        }

                        this.BeginInvoke(updateStatus, "写入最后一块音频");
                        audioStatus = AudioStatus.MSP_AUDIO_SAMPLE_LAST;
                        ret         = IFYDll.QISRAudioWrite(Ptr2Str(session_ID), intPtr, 1u, audioStatus, ref epStatus, ref recogStatus);
                        if (ret != 0)
                        {
                            throw new Exception("QISRAudioWrite write last audio err,errCode=" + ret);
                        }

                        //QISRGetResult 读取识别结果
                        this.BeginInvoke(updateStatus, "读取识别结果");
                        while (true)
                        {
                            IntPtr intPtr2 = IFYDll.QISRGetResult(Ptr2Str(session_ID), ref recogStatus, waitTime, ref ret);
                            if (intPtr2 != IntPtr.Zero)
                            {
                                text += Ptr2Str(intPtr2);
                            }
                            if (ret != 0)
                            {
                                break;
                            }
                            Thread.Sleep(500);
                            if (recogStatus == RsltStatus.MSP_REC_STATUS_COMPLETE)
                            {
                                break;
                            }
                        }
                    });
                    txtLocalVoiceRecognitionResult.Text = text;
                }
            }
            catch (Exception ex)
            {
                txtLocalVoiceRecognitionResult.Text = ex.Message;
            }
            finally
            {
                //主动结束本次语音识别
                this.BeginInvoke(updateStatus, "结束本次识别结果");
                ret = IFYDll.QISRSessionEnd(Ptr2Str(session_ID), "");

                //退出登录
                this.BeginInvoke(updateStatus, "退出登录");
                ret = IFYDll.MSPLogout();
            }
            Thread.Sleep(3000);
            this.BeginInvoke(updateStatus, "就绪");
        }
Esempio n. 28
0
        public VerifyForm(InitVerify initVerify)
        {
            InitializeComponent();

            VerifyOverAll.site    = initVerify.Site;
            VerifyOverAll.softId  = initVerify.SoftId;
            VerifyOverAll.runForm = initVerify.RunForm;

            LoadingHelper.ShowLoading("正在初始化软件.....请耐心稍等....", this, o =>
            {
                try
                {
                    VerifyApiLaunch.site = VerifyOverAll.site;

                    VerifyOverAll.rsaPublicKey = VerifyApiLaunch.getRsaPublicKey();

                    VerifyApiLaunch.getSoftDesc
                    (
                        VerifyOverAll.softId,
                        out VerifyOverAll.notice,
                        out VerifyOverAll.name,
                        out VerifyOverAll.dosingStrategy,
                        out VerifyOverAll.registerStatus,
                        out VerifyOverAll.registeCloseMsg,
                        out VerifyOverAll.serviceStatus,
                        out VerifyOverAll.serviceCloseMsg,
                        out VerifyOverAll.changeStrategy
                    );

                    if (VerifyOverAll.serviceStatus == 2)
                    {
                        MessageBox.Show(VerifyOverAll.serviceCloseMsg.Replace("\n", "\r\n"), "软件开放使用提示");
                        System.Environment.Exit(0);
                    }
                    else if (VerifyOverAll.serviceStatus == 0)
                    {
                        toolStripStatusLabel2.Text = "软件类型:收费软件";
                    }
                    else if (VerifyOverAll.serviceStatus == 1)
                    {
                        toolStripStatusLabel2.Text = "软件类型:免费软件";
                    }
                    if (VerifyOverAll.serviceStatus == 0)
                    {
                        linkLabelOpenRecharge.Visible = true;
                    }
                    if (VerifyOverAll.changeStrategy == 0)
                    {
                        linkLabelOpenExchange.Visible = true;
                    }

                    this.Text          = VerifyOverAll.name;
                    textBoxNotice.Text = VerifyOverAll.notice.Replace("\n", "\r\n");
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "未知错误");
                    System.Environment.Exit(0);
                }
            });

            // 初始化配置
            try
            {
                checkBoxRemember.Checked = Convert.ToBoolean(fileIniConfig.ReadFile(INI_FILE)["input"]["remember"]);
                if (checkBoxRemember.Checked == true)
                {
                    textBoxAccount.Text  = fileIniConfig.ReadFile(INI_FILE)["input"]["account"];
                    textBoxPassword.Text = fileIniConfig.ReadFile(INI_FILE)["input"]["password"];
                }
            }
            catch (Exception ex)
            {
                FileOp.WriteFile(INI_FILE);
            }
        }
Esempio n. 29
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            using (var loading = new LoadingHelper(LoadingType.Progress, this))
            {
                loading.SetPosition(20, "正在加载页面".GetL());
                MakeDataItem  = MakeData_item;
                OutputConsole = new OutputConsole(this);
                foreach (TabItemClose item in tabcontol.Items)
                {
                    item.Visibility = Visibility.Collapsed;
                }

                #region 激活校验

                /*
                 * 不启用激活校验
                 */
                //if (Common.Key() != Common.SetConfig("Password"))
                //{
                //    JiHuo ji = new JiHuo();
                //    ji.ShowDialog();
                //    if (Common.Key() != Common.SetConfig("Password"))
                //        this.Close();
                //}

                //if (Common.SetConfig("Date") == "0")
                //{
                //    this.Close();
                //}
                //else
                //{
                //    Common.SetConfig("Date", (Convert.ToInt32(Common.SetConfig("Date")) - 1).ToString());
                //}
                #endregion


                loading.SetPosition(50, "正在加载模型".GetL());
                LoadMode();

                //打开更新日志界面
                if (Common.SetConfig("Update") == "0")
                {
                    UpdateDesc u = new UpdateDesc();
                    u.ShowDialog();
                    if (u.IsChecked())
                    {
                        Common.SetConfig("Update", "1");
                    }
                }

                loading.SetPosition(80, "正在加载未保存的页面".GetL());
                InitUncloseFile();
                //RunNotifyBox();
                consolecc.Content = new Frame()
                {
                    Content = OutputConsole
                };
                loading.SetPosition(100, "加载完成".GetL());
                System.Threading.Thread.Sleep(200);
            }
        }