0 Replies - 1681 Views - Last Post: 22 April 2012 - 01:50 AM Rate Topic: -----

#1 ku3mich  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 11
  • Joined: 22-April 12

Question about formating WPF MVVM ICommand property

Posted 22 April 2012 - 01:50 AM

I would like to ask question about formating C# code.
For example I have such property:
        public ICommand SearchCmd {
            get {
                return _SearchCmd ?? (_SearchCmd = new RelayCommand(
                    o => {
                        SearchResults.Clear();

                        _SearchTask = new CancelableTask((token) => {
                            for (int i = 0; i < 20; i++) {
                                if (((CancellationToken)token).IsCancellationRequested)
                                    break;

                                UIDispatcher.BeginInvoke(DispatcherPriority.Background,
                                            (Action)(() =>
                                                     SearchResults.Add(new SearchResult { Url = "http://google.com/" })));
                                Thread.Sleep(1000);
                            }
                        },
                        () => {
                            _SearchTask = null;
                            InvalidateCommands();
                        }
                        );
                    },
                    o => _SearchTask == null
                    ))
                    ;
            }
        }



What you think about better formating it?

Is This A Good Question/Topic? 0
  • +

Page 1 of 1