摘要: 自己动手做了简单的日志填写程序,就是一张数据表,可以记录某日几点到几点做了哪些工作
用到了WCF、linq、net cf  阅读全文
posted @ 2008-07-16 12:05 傻样精英 阅读(1030) | 评论 (8)编辑
看到今天还有人讨论到9,10月份才会发布中文版的silverlight 2 beta 2,就写一篇吧。其实博客园的新闻上已经发布,只不过标题没写清楚而已。
头段时间微软发布了Silverlight 2 beta 2,对应的Microsoft Silverlight Tools Beta 2却只支持英文版和日文版,给国内很多中文版VS2008试用带来麻烦,很多人为了试用不得不又多装一个英文版,笔者就是。现在ms终于发布了中文版的 Microsoft Silverlight Tools Beta 2,包含:

Visual Basic 和 C# 项目模板
IntelliSense 和 XAML 代码生成器
Silverlight 应用程序调试
Web 引用支持
WCF 模板
Team Build 和命令行生成支持

http://news.cnblogs.com/n/37236/

posted @ 2008-06-17 13:48 傻样精英 阅读(34) | 评论 (0)编辑

 

现在不知道为什么,连很多技术型的网站都上不去了,还有ms的网盘也上不去,偏偏有个介绍SilverLight的一个Blog源码全放在那里,所以经常要找代理上,也有很多网络代理,不需要你设置代理服务器,但是几乎半屏的广告让我有点受不了。头几天金山跟谷歌合作的词霸,里面带有翻译网页的功能,我英语不好所以经常用,发现他其实跟很多网页式的代理功能差不多,还多了个翻译功能,所以突发奇想,可以利用他爬墙嘛。测试了几个连接均成功爬过去了。这样就不能享受web代理带来的半屏广告了。

具体做法为: 上面词典、例句、翻译三项选翻译,最下面有个翻译网页,里面输入你要爬的地址就ok了

power by SSS
posted @ 2008-06-06 09:36 傻样精英 阅读(419) | 评论 (2)编辑

         不知道这里有几个是QA,发几个QA的问题讨论讨论,每个公司的规定不一样,所以问题不具有普遍性。

1、在项目立项阶段的检查报告中由于没有质保计划,所以检查报告中的计划工时,下一步计划不好填
2、在vss里面建立每个目录的编号这个方法有待改善。
3、在立项报告里面有功能点书,代码行,这些都是在测量分析后才能确定的。如果在公告中要写这些东西,我觉得在项目启动前QA,项目经理、高级经理应该开会研究一下才不会使这两个数据写的毫无根据
4、pdp把剪裁掉的东西都保留在上面看起来整个表格很乱,特别是在通一个过程有多种方式实现的时候。
5、项目的名称问题看起来是小问题,但是有的地方叫XX,有的地方叫XX系统从一个侧面反应出了一个项目的人员都没有一个统一的目标,连名字都不能做到统一,让其他方面做到统一结果就可想而知了。
6、检查单只是对检查一部分内容的记录,如果想真实的反应QA检查的工作量问题,就不能在QA检查报告中的工作量一定要和QA检查单的工作量一致,一般我觉得都是大于QA检查单中的工作量,或者QA检查单模板中的检查项应该进一步细化
7、细节决定一切,文章中出现多处错别字的问题。比如:账多处写成帐,专业财务人员一看就觉得不专业。

posted @ 2008-06-03 15:20 傻样精英 阅读(490) | 评论 (2)编辑

      在网上搜了几个silverlight页面导航的几个帖子,在这里汇总一下。

    1、 Silverlight: How to do navigation easily (Gill Cleeren)讲的是Silverlight 1.1中做页面导航

Here's a trick to a question I have heard a few times already: how to perform easy navigation in Silverlight 1.1?

我已经听过很多次关于如何在silverlight1.1中导航的技巧的问题?
This problem can be partially solved using hidden panels: you click on a button, Panel1 is hidden and Panel2 becomes visible. This is a trick that is often done in ASP.net too.

这个问题可以用隐藏panels(翻译成面板?)的方式实现,点一下按钮,面板1隐藏,面板2显示。这个技巧也经常被用在ASP.net中。
Well, this trick can also be done in Silverlight, using the Control class. This class makes it possible to have a piece of XAML that has been loaded dynamically, act as a Control, that can be shown or hidden to do navigation (or actually, fake navigation).

ok,这个技巧也可以用在Silverlight中,使用控件类。这个类可以动态加载一个XAML作为控件,然后显示或者隐藏实现导航的效果(其实是假的导航)。
Consider the following code. I have a panel, Panel1, that inherits from Control. Inside the constructor, XAML is read from a resource (ie, a XAML file).

考虑一下下面的代码,panel1继承自Control类。在panel1类的构造器中读取XAML资源。(例如:XAML文件)

public class Panel1 : Control 
    { 

        FrameworkElement myPanel; 

        Rectangle button; 

        public Panel1() 

        { 

            System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("App1.MyPanel.xaml"); 

            button = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd()); 

            button = (Rectangle)myPanel.FindName("button"); 

        } 

    } 

Now, in the main code behind page, we'll instantiate the constructor of the Panel1 class, and we'll add the controls it generates dynamically (from the XAML that is) to the existing XAML.

在主页的后台代码中,实例化这个Panel1并动态添加到已存在的XAML中。

 

Panel1 p = new Panel1(); 

this.Children.Add(p); 


//If we later want to remove the panel, the following line does the trick. 

this.Children.Remove(p); 

2、silverlight2.0 页面跳转 (csdn中的ourmessage)
这个汉语的看起来不像英语那么费力了,呵呵。原文章有图,不知道怎么加图。推荐看原帖:http://blog.csdn.net/ourmessage/archive/2008/03/12/2172431.aspx

我新建了一个项目,里面有已经有一个页面(Page)了,如果需要跳转到另一页面,就需要在项目上点右键,找到 "Add Silverlight Link ",在弹出窗体中选择新建一个silverlight项目并添加到解决方案中,

如果要第一个页面跳转到第二个页面,只需要在第一个页面加入如下代码:
HtmlWindow html = HtmlPage.Window;
html.Navigate(new Uri("http://localhost:4535/sildemo_Web/otherTestPage.aspx"));

将第二个页面的url指定进来! (http://localhost:4535/sildemo_Web/otherTestPage.aspx)

以下为个人理解:

当时我也没想明白为什么要这么做,后来仔细看了一下代码,
public partial class Page : UserControl{

…….

}

代码里面是我们的sl是继承自UserControl,而不是继承自Page或者Canvas.

那么从逻辑上来讲,它既然是派aspx页面下的一个控件,那么它就会理由去负责页面的导航问题,因为它至少应该属于Frame(框架)级别的类或者是当前浏览器的Page(页面)级的类,而这里它只是一个控件,因此,它进行跳转需要能过别的类来完成这样的工作.

这样我们就可以很好理解为什么没看到我们的(Page : UserControl),page对象没有包含跳转.或者导航这样的方法.

html.Navigate(new Uri("otherTestPage.aspx",UriKind.Relative));
这样,就可以使用相对路径了

3、Silverlight 2 Navigating Between Xaml Pages (March 21, 2008 09:23 by Sean

One of the problems I've run across while playing around with the Beta is the lack of support for any easy way to navigate around you application by moving between Xaml pages. The problem really stems from this little piece of generated code in your App.xaml.cs file.

在我使用beta的一个问题,在两个Xaml页面导航之间缺乏一种简单的方法的支持。这个问题源自自动生成的app.xaml.cs文件。

private void Application_Startup(object sender, StartupEventArgs e) 
{ 
    // Load the main control 
    this.RootVisual = new Page(); 
} 

Looking at the docs for the RootVisual property of Application class, we're told that RootVisual can only be set once. My limited testing shows that this isn't actually true, and that it's possible to set LayoutRoot as many times as you'd like but only in the Application_Startup handler, which is obviously of very little use!

查看应用程序类RootVisual属性的文档中,告诉我们RootVisual只能被设置一次。在我有限的试验中它不真正是这样的。只是设置LayoutRoot的Application_Startup不能多次(英语太差,实在不理解这句话的意思是Application_Startup设置一次还是多次),他显然很少用到。

My solution is actually really very simple and can be summed up with one short snippet of code...

我的解决方案其实很简单,可以归纳为一个小代码段:

private void Application_Startup(object sender, StartupEventArgs e) 
{ 
    // Load the main control 
    Grid root = new Grid(); 
    root.Children.Add(new Page()); 
    this.RootVisual = root; 
} 

As you can see, here I am setting the RootVisual of the application as a new Grid and adding my Page usercontrol as a child of the grid. All we need to do now when we want to switch out Xaml pages is to manipulate the Children collection of our Grid! Here, check out my demo to see how it looks in action, this is a little two page application which allows you to switch back and forth between the pages in a number of different ways.

你可以看到,这里我设置了程序的RootVisual为一个新的Grid并添加了自己的page也作为Grid的子控件。当我要选择我们自己的Xaml Pages,我们所需要的操作就是在我们的Grid中操作子控件集。下载我的Demo看他如何操作,这个小的有两个Xaml页的程序允许我们用几种不同的效果在这两个页面中切换。

Woah! Hang on, where did all those cool transition effects come from? It just so happens that I've knocked together a few classes (I'm not going to use the word 'framework'!) that make these navigation issues and transition effects, even making your own transitions, really really easy. So... On to the code.

哇哦!继续,所有的这些酷酷的切换效果哪里来的呢?他只发生在我敲的几个类中(我不打算用framework这个词),他们负责导航和切换效果,甚至使用在你自己的切换中,他们是真的真的很简单。so...,看代码。

First up we'll take a look at the transitions. Every transition is implemented as a class deriving from the abstract TransitionBase, it's a really tiny little class which provides the implementation for a completed event, for when the transition has finished, and the contract for a single method which must be implemented by derived transitions.

首先,我们考虑一下切换,每个切换类实现了抽象类TransitionBase,他提供了completed方法的实现当切换完成时,声明了这个单一方法必须被派生类实现。

public abstract class TransitionBase 
{ 
    public event EventHandler<TransitionCompletedEventArgs> TransitionCompleted; 
    protected void OnTransitionCompleted(UserControl newPage, UserControl oldPage) 
    { 
        if (TransitionCompleted != null) 
            TransitionCompleted(this, new TransitionCompletedEventArgs() { NewPage = newPage, OldPage = oldPage }); 

    } 
    public abstract void PerformTranstition(UserControl newPage, UserControl oldPage); 
} 

We have a PerformTransition method here which takes a reference to the two pages, the current and the one we'd like to change it with. This method is obviously implemented by our derived transitions to manipulate and animate the pages in some pleasing way, one thing to note here is that when the transition has completed its shuffling of the pages around, it must fire the completed event as we will see shortly.

PerformTransition 方法的参数为两个Xaml页,当前页和我们要切换到的页。这个方法显然要实现在我们派生的切换类的操作和动画。要注意的一件事情是,当切换完成时必须激发完成事件。

Next up lets look at NavigationHelper, this is a static class which contains methods which can be called to switch pages.

下一步,看看NavigationHelper类,这是个静态类提供被交换页调用的方法。

public static class NavigationHelper 
{ 
    private static Grid root; 
    static NavigationHelper() 
    { 
        root = Application.Current.RootVisual as Grid; 
    } 
    public static void Navigate(TransitionBase transition, UserControl newPage) 
    { 
        UserControl oldPage = root.Children[0] as UserControl; 
        root.Children.Insert(0, newPage); 
        transition.TransitionCompleted += transition_TransitionCompleted; 
        transition.PerformTranstition(newPage, oldPage); 
    } 
    public static void Navigate(UserControl newPage) 
    { 
        UserControl oldPage = root.Children[0] as UserControl; 
        root.Children.Add(newPage); 
        root.Children.Remove(oldPage); 
    } 
    private static void transition_TransitionCompleted(object sender, TransitionCompletedEventArgs e) 
    { 
        root.Children.Remove(e.OldPage); 
    } 
} 

Ok, so here in our static constrcutor we grab a reference to our root visual from the application object. This is cast to a Grid so we can manipulate the Children collection. Now this is not really 100% safe because our static constructor will run the first time and member of our NavigationHelper class is accessed and this could be before the application's root visual has been set as a Grid. In practice though this is very unlikely to ever happen and it would make no sense at all for someone to call our navigation methods before Application_Startup so I'm going to let it go...

ok,看都看的迷迷糊糊,翻译更不会了。

We also have two methods here, one which take a TransitionBase and a UserControl and one which just takes a UserControl. The method taking just a UserControl simply switches out the Xaml pages with no other action. The method first gets a reference to the current page which should be at the top of the children collection, then it inserts our new page at the top, this will cause it to be visible and hide the previous page as we have dropped our new one on top, the final step is to pull out the old page from underneath. This is how the "Switch" button in the demo above is working...

The other Navigate overload is more interesting, first we get a reference to the old page but this time we insert the new page behind it so it isn't immediately visible. Next we subscribe to the completed event for the passed in transition object and fire it off to let it do it's thing. We can see that when the transition completes and fires it's event, we simply remove the old page.

Looks great! Now we'll check out how a transition is implemented. There are a few transitions included with the code, but it's really easy for you to write your own and pass them to the NavigationHelper.Navigate method, just by inheriting from TransitionBase. Here is my FadeTransition.

public class FadeTransition : TransitionBase 
{ 
    private UserControl newPage; 
    private UserControl oldPage; 
    private TimeSpan time; 
    public FadeTransition(TimeSpan duration) 
    { 
        time = duration; 
    } 
    public FadeTransition() : this(TimeSpan.FromSeconds(2)) 
    { } 
    public override void PerformTranstition(UserControl newPage, UserControl oldPage) 
    { 
        this.newPage = newPage; 
        this.oldPage = oldPage; 
        Duration duration = new Duration(time); 
        DoubleAnimation animation = new DoubleAnimation(); 
        animation.Duration = duration; 
        animation.To = 0; 
        Storyboard sb = new Storyboard(); 
        sb.Duration = duration; 
        sb.Children.Add(animation); 
        sb.Completed += sb_Completed; 
        Storyboard.SetTarget(animation, oldPage); 
        Storyboard.SetTargetProperty(animation, "Opacity"); 
        oldPage.Resources.Add(sb); 
        sb.Begin(); 
    } 

    void sb_Completed(object sender, EventArgs e) 
    { 
        OnTransitionCompleted(newPage, oldPage); 
    } 
} 

This first thing to notice is that we overload the constructor so that we can pass in timespan, this lets us lengthen or shorten the transition as we see fit. Next is the PerformTransition implementation, this method just steps through and constructs a Storyboard object in code then sets it to run. When the Storyboard has finished its work we fire the TransitionCompleted event which lets NavigationHelper clear up out old page. I won't step through how the Storyboard is created as it's well documented on MSDN and I pretty much just copied if from there anyway, so if you want to know more, go check it out.

There is one other transition I'd like to show you, which is called CompositeTransition. This is how I achieve multiple effects at once, for example fading and sliding. I create a fade transition and a wipe transition, wrap them in a CompositeTransition and pass that to the NavigationHelper.

public class CompositeTransition : TransitionBase 
{ 
    private TransitionBase transitionOne; 
    private TransitionBase[] transitions; 
    private Int32 count; 
    private UserControl newPage; 
    private UserControl oldPage; 
    public CompositeTransition(TransitionBase transitionOne, params TransitionBase[] transitions) 
    { 
        this.transitionOne = transitionOne; 
        this.transitions = transitions; 
    } 
    public override void PerformTranstition(UserControl newPage, UserControl oldPage) 
    { 
        this.newPage = newPage; 
        this.oldPage = oldPage; 
        transitionOne.TransitionCompleted += transition_TransitionCompleted; 
        transitionOne.PerformTranstition(newPage, oldPage); 
        foreach (TransitionBase transition in transitions) 
        { 
            transition.TransitionCompleted += transition_TransitionCompleted; 
            transition.PerformTranstition(newPage, oldPage); 
        } 
    } 
    private void transition_TransitionCompleted(object sender, TransitionCompletedEventArgs e) 
    { 
        count++; 
        if (count == transitions.Length + 1) 
            OnTransitionCompleted(newPage, oldPage); 
    } 
} 

There is nothing particularly clever going on here, we have a constructor which take a variable number of TransitionBase instances. When PerformTransition is called we fire off all the transitions at once. When each one of them has completed we fire the TransitionCompleted event. Nice, now we can create loads of cool stuff! One thing worth noting though when stringing transition together like this, in my implementation there is a limitation in that my transtions set the UserControl's RenderTransform property and animate on this. If you chain multiple transitions which work like this they will over write the UserControls RenderTransform and only the last transition will do anything. The fix for this I guess would be to pass a TransformGroup into each transition so they're all animating against the same instance, but I'll leave that bit of fun and games as an excercise for the reader!

Just quickly, here is a snipet showing what a call to NavigationHelper.Navigate looks like, and then I'll leave you with the code download.

TransitionBase transition = new CompositeTransition( 

    new FadeTransition(TimeSpan.FromSeconds(1)), 

    new WipeTransition(WipeTransition.WipeDirection.LeftToRight)); 

  

NavigationHelper.Navigate(transition, new AnotherPage()); 

Enjoy!

FlawlessCode.Navigation.zip (144.27 kb)

4、其他网上看了跟切换页面有关的内容。

     a、切换页面总要传递一点相关的数据,一个方法可以用cookie。读取cookie的方法

http://www.eggheadcafe.com/community/aspnet/12/10032919/cookies-problem-in-silver.aspx

using System.Windows.Browser; 
  string  str = string.Empty;
str = HtmlPage.Document.Cookies;
Empid = str.Split('=')[1];
}
private static string _empid = string.Empty;
public static string Empid
{
get { return UserDetails._empid; }
set { UserDetails._empid = value; }
}
  说是有个问题就是刷新了cookie里的值后不能读出新值,先记着,慢慢研究。
    b、Xaml页面和html页面切换出现的问题
http://silverlight.net/forums/t/3917.aspx
c、还有一些人在silvernight中提的问题,这里把链接记下来慢慢研究
Multiple Silverlight 2.0 controls on same ASP .NET page
http://silverlight.net/forums/t/15643.aspx
Problem testing splash screen
http://silverlight.net/forums/t/15672.aspx

How to use multiple Silverlight applications in one .xap file

http://silverlight.net/forums/t/10823.aspx

posted @ 2008-05-11 20:50 傻样精英 阅读(1637) | 评论 (3)编辑
       以前搞Delphi的,看这个这么多人都玩dotnet也忍不住看了几篇技术文章就开始做了个小程序,没想到噩梦就开始了,从周一到周五每天都很郁闷,呵呵。就是因为silverlight调WCF报了个错误:
     "System.ServiceModel.CommunicationException"类型的异常在
System.ServiceModel.dll 中发生,但未在用户代码中进行处理

其他信息: Operation is not valid due to the current state of the object.

查了很多网页,都没找到原因,在折腾了一个星期后终于不报错了。其实是犯了个低级的错误.
posted @ 2008-05-10 10:41 傻样精英 阅读(119) | 评论 (0)编辑