Пример #1
0
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var exception = (Exception)e.ExceptionObject;

            logger.Fatal("Unhandled excpetion: {0}\n{1}", exception.Message, exception.StackTrace);

            if (exception.InnerException != null)
            {
                logger.Fatal("Inner exception: {0}\n{1}", exception.InnerException.Message, exception.InnerException.StackTrace);

                if (exception.InnerException.InnerException != null)
                {
                    logger.Fatal("Inner exception 2: {0}\n{1}", exception.InnerException.InnerException.Message, exception.InnerException.InnerException.StackTrace);
                }
            }

            ClientWebApi.SendBugReport(exception);

            var logPath = Path.Combine(Path.GetTempPath(), string.Format("utopia-client-{0}.log", DateTime.Now.ToShortDateString()));

            if (File.Exists(logPath))
            {
                Process.Start(logPath);
            }
        }
Пример #2
0
 public static void AdicionarUsuario(DadosUsuario dados)
 {
     try
     {
         var clientApi = new ClientWebApi(urlApi);
         var data      = clientApi.Post <object>("usuario/cadastrar", dados);
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public override void Initialize(SharpDX.Direct3D11.DeviceContext context)
        {
            var startUpComponent = _iocContainer.Get <StartUpComponent>();
            var inputsManager    = _iocContainer.Get <InputsManager>();

            _webApi = _iocContainer.Get <ClientWebApi>();

            inputsManager.KeyboardManager.IsRunning = true;

            //Get the list of Slides
            List <FileInfo> slides = new List <FileInfo>();

            foreach (var slide in Directory.GetFiles(@"Images\StartUpSlides\", "StartUpSlide*.*"))
            {
                slides.Add(new FileInfo(slide));
            }

            startUpComponent.SetSlideShows(slides.ToArray(), 3000);

            startUpComponent.SlideShowFinished += StartUpComponentSlideShowFinished;

            //Prepare Async SystemComponentState
            GameState systemComponentState = StatesManager.GetByName("SystemComponents");

            systemComponentState.StateInitialized += SystemComponentStateStateInitialized;

            StatesManager.PrepareStateAsync(systemComponentState);

            _webApi.TokenVerified += WebApiTokenVerified;
            if (!string.IsNullOrEmpty(ClientSettings.Current.Settings.Token))
            {
                _webApi.OauthVerifyTokenAsync(ClientSettings.Current.Settings.Token);
            }
            else
            {
                _nextState = "Login";
            }

            AddComponent(startUpComponent);
            AddComponent(inputsManager);
            base.Initialize(context);
        }
Пример #4
0
        public static ObservableCollection <DadosUsuario> BuscarListaUsuarios()
        {
            var clientApi = new ClientWebApi(urlApi);

            return(clientApi.Get <ObservableCollection <DadosUsuario> >("usuario/buscarlista"));
        }
Пример #5
0
 public static void AtualizarUsuario(DadosUsuario dados)
 {
     var clientApi = new ClientWebApi(urlApi);
     var data      = clientApi.Put <object>("usuario/atualizar", dados);
 }
Пример #6
0
        public static void ExcluirUsuario(long id)
        {
            var clientApi = new ClientWebApi(urlApi);

            clientApi.Delete("usuario/excluir?id=" + id);
        }
Пример #7
0
 public UsersPage()
 {
     InitializeComponent();
     webApi = new ClientWebApi((x) => Debug.WriteLine(x));
 }
Пример #8
0
        static void Main(string[] args)
        {
            userService = new UserService();
            client      = new ClientWebApi((u) => Console.WriteLine(u));
            while (true)
            {
                Console.WriteLine("Список команд:");
                Console.WriteLine("1. Создать учетную запись");
                Console.WriteLine("2. Вывести список пользователей");
                Console.WriteLine("4. Выход");
                Console.WriteLine("Введите команду:");
                int commandNum = Int32.Parse(Console.ReadLine());
                switch (commandNum)
                {
                case 1:
                    CreateUser();
                    break;

                case 2:
                    var users = client.GetUsers();
                    foreach (var a in users)
                    {
                        Console.WriteLine($"{a.Usrnam}");
                    }
                    break;

                case 3:
                    ChangeUser();
                    break;

                case 4:
                    Console.WriteLine("Нажмите клавишу для выхода...");
                    Console.ReadKey();
                    return;

                default:
                    Console.WriteLine("Неправильно введена команда");
                    break;
                }
            }
            Console.WriteLine("Конец");

            /*
             * DirectConnectionAppServices services = new DirectConnectionAppServices();
             * var Users = services.GetAllUsers();
             * foreach (User u in Users)
             * {
             *  Console.WriteLine($"{u.Usrnam}\t{u.Fullname}\t{u.Dept}");
             * }
             * Console.WriteLine("Я готов, а вы?");
             */
            Console.ReadKey();

            /*
             * ClientWebApi webApi = new ClientWebApi((x) => Console.WriteLine(x));
             * var users = webApi.GetUsers();
             * foreach (User u in users)
             * {
             *  Console.WriteLine($"{u.Usrnam}\t{u.Fullname}\t{u.Dept}");
             * }
             */

            Console.ReadKey();

            /*
             * UnitOfWork UnitOfWork = new UnitOfWork();
             * Console.WriteLine("Hello World!");
             * Console.ReadKey();
             */
        }