Beispiel #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region 判断依赖是否保存
            var dependencies = DependenceHelper.Get(type);
            if (dependencies == null || dependencies.Count <= 0)
            {
                // 弹出编辑依赖的窗口
                ShowDependenceDialog();
                return;
            }
            lbDependencies.Content = $"共有{dependencies.Count}个依赖";
            #endregion

            #region 赋值
            var serviceModel = LocalDataHelper.Get(_dte.ActiveDocument.FullName);

            var configServiceName = serviceModel.ConfigServiceName ?? "";
            if (serviceModel.ServiceName == configServiceName)
            {
                configServiceName = "";
            }

            tbServiceName.Text = serviceModel.ServiceName ?? "";
            tbPort.Text        = serviceModel.Port <= 0 ? "" : serviceModel.Port.ToString();
            #endregion
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region 判断依赖是否保存
            // Nuget包的生成才需要
            lbDependencies.Visibility = Visibility.Hidden;
            if (_genType == EnumGenType.AsyncClientNuget)
            {
                var type         = "thrift_" + ThriftGlobal.GenAsyncVersion.ToString();
                var dependencies = DependenceHelper.Get(type);
                if (dependencies == null || dependencies.Count <= 0)
                {
                    ShowDependenceDialog();
                    return;
                }
                lbDependencies.Content    = $"共有{dependencies.Count}个依赖";
                lbDependencies.Visibility = Visibility.Visible;
            }
            #endregion

            #region 赋值
            var serviceModel = LocalDataHelper.Get(_dte.ActiveDocument.FullName);

            var configServiceName = serviceModel.ConfigServiceName ?? "";
            if (serviceModel.ServiceName == configServiceName)
            {
                configServiceName = "";
            }

            tbServiceName.Text       = serviceModel.ServiceName ?? "";
            tbConfigServiceName.Text = configServiceName;
            tbPort.Text    = serviceModel.Port <= 0 ? "" : serviceModel.Port.ToString();
            tbNugetId.Text = serviceModel.NugetId ?? "";
            #endregion
        }