小编Cla*_*sen的帖子

基于角色的内容asp.net mvc

我希望在ASP.NET MVC中显示取决于活动用户的给定角色的内容.

使用WebForms比较旧的时尚方式:

protected void Page_Load(Object sender, EventArgs e)
{
   if(User.IsInRole("Administrator")) {
       adminLink.Visible = true;
   }
}
Run Code Online (Sandbox Code Playgroud)

现在,在使用ASP.NET MVC时,我将如何继续编写?从我的角度来看,将它直接放在视图文件中是错误的,并且为每个视图分配一个变量也不是很好.

asp.net-mvc

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

如何在Bing Maps Control中添加"你在这里"标记

如何在Bing Maps控件中添加"你在这里"标记?在电话上,这表示为正方形内的圆圈,然后有一个表示位置精度的外圆.
看起来你可以使用图钉和polgon来做,但我希望有一个更容易/更好的方法

bing-maps windows-phone

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

Listbox,WP7中的图像加载问题

我有一个Listbox,其中每个元素都有一个已经存储为内容的图像.我选择使用转换器显示的图像.

如果相应值的图像不存在,我必须显示我在ImageFailed事件中处理的默认图像.

问题是当我运行程序时,我得到了一些已经存在的图像的默认图像.如果我向下滚动列表框并再次备份,有时正确显示的图像将显示默认图像.这似乎是一个性能问题.

我是应用程序开发的新手,让我知道任何细节,即使它对你来说似乎微不足道.

以下是我的实施

<ListBox DataContext="{Binding}">
    <ListBox.ItemTemplate>
        <DataTemplate>
                <StackPanel>
                            <Image Width="90" Height="67" Source="{Binding id,Converter={StaticResource imageConverter}}" ImageFailed="ImageFailed" />
                             _
                             _
                    </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)

转换功能

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
       string Id = (string)value;
   string imagePath;
   imagePath = string.Format(AppDefines.channelLogoImgPath, prgSvcId);
   return imagePath;
}
Run Code Online (Sandbox Code Playgroud)

ImageFailed处理程序

private void ImageFailed(object sender, ExceptionRoutedEventArgs e)
{
    Image Img = (Image)sender;
    string imgPath = Defines.defImagePath
    Uri uri = new Uri(imgPath, UriKind.RelativeOrAbsolute);
    BitmapImage bDefImage = new BitmapImage(uri);
    Img.Source = bDefImage;
}
Run Code Online (Sandbox Code Playgroud)

.net c# silverlight windows-phone-7

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

如何枚举XAP中包含为"内容"的图像?

我在部署的芒果XAP中包含了许多图像作为"内容".

我想在运行时列举这些 - 有什么办法可以做到这一点吗?

我已经尝试枚举如下资源:

foreach (string key in Application.Current.Resources.Keys)
{
    Debug.WriteLine("Resource:" + key);
}
Run Code Online (Sandbox Code Playgroud)

但图像不包含在列表中.我也尝试过使用嵌入式资源 - 但这并没有帮助.我可以阅读使用的流,Application.GetResourceStream(uri)但显然我需要知道这些名称才能做到这一点.

silverlight resources windows-phone-7

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

将VisualStateManager.VisualStateGroups分隔为资源字典

有没有办法把它VisualStateManager.VisualStateGroups分成一个ResourceDictionary

基本上我想要的东西

<VisualStateManager.VisualStateGroups x:Name="MyVisualGroups">
    <VisualStateGroup x:Name="A" />
    <VisualStateGroup x:Name="B" />
    <VisualStateGroup x:Name="C" />
</VisualStateManager.VisualStateGroups>
Run Code Online (Sandbox Code Playgroud)

但它显然不起作用.有什么方法可以使它工作?

silverlight wpf xaml windows-phone-7

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

获取字符串中的最后一个字符

我是开发Windows手机应用程序的新手.现在我正在用T9键盘创建一个文本信使应用程序,我已经设计了像按钮一样的设计.现在我想要的是如何获得字符串中的最后一个字符?字符串示例为"clyde",如何从该字符串中获取char'e'?我使用Visual Basic作为语言.

更新:现在工作了,我使用了这段代码:

string s = "clyde";
char e = s(s.Length-1);
Run Code Online (Sandbox Code Playgroud)

vb.net windows-phone

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

Silverlight 5的Microsoft Expression Blend Preview已过期.接下来是什么?

我们的版本的Silverlight 5的Microsoft Expression Blend的预览已经6月30日到期,有可在网上购买许可选项.

以下链接指出Blend现在是Visual Studio 2012的一个组成部分,但是由于我们当前受限制的开发和发布周期,我们无法将整个企业级应用程序升级到VS 2012.所以,我的问题是:

  1. 可以在线购买Blend(SL 5预览版)许可吗?如果是的话,在哪里?

  2. 如果没有,那么如何在不升级到VS 2012的情况下继续我们基于Blend的开发?

blend microsoft-expression expression-blend

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

如何在Windows Phone 8.1中创建自定义动态磁贴?

我想问一下如何实现这样的东西(第一个宽瓷砖):

http://oi59.tinypic.com/149p6s8.jpg

我知道只有有限数量的实时图块模板,这是我在微软网站上找到的列表:

http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx

没有任何模板看起来像我正在寻找的,所以有没有其他方法来创建自定义瓷砖specyfing文本大小和位置?谢谢!

c# windows-phone-8 windows-phone-8.1 win-universal-app

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

AVPictureInPictureController 在应用程序后台运行时不会自动启动画中画

当创建使用自定义视频播放器AVPlayer+ AVPlayerLayer+AVPictureInPictureController的iPhone运行iOS 14(7测试版)中的视频时,应用程序进入后的背景不会自动进入子母画面模式player.start()从UIButton的行动调用。

使用AVPlayerViewController似乎表明AVPictureInPictureControlleriOS 14 上存在问题的 问题不会重现,但我想知道是否还有其他人遇到过这个问题并知道任何解决方法。我也向 Apple 提交了这个问题rdar://8620271

示例代码。

import UIKit
import AVFoundation
import AVKit

class ViewController: UIViewController {
    private let player = AVPlayer(url: URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!)
    private var pictureInPictureController: AVPictureInPictureController!
    private var playerView: PlayerView!
    private var playButton: UIButton!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        playerView = PlayerView(frame: CGRect(x: 0, y: 44, width: view.bounds.width, height: 200))
        playerView.backgroundColor = .black
        playerView.playerLayer.player = player
        view.addSubview(playerView)

        playButton = UIButton(frame: CGRect(x: view.bounds.midX - …
Run Code Online (Sandbox Code Playgroud)

ios avkit ios14

5
推荐指数
2
解决办法
1415
查看次数

GitHub 中此分支尚未部署是什么意思?

这在 Github 中意味着什么?为什么此特定 PR 不运行任何自动检查,而存储库中的其他 PR 却运行自动检查?

该分支尚未部署到 Github 的屏幕截图

deployment github reactjs

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