小编ond*_*vic的帖子

Windows表单应用程序命令行参数

我搜索了谷歌,在这里找到了很多例子,但我似乎无法运行我的Windows窗体应用程序并从命令行获取参数.我真的希望能够在没有控制台版本的情况下安排应用程序.但每次我设置cmd行参数时,它都会出现CLR20r3错误.

static void Main(string[] args)
{
   if(args != null && args.Length > 0)
   {
      /*
      * arg[1] = Backup Location *require
      * arg[2] = Log File - Enable if present *optional
      * arg[3] = Debug Messages - Enabled if present *optional
      * arg[4] = Backup Type - Type to perform *required
      */

   }
   else
   {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);
     Application.Run(new Form1());
   }
}
Run Code Online (Sandbox Code Playgroud)

任何时候我试图传递一个arg它错误ex

myapp.exe"C:\ Backup \"=> CLR20r3

c# command-line-arguments winforms

4
推荐指数
1
解决办法
2万
查看次数

C#:如何在创建zip文件时报告进度?

更新:让它工作更新我的工作代码

这是我到目前为止所拥有的

 private async void ZipIt(string src, string dest)
    {
        await Task.Run(() =>
        {
            using (var zipFile = new ZipFile())
            {
                // add content to zip here 
                zipFile.AddDirectory(src);
                zipFile.SaveProgress +=
                    (o, args) =>
                    {
                        var percentage = (int)(1.0d / args.TotalBytesToTransfer * args.BytesTransferred * 100.0d);
                        // report your progress
                        pbCurrentFile.Dispatcher.Invoke(
                            System.Windows.Threading.DispatcherPriority.Normal,
                            new Action(
                            delegate()
                            {

                                pbCurrentFile.Value = percentage;
                            }
                            ));
                    };
                zipFile.Save(dest);
            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

我需要弄清楚如何更新我的进度条,但不确定我是否在正确的轨道上我已经搜索过并找到了很多关于Windows窗体和vb.net的例子,但是wpf c#没有想知道是否有人可以提供帮助.

c# wpf dotnetzip progress-bar

3
推荐指数
1
解决办法
6774
查看次数

章鱼Web.config转换为客户端端点地址

我有一个Web项目,该项目使用位于客户端->终结点->地址部分下的Web.config文件中的两个服务终结点

我在“章鱼变量”部分找到了以下内容,但似乎找不到像平时一样如何使用和实际变量解决更改的任何参考

我正在使用用于章鱼的webui

http:// {服务器名称} / app#/ projects / {项目名称} /变量

可变替代句法

我试图像这样分配变量,但是值从未更新,原始条目如下所示

<endpoint address="http://services-test.example.com/test.svc/soap" binding="basicHttpBinding" bindingConfiguration="soap" contract="test.service" name="soap" />

Name                    Address                         Instance   
Endpoint[A].Address     test-service-a.example.com      1
Endpoint[B].Address     test-service-b.example.com      2
Run Code Online (Sandbox Code Playgroud)

使用章鱼变量是否有可能做到这一点?(我知道可以使用常规的Web.config转换来完成此操作,因为我们已经这样做了)。

如果可能的话,正确的替换值是多少

端点地址

是,我将如何针对多个不同的端点地址完成此操作?

web-config octopus-deploy web.config-transform

2
推荐指数
1
解决办法
1212
查看次数

CSS背景 - 图像没有显示

我正在尝试使用CSS设置背景图像,但我似乎无法正确填充图像.

这是我想要做的CSS

 a.fb {
   background-image: url('img/Facebook.png');
 }

 a.fb:hover {
  background-image: url('img/FacebookHover.png');
 }
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的HTML代码,我尝试了几种不同的方法来填充图像,没有运气

<div class="footer">
     <a class="fb" href="http://www.facebook.com" target="_blank"></a>
</div>
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激

好的,添加了以下内容,仍然没有任何其他想法

 a.fb {
    display:block;
    width: 33px;
    height: 33px
    background-image: url('img/Facebook.png');
 }
Run Code Online (Sandbox Code Playgroud)

编辑:Yup让它工作现在忘了; 在高度之后,但是没有我在它周围有一个白色边框并尝试设置border:none; 没运气

a.fb {
    border: none;
    display:block;
    width: 33px;
    height: 33px;
    background-image: url('img/Facebook.png');
 }
Run Code Online (Sandbox Code Playgroud)

html css

0
推荐指数
1
解决办法
118
查看次数

Await Task.Run等到完成然后再做一个动作

这是代码,问题是如何跟踪完成后再运行其他内容?尝试将完成的zip复制到存储位置

private async void ZipFolder(string src, string dest, bool delete)  
{
    await Task.Run(() =>
    {
        using (var zipFile = new ZipFile())
        {
            // add content to zip here 
            zipFile.AddDirectory(src);
            zipFile.SaveProgress +=
                (o, args) =>
                {
                    var percentage = (int)(1.0d / args.TotalBytesToTransfer * args.BytesTransferred * 100.0d);
                    // report your progress
                    pbCurrentFile.Dispatcher.Invoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        new Action(
                        delegate()
                        {
                            lblCurrentFile.Content = "Compressing " + src;
                            pbCurrentFile.Value = percentage;
                        }
                        ));
                };
            zipFile.Save(dest);

            if(delete)
            {
                Directory.Delete(src, true);
            }

        }

    });
}
Run Code Online (Sandbox Code Playgroud)

c# async-await

0
推荐指数
1
解决办法
2666
查看次数