Ejemplo n.º 1
0
        public void Bootstrap(App app, System.Windows.StartupEventArgs e)
        {
            //Start server in new thread
            try
            {
                System.Threading.ThreadPool.QueueUserWorkItem(state =>
                {
                    _host.Open();
                });
            }
            catch (Exception exc)
            {
                _host.Abort();
                throw (exc);
            }

            //Start client
            _todoServiceClient = new TodoServiceClient("NetNamedPipeBinding_ITodoService");

            //try
            //{
            //    _todoServiceClient.Open();
            //}
            //catch (Exception ex)
            //{
            //    _todoServiceClient.Abort();
            //    throw(ex);
            //}

            //_todoServiceClient = new TodoServiceClient("WsHttpBinding_ITodoService");
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            var repository = new TodoServiceClient("https://localhost:5001");
            await repository.Connect();

            Application.Init();
            var top   = App1.Body("tst", repository);
            var state = top.Create();

            Application.Top.Add(state.GetView());

            void OnStateOnRequestUpdate()
            {
                top.Update(state);
                Application.Refresh();
            }

            state.RequestUpdate   += OnStateOnRequestUpdate;
            repository.ChangeTodo += OnStateOnRequestUpdate;
            // Create a timer with a two second interval.
            var aTimer = new System.Timers.Timer(1000);

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed  += (sender, eventArgs) => OnStateOnRequestUpdate();
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
            Application.Run();
        }
Ejemplo n.º 3
0
        public void Bootstrap(App app, System.Windows.StartupEventArgs e)
        {
            //ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
            //smb.HttpGetEnabled = true;
            //smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
            //_host.Description.Behaviors.Add(smb);


            //Start server in new thread
            try
            {
                System.Threading.ThreadPool.QueueUserWorkItem(state =>
                {
                    _host.Open();
                });
            }
            catch (Exception exc)
            {
                _host.Abort();
                throw (exc);
            }

            //Start client
            _todoServiceClient = new TodoServiceClient("NetNamedPipeBinding_ITodoService");
        }
Ejemplo n.º 4
0
 public TodoViewModel(Todo todo)
 {
     _todo = todo;
     //This goes in Initialization/constructor
     GoBackCmd          = new RelayCommand(ExecGoBack, CanGoBack);
     _SaveTodoCmd       = new RelayCommand(ExecSaveTodo, CanSaveTodo);
     _todoServiceClient = BootStrapper.Instance.todoServiceClient;
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting todo client...");
            var ch     = new Channel("127.0.0.1:5000", ChannelCredentials.Insecure);
            var client = new TodoServiceClient(ch);
            var cmd    = new CmdClient(client);

            cmd.Run();
        }
Ejemplo n.º 6
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            btnLogin.IsEnabled  = false;
            btnLogout.IsEnabled = true;

            this.client               = new TodoServiceClient();
            this.userClient           = client.Login("root", "root");
            userInfo.Text             = "Bejelentkezve mint " + userClient.username;
            todo_header               = "EPQF7Q|root";
            txtInsertAuthor.Text      = userClient.username;
            txtInsertAuthor.IsEnabled = false;
            txtUpdateAuthor.Text      = userClient.username;
            txtUpdateAuthor.IsEnabled = false;
        }
Ejemplo n.º 7
0
        public static Element Body(string txt, TodoServiceClient repository)
        {
            return(CreateElement((state) =>
            {
                var(count, setCount) = state.CreateState(0);
                var(showAddWindow, setShowAddWindow) = state.CreateState(false);
                var(showAll, setShowAll) = state.CreateState(false);
                IEnumerable <Todo> GetTodos(bool showAll)
                {
                    return repository.GetTopTodos().Where(todo => showAll || !todo.Compleated).ToArray();
                }

                var(selectedTodo, setSelectedTodo) = state.CreateState <Todo>(null);
                var builder = new DelegateTreeBuilder <Todo>(todo => showAll ? todo.Children : todo.UncompletedChildren);
                return
                Container(height: Dim.Fill(), width: Dim.Fill(), contents: new[]
                {
                    VStack(height: Dim.Fill(), width: Dim.Fill(), contents: new[]
Ejemplo n.º 8
0
        public HomeViewModel()
        {
            _todoServiceClient = BootStrapper.Instance.todoServiceClient;
            _eventAggregator   = App.eventAggregator;
            TodoList           = new ObservableCollection <TodoViewModel>();


            loadTodoList();
            _TodoListSelectedIndex = -1;
            _SelectedTodo          = new TodoViewModel();



            UpdateTodoCmd    = new RelayCommand(ExecUpdateTodo, CanUpdateTodo);
            DeleteTodoCmd    = new RelayCommand(ExecDeleteTodo, CanDeleteTodo);
            LoadTodoCmd      = new RelayCommand(ExecLoadTodo, CanLoadTodo);
            ListTodosCmd     = new RelayCommand(ExecListTodos, CanListTodos);
            AddTodoCmd       = new RelayCommand(ExecAddTodo, CanAddTodo);
            NewTodoCmd       = new RelayCommand(ExecNewTodo, CanNewTodo);
            GoTodoDetailsCmd = new RelayCommand(ExecGoTodoDetails, CanGoTodoDetails);
        }
Ejemplo n.º 9
0
 public LoginWindow()
 {
     InitializeComponent();
     client = new TodoServiceClient();
 }