小编Tat*_*ved的帖子

WPF 将复选框绑定到布尔值?

我有一个绑定到 ViewModel 可为空的布尔属性的 WPF 复选框。我在构造函数中将此属性设置为 false 或 true,以避免出现 Interminent 状态,但无论我做什么,复选框的初始状态都保持灰色。绑定工作得很好,因为一旦我通过单击 UI 上的复选框更改状态,我就会获得控件值(真/假)。有任何想法吗?

XAML:

<CheckBox Margin="0,4,0,3"
          VerticalAlignment="Center"
          Content="Mutual"
          IsChecked="{Binding MutualChb}" />
Run Code Online (Sandbox Code Playgroud)

视图模型:

public ContstrutorViewModel()
{
    MutualChb = true;
}

private bool? _mutualChb;
public bool? MutualChb
{
    get { return _mutualChb; }
    set
    { 
        _mutualChb = value; 
        _mutualChb = ( _mutualChb != null ) ? value : false;
        OnPropertyChanged("MutualChb");
    }
}
Run Code Online (Sandbox Code Playgroud)

c# wpf checkbox xaml mvvm

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

这两个表达有什么区别

#include <bits/stdc++.h>
using namespace std;
void test(){
    int a = 100;
    cout << a << endl;
}
int main()
{
    void(*b)() = test;
    (*b)();         //expression one
    b();            //expression two
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

test是一个函数指针,不是吗?(*b)()是正确的形式,因为它相当于函数原型。但为什么删除一个符号是正确的呢*?他们都产生了正确的结果。

c++

6
推荐指数
1
解决办法
210
查看次数

阻止Visual Studio在启动时连接到Team Foundation Server

Visual Studio会在启动时自动尝试连接到Team Foundation Server,但有时当您经常更改TFS服务器时,Visual Studio在尝试连接到上次使用的TFS时需要很长时间才能超时.

怎么能被禁用?

registry tfs visual-studio

5
推荐指数
1
解决办法
3771
查看次数

SSMS 2016 - 移动报告 - 创建自定义控件

是否可以为SQL Server Mobile Report发布者创建自定义(自己的)控件?意思是自己的图形(Gauges),样式,地图等......

我无法在Google(或其他类似SO网站)上找到有关此主题的任何信息.几天前,我们与一些开发人员(报告的基础知识)进行了讲座/培训,他很快就说有可能,但我们没有时间去完成它.

我的期望(作为答案)是解释可以使用什么工具和/或链接到教程.

可能还有一些信息(有源),这在2016版本中无法创建.

report custom-controls reporting-services powerbi ssms-2016

5
推荐指数
1
解决办法
283
查看次数

展开结果视图将枚举 IEnumerable

我想要有人帮忙。我想执行一个 MS SQL(SELECT 语句)。数据源连接建立起来,下面的源码都运行无误。但是,在阅读器对象中,结果视图是空白的。此错误消息是:展开结果视图将枚举 IEnumerabl。SELECT 命令被记录下来。我在 SQL 管理器应用程序上单独运行它并得到结果,语法是一个很好的 SQL 命令。我做错了什么?

// **********************  SQL Connect building   ****************************
SqlConnection myMSSQLConn;
SqlCommand SQL_command = new SqlCommand(); 
SqlDataReader reader;

try //MS SQL connect building
{
    myMSSQLConn = new SqlConnection(AccInstance.SQL_myConnection_string);
}
catch (Exception ex)
{
    AccInstance._MasterErrorText = "Connect error" + ex;
    AccInstance.Messages("39", "");
    return 0;
}

// "SELECT TOP 1 CITYS.V_NUM FROM dbo.CITYS ORDER BY CITYS.V_NUM DESC"
SQL_command.CommandText = MSSQLOperation_command; 
SQL_command.CommandType = CommandType.Text;
SQL_command.Connection = myMSSQLConn;
myMSSQLConn.Open();
reader = SQL_command.ExecuteReader();

while (reader.Read())
{
    MessageBox.Show(reader.GetValue(0)
               + …
Run Code Online (Sandbox Code Playgroud)

c# ienumerable visual-studio visual-studio-debugging

5
推荐指数
1
解决办法
9379
查看次数

持久函数可以有多个触发器吗?

我有一个持久函数,每天由计时器触发器触发一次:

[FunctionName("MyDurableFunction")]
public static async Task Run(
    [TimerTrigger("0 0 23 * * *", RunOnStartup = false)] TimerInfo myTimer,
    [OrchestrationClient] DurableOrchestrationClient starter,
    ILogger log)
{
    await starter.StartNewAsync("OrchestrationFunction", null);
}

[FunctionName("OrchestrationFunction")]
public static async Task OrchestrationFunction(
    [OrchestrationTrigger]DurableOrchestrationContext context,
    ILogger log)
{
    // do stuff
}
Run Code Online (Sandbox Code Playgroud)

这很好用。出于测试目的,我还希望能够通过 Http 触发器触发持久功能,因此我添加了以下内容:

[FunctionName("MyDurableFunctionHttpTrigger")]
public static async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "demo")]HttpRequest req, 
    [OrchestrationClient] DurableOrchestrationClient starter, 
    ILogger log)
{
    await starter.StartNewAsync("OrchestrationFunction", null);
    return new OkObjectResult("blah");
}
Run Code Online (Sandbox Code Playgroud)

在本地运行这些触发器(包括 http 触发器或计时器触发器)将触发该函数,但将两者都包含在类中意味着这两个触发事件都不会发生。是否可以让多个触发器类型启动编排触发器?

c# azure-functions azure-durable-functions

5
推荐指数
1
解决办法
2969
查看次数

使用没有外部变量的LINQ从字典(值)中Concat所有字符串

拥有字典,其中键可以是任何东西(例如int)和值是我想要输出的一些文本.

Dictionary<int, string> dict = new Dictionary<int, string>();

dict.Add(1, "This is the first line.");
dict.Add(2, "This is the second line.");
dict.Add(3, "This is the third line.");
Run Code Online (Sandbox Code Playgroud)

获得输出:

string lResult = dict. ... //there should go the LINQ query
Console.WriteLine(lResult);
Run Code Online (Sandbox Code Playgroud)

输出:

This is the first line.
This is the second line.
This is the third line.
Run Code Online (Sandbox Code Playgroud)

问:是否有可能将这些行连接起来Dictionary,将它们作为一个字符串而不使用外部变量?


我试过使用一些Select/SelectMany/Zip解决方案,但我无法想象如何在不使用外部变量的情况下将1 LINQ调用的值传递给其他人.

另一个想法是Select值,将它们放到List然后连接(再次使用外部变量).喜欢:

string tmp = "";
dict.Select(a => a.Value).ToList().ForEach(b => tmp += b);
Run Code Online (Sandbox Code Playgroud)

c# linq dictionary concat

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

为什么Point.Offset()没有在readonly结构中给出编译器错误?

也许我误解了readonly结构的概念,但我认为这段代码不应该编译:

public readonly struct TwoPoints
{
    private readonly Point one;
    private readonly Point two;

    void Foo()
    {
        // compiler error:  Error CS1648  Members of readonly field 'TwoPoints.one'
        // cannot be modified (except in a constructor or a variable initializer)
        one.X = 5;

        //no compiler error! (and one is not changed)
        one.Offset(5, 5);
    }
 }
Run Code Online (Sandbox Code Playgroud)

(我正在使用C#7.3.)我错过了什么?

.net c# struct readonly-attribute

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

什么是以及如何从我的数据库中删除表空间错误?

由于加载问题,我的数据库中的一个表被破坏了.我放弃了桌子,现在我想再次创建桌子.

我收到这个错误:

ERROR 1813:表格的表空间zorkif.sys_user_accounts'存在.请在IMPORT之前丢弃表空间.

SQL语句:

CREATE  TABLE `zorkif`.`sys_user_accounts` (
    `UserID` INT NOT NULL AUTO_INCREMENT ,    
    PRIMARY KEY (`UserID`) ,    
    UNIQUE INDEX `UserID_UNIQUE` (`UserID` ASC)
)
Run Code Online (Sandbox Code Playgroud)

什么是表空间以及如何丢弃此表空间?我必须在查询中运行任何命令吗?如何处理这个问题?

mysql mysql-workbench

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

如何在wpf(DataGrid)中格式化TimeSpan?

我将 TimeSpan 以刻度为单位保存到 SqlCe 中,当我将数据加载到 DataGrid 中时,我想以 HH:MM:SS 格式设置该值。我用这个试试:

<DataGridTextColumn Binding="{Binding tiempo, StringFormat={}{0:hh':'mm':'ss}, TargetNullValue=' --- '}"  Width="80" Header="Tiempo"/>
Run Code Online (Sandbox Code Playgroud)

但 DataGrid 显示“hh:mm:ss”而不是值。

我也尝试尝试其他模式,例如 StringFormat="hh\:mm\:ss"

任何想法?

谢谢!抱歉我的英语不好!

c# format wpf datagrid timestamp

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