示例#1
0
        public MainWindow(string token)
        {
            InitializeComponent();
            restclient = new RestService <Tevekenyseg, string>
                             ("https://localhost:44385", "/api/tevekenyseg", token);

            notifyservice = new NotifyService("https://localhost:44385/tevekenysegHub");

            notifyservice.AddHandler <Tevekenyseg>("Tevekenyseg", (tevekenyseg) =>
            {
                if (tevekenyseg.Kategoria == "opcionális")
                {
                    lbox_opcionalis.Items.Add(tevekenyseg);
                }
                else if (tevekenyseg.Kategoria == "sürgős")
                {
                    lbox_surgos.Items.Add(tevekenyseg);
                }
                else
                {
                    lbox_normal.Items.Add(tevekenyseg);
                }
            });

            notifyservice.Init();

            this.token = token;

            Sync();
        }
        public MainWindow(string token)
        {
            InitializeComponent();
            this.token = token;

            notifyService = new NotifyService("https://localhost:44346/ticketHub");

            notifyService.AddHandler <Ticket>("NewTicket", (value) => lbox.Items.Add(value));
            notifyService.AddHandler <string>("Disconnected", (value) => MessageBox.Show(value, "Hiba történt", MessageBoxButton.OK, MessageBoxImage.Error));
            notifyService.AddHandler <string>("Connected", (value) => this.Title += " id: " + value);

            try
            {
                notifyService.Init();
            }
            catch (System.Net.Http.HttpRequestException ex)
            {
                MessageBox.Show(ex.Message, "Hiba történt", MessageBoxButton.OK, MessageBoxImage.Error);
            }


            rest = new RestService <Ticket, string>(
                "https://localhost:44346/", "/api/ticket", token);

            Sync();
        }
示例#3
0
        public MainWindow(string token)
        {
            InitializeComponent();
            _token         = token;
            _restService   = new RestService <Ticket, string>("https://localhost:44398", "/api/ticket", _token);
            _notifyService = new NotifyService("https://localhost:44398/api/ticketHub");

            _notifyService.AddHandler("TicketUpdate", async() => await Sync());

            _notifyService.Init();

            Sync();
        }
        public TicketLogic(string token)
        {
            notifyService = new NotifyService("https://localhost:44346/ticketHub");

            notifyService.AddHandler <Ticket>("NewTicket", (value) => GetTicket(value));
            //notifyService.AddHandler<string>("Disconnected", (value) => MessageBox.Show(value, "Hiba történt", MessageBoxButton.OK, MessageBoxImage.Error));
            //notifyService.AddHandler<string>("Connected", (value) => this.Title += " id: " + value);

            notifyService.Init();

            rest = new RestService <Ticket, string>(
                "https://localhost:44346/", "/api/ticket", token);

            Init();
        }