小编Jan*_*gel的帖子

匹配区别联合时的通配符

在下面的真实世界的例子中我做了一个匹配:

type Style = Nice | Cool | Ugly
type Color = Blue | Yellow | Orange | Grey | Cyan
type ClothingProperties = Style * Color

type Clothes =
| Jeans of ClothingProperties
| Pullover of ClothingProperties
| Shirt of ClothingProperties

type Person =
| Person of string * Clothes

let team = [Person("Jan", Jeans (Cool, Blue)); Person("Pete", Shirt (Nice, Cyan)); Person("Harry", Pullover (Ugly, Grey))]

let matchPerson person=
    match person with
    | Person(name,  Jeans(Ugly,_) ) -> printfn "%s wears …
Run Code Online (Sandbox Code Playgroud)

f# functional-programming pattern-matching discriminated-union

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

检测应用程序是否固定在任务栏上

我有一个C#/ WPF应用程序,根据它是否已从Windows任务栏上的固定链接启动,我希望给出不同的行为。

  1. 有没有办法检测我的应用程序是否已固定到任务栏?
  2. 有没有一种方法可以检测我的应用程序是否已从任务栏上的固定项目启动?

c# windows wpf taskbar

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

具有多个对象流的活动图中的决策

我尝试将问题简化为以下简单示例。如果利润低并且客户不是常客,那么订单应该被取消。在所有其他情况下(低/常规、高/*),订单将被执行。我应该如何对中间断开的部分进行建模? 活动图示例 根据数据模型判断订单对应的客户端是否为普通客户端:

数据模型中的详细信息

uml

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