// private OpenDialogView openDialog ;
        /// <summary>
        /// 启动加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            pb1.Visibility = Visibility.Hidden;
            pb1.Maximum    = 100;
            pb1.Value      = 1;

            //加载区域列表
            AreaComboBox.ItemsSource       = QiniuArea.GetList();
            AreaComboBox.DisplayMemberPath = "Name";
            AreaComboBox.SelectedValuePath = "ZoneValue";
            AreaComboBox.SelectedIndex     = 0;

            //从配置文件中载入Ak和Sk(QiNiuClientCfg.Json)
            if (File.Exists("QiNiuClientCfg.Json"))
            {
                string json = File.ReadAllText("QiNiuClientCfg.Json");
                qiNiuClientCfg = JsonConvert.DeserializeObject <QiNiuClientCfg>(json);
                if (qiNiuClientCfg != null)
                {
                    TxtAK.Text = qiNiuClientCfg.Ak;
                    TxtSk.Text = qiNiuClientCfg.Sk;
                    if (qiNiuClientCfg.DeleteAfterDays.HasValue)
                    {
                        txtDelAfDays.Text = qiNiuClientCfg.DeleteAfterDays.Value.ToString();
                    }
                }
            }
            else
            {
                qiNiuClientCfg = new QiNiuClientCfg {
                    DeleteAfterDays = 365
                };
                TxtAK.Text        = "";
                TxtSk.Text        = "";
                txtDelAfDays.Text = "365";
            }

            ConnectServer();


            //#region 居中显示

            //double screeHeight = SystemParameters.FullPrimaryScreenHeight;
            //double screeWidth = SystemParameters.FullPrimaryScreenWidth;
            //Top = (screeHeight - this.Height) / 2;
            //Left = (screeWidth - this.Width) / 2;

            //#endregion

            marker = "";
        }
示例#2
0
        // private OpenDialogView openDialog ;
        /// <summary>
        /// 启动加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            pb1.Visibility = Visibility.Hidden;
            pb1.Maximum    = 100;
            pb1.Value      = 1;

            //加载区域列表
            AreaComboBox.ItemsSource       = QiniuArea.GetList();
            AreaComboBox.DisplayMemberPath = "Name";
            AreaComboBox.SelectedValuePath = "ZoneValue";
            AreaComboBox.SelectedIndex     = 0;

            //从配置文件中载入Ak和Sk(QiNiuClientCfg.Json)
            if (File.Exists("QiNiuClientCfg.Json"))
            {
                string json = File.ReadAllText("QiNiuClientCfg.Json");
                qiNiuClientCfg = JsonConvert.DeserializeObject <QiNiuClientCfg>(json);
                if (qiNiuClientCfg != null)
                {
                    TxtAK.Text = qiNiuClientCfg.Ak;
                    TxtSk.Text = qiNiuClientCfg.Sk;
                    if (qiNiuClientCfg.DeleteAfterDays.HasValue)
                    {
                        txtDelAfDays.Text = qiNiuClientCfg.DeleteAfterDays.Value.ToString();
                    }
                }
            }
            else
            {
                qiNiuClientCfg = new QiNiuClientCfg {
                    DeleteAfterDays = 365
                };
                TxtAK.Text        = "";
                TxtSk.Text        = "";
                txtDelAfDays.Text = "365";
            }
            if (!string.IsNullOrWhiteSpace(TxtAK.Text) && !string.IsNullOrWhiteSpace(TxtSk.Text))
            {
                ConnectServer();
            }


            marker = "";
        }