public async void EnableLoaclApi()
        {
            if (ApiUpdateInfo == "ApiUpdate" || !Directory.Exists(Api.ApiFilePath1) || !Directory.Exists(Api.ApiFilePath2))
            {
                IPendingHandler pb = PendingBox.Show("初始化信息接口中...", null, false, Application.Current.MainWindow, new PendingBoxConfigurations()
                {
                    MinHeight = 110,
                    MaxHeight = 110,
                    MinWidth  = 280,
                    MaxWidth  = 280
                });

                await Task.Run(() =>
                {
                    Api.ApiStart(music.apiver, music.zipurl);
                    while (!Api.ok)
                    {
                    }
                });

                if (!Api.SetCookie(music.qqcookie))
                {
                    AduMessageBox.Show("初始化错误", "提示");
                    Api.StopApi();
                    Environment.Exit(0);
                }
                pb.Close();
            }
            else
            {
                IPendingHandler pb = PendingBox.Show("启动服务中...", null, false, Application.Current.MainWindow, new PendingBoxConfigurations()
                {
                    MinHeight = 110,
                    MaxHeight = 110,
                    MinWidth  = 280,
                    MaxWidth  = 280
                });
                await Task.Run(() =>
                {
                    Api.ApiStart(music.apiver, music.zipurl);
                    while (!Api.ok)
                    {
                    }
                });

                if (!Api.SetCookie(music.qqcookie))
                {
                    AduMessageBox.Show("服务启动错误", "提示");
                    Api.StopApi();
                    Environment.Exit(0);
                }
                pb.Close();
            }
            music.NeteaseApiUrl = "http://127.0.0.1:" + Api.port1 + "/";
            music.QQApiUrl      = "http://127.0.0.1:" + Api.port2 + "/";
        }
Esempio n. 2
0
        private void Analyse(object parameter)
        {
            if (backgroundWorker.IsBusy)
            {
                return;
            }
            plate      = Plate;//后台线程访问会有问题,赋值个临时字段解决
            deviceName = DeviceName;
            backgroundWorker.RunWorkerAsync();
            PendingBoxConfigurations configurations = new PendingBoxConfigurations();

            configurations.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            pendingHandler = PendingBox.Show(string.Format("正在分析日志文件...({0}%)", 0), "请等待", false, Application.Current.MainWindow, configurations);
        }
Esempio n. 3
0
        private void AnalyseXmpp(object parameter)
        {
            if (backgroundWorkerXmpp.IsBusy)
            {
                return;
            }
            this.XmppResult = "";
            filterText      = FilterText;

            backgroundWorkerXmpp.RunWorkerAsync();
            PendingBoxConfigurations configurations = new PendingBoxConfigurations();

            configurations.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            pendingHandler = PendingBox.Show(string.Format("正在分析日志文件...({0}%)", 0), "请等待", false, Application.Current.MainWindow, configurations);
        }
        private async void DownloadNodejsButton_Click(object sender, RoutedEventArgs e)
        {
            IPendingHandler pb = PendingBox.Show("下载中......", null, false, Application.Current.MainWindow, new PendingBoxConfigurations()
            {
                MinHeight = 110,
                MaxHeight = 110,
                MinWidth  = 280,
                MaxWidth  = 280
            });
            await Task.Run(new Action(() =>
            {
                Api.DownloadNodejs();
                while (!Api.NodejsDownloadSuc)
                {
                }
            }));

            pb.Close();
        }
        public async void PendingBox(string cap)
        {
            IPendingHandler handler = null;

            switch (cap)
            {
            case "normal":
                handler = PendingBoxX.Show("Processing .....", "Normal", true, Application.Current.MainWindow);
                break;
            }
            if (handler != null)
            {
                handler.Cancelling += Handler_Cancelling;
                await Task.Delay(2000);

                handler.UpdateMessage("Almost complete ...");
                await Task.Delay(4000);

                handler.Close();
            }
        }
        public async void EnableLoaclApi()
        {
            if (ApiUpdateInfo == "ApiUpdate" /*|| !Directory.Exists(Api.ApiFilePath1)*/ || !Directory.Exists(Api.ApiFilePath2))
            {
                IPendingHandler pb = PendingBox.Show("初始化信息接口中...", null, false, Application.Current.MainWindow, new PendingBoxConfigurations()
                {
                    MinHeight = 110,
                    MaxHeight = 110,
                    MinWidth  = 280,
                    MaxWidth  = 280
                });

                await Task.Run(() =>
                {
                    bool r = Api.ApiStart(music.apiver, music.zipurl);
                    if (!r)
                    {
                        Dispatcher.Invoke(new Action(() => { setting.EnableLoacApi = false; pb.Close(); AduMessageBox.Show("服务启动错误", "提示"); }));
                    }
                    while (!Api.ok)
                    {
                    }
                });

                if (!Api.SetCookie(music.qqcookie))
                {
                    AduMessageBox.Show("初始化错误", "提示");
                    Api.StopApi();
                    Environment.Exit(0);
                }
                pb.Close();
            }
            else
            {
                IPendingHandler pb = PendingBox.Show("启动服务中...", null, false, Application.Current.MainWindow, new PendingBoxConfigurations()
                {
                    MinHeight = 110,
                    MaxHeight = 110,
                    MinWidth  = 280,
                    MaxWidth  = 280
                });
                await Task.Run(() =>
                {
                    bool r = Api.ApiStart(music.apiver, music.zipurl);
                    Dispatcher.Invoke(new Action(() =>
                    {
                        if (!r)
                        {
                            AduMessageBox.Show("服务启动错误(调用错误)", "提示");
                        }
                    }));

                    while (!Api.ok)
                    {
                    }
                });

                System.Threading.Thread.Sleep(1000);
                if (!Api.SetCookie(music.qqcookie))
                {
                    AduMessageBox.Show("服务启动错误(Cookie设置错误)", "提示");
                    Api.StopApi();
                    Environment.Exit(0);
                }
                pb.Close();
            }
            //music.NeteaseApiUrl = "http://127.0.0.1:" + Api.port1 + "/";
            music.QQApiUrl = "http://127.0.0.1:" + Api.port2 + "/";
        }
 private void Handler_Cancelling(IPendingHandler sender, Panuon.UI.Silver.Core.PendingBoxCancellingEventArgs e)
 {
     sender.Close();
 }