Example #1
0
        public MainWindow()
        {
            try
            {
                InitializeComponent();
                RealtimeWPFGridArgs options = RealtimeWPFGridArgs.ParseArgs(Environment.GetCommandLineArgs());
                SENDERID = options.SenderId;

                this.Title = string.Format("[{0}] - {1}", options.SenderId, this.Title);

                if (options.Left > 0 || options.Top > 0)
                {
                    this.Left = options.Left;
                    this.Top  = options.Top;
                }
                if (options.Width > 0 || options.Height > 0)
                {
                    this.Width  = options.Width;
                    this.Height = options.Height;
                }


                // Preapare Synchronised Data Layer
                DAL dataAccess = new DAL();
                BindingOperations.EnableCollectionSynchronization(TodoList, todoLock);

                BindingOperations.EnableCollectionSynchronization(ProjectList, projectLock);

                projectViewSource = this.FindResource("ProjectDataSource") as CollectionViewSource;
                todoViewSource    = this.FindResource("TodoDataSource") as CollectionViewSource;
                projectViewSource.View.CurrentChanged += View_CurrentChanged;

                // Connect to Observer
                tornado14Observer.Connect();
                Filter filter = new Filter();
                cancelationToken = new CancellationTokenSource();
                Task.Factory.StartNew(() => ReciveMessagesProcess(tornado14Observer, filter, cancelationToken.Token))
                .ContinueWith(antecedant =>
                {
                });


                TextEditorPublicInfo.LostKeyboardFocus   += TextResultPublicInfo_LostKeyboardFocus;
                TextEditorPublicInfo.GotKeyboardFocus    += TextResultPublicInfo_GotKeyboardFocus;
                TextEditorCurrentState.LostKeyboardFocus += TextResultPublicInfo_LostKeyboardFocus;
                TextEditorCurrentState.GotKeyboardFocus  += TextResultPublicInfo_GotKeyboardFocus;
                TextEditorResult.LostKeyboardFocus       += TextResultPublicInfo_LostKeyboardFocus;
                TextEditorResult.GotKeyboardFocus        += TextResultPublicInfo_GotKeyboardFocus;
                TextEditorTargetState.LostKeyboardFocus  += TextResultPublicInfo_LostKeyboardFocus;
                TextEditorTargetState.GotKeyboardFocus   += TextResultPublicInfo_GotKeyboardFocus;

                // Get Project and Todo List
                tornado14Observer.Send(new Package(SENDERID, 10, 12, Method.GET, null));
                tornado14Observer.Send(new Package(SENDERID, 12, 12, Method.GET, null));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public static RealtimeWPFGridArgs ParseArgs(string[] args)
        {
            RealtimeWPFGridArgs options = new RealtimeWPFGridArgs();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return(null);
            }
            return(options);
        }