public ActionResult DeleteSave(PhoneContact phoneContact)
        {
            _phoneContacts.RemoveAll(c => c.Id == phoneContact.Id);
            _phoneContacts = ContactsHandler.WriteToJsonFile(_phoneContacts);

            return(RedirectToAction("Index"));
        }
        public ActionResult AddSave(PhoneContact phoneContact)
        {
            _phoneContacts.Add(phoneContact);
            _phoneContacts = ContactsHandler.WriteToJsonFile(_phoneContacts);

            return(RedirectToAction("Index"));
        }
        public ActionResult UpdateSave(PhoneContact phoneContact)
        {
            _phoneContacts = _phoneContacts.Select(c => c.Id == phoneContact.Id ? new PhoneContact(phoneContact.Id, phoneContact.Name, phoneContact.Phone) : c).ToList();
            _phoneContacts = ContactsHandler.WriteToJsonFile(_phoneContacts);

            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     ContactsHandler.ReadFromJsonContacts();
 }
Esempio n. 5
0
        public LexOfficeApi(string apiKey)
        {
            // Create Handler with a RestClient
            RestClient client = new RestClient("https://api.lexoffice.io/v1", apiKey);

            VoucherListEndPoint = new VoucherListHandler(client);
            InvoiceEndPoint     = new InvoiceHandler(client);
            ContactsEndPoint    = new ContactsHandler(client);
            VouchersEndPoint    = new VouchersHandler(client);
        }
Esempio n. 6
0
        public ChatWindowDriver(SSLWriter writer, ClientCrypto logCrypto)
        {
            userlist       = new List <string>();
            this.writer    = writer;
            this.logCrypto = logCrypto;
            fileManager    = new FileManager();
            p2pConnector   = new P2P.P2PConnector();

            contactsHandler       = new ContactsHandler(fileManager);
            spam                  = new SpamProtector();
            individualChatDrivers = new List <IndividualChatDriver>();
            chatWindow            = new ChatWindow();
            graphicsDriver        = new ChatWindowGraphicsDriver(chatWindow);
            friendrequest         = new FriendRequest();
            SetupListeners();
            username = ClientDriver.globalUsername;
        }
        public ContactHandlerTest()
        {
            IList <Contact> contacts = new List <Contact>
            {
                new Contact()
                {
                    FullName = "Jan K", Id = 123, User = "******"
                }
            };

            var contactsMock = DbSetHelper.CreateDbSetMock(contacts);

            var dataContextMock = new Mock <DataContext>();

            dataContextMock.Setup(x => x.Contacts).Returns(contactsMock.Object);

            contactsHandler = new ContactsHandler(dataContextMock.Object);
        }
Esempio n. 8
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Fix for external startup environements (for instance when clicking on mailto links from IE)
            Directory.SetCurrentDirectory(path);

            AppDomain.CurrentDomain.UnhandledException += GlobalExceptionHandler;
            Current.DispatcherUnhandledException       += GlobalWPFExceptionHandler;

            // Increase maximum concurrent HttpWebRequest connections
            ServicePointManager.DefaultConnectionLimit = 100;

            if (CheckForUpgrade())
            {
                // first check if we need elevated permissions
                new Process {
                    StartInfo = new ProcessStartInfo(Path.Combine(path, "Inbox2Upgrade.exe"))
                    {
                        Arguments = "upgrade", UseShellExecute = true, Verb = "runas"
                    }
                }.Start();

                // Shutdown current application
                Current.Shutdown();
            }
            else
            {
                LoadTheme("/Settings/Application/Theme".AsKey("DarkSide"));

                // Run startup code
                ThreadPool.QueueUserWorkItem(delegate { Core.Startup.PyBinding(); });

                Core.Startup.Logging("log4net.config");
                Core.Startup.TypeConverters();
                Core.Startup.DataSources();
                Core.Startup.Search();
                Core.Startup.CorePlugins();
                Core.Startup.AppPlugins();
                Core.Startup.Plumbing();
                Core.Startup.Channels();
                Core.Startup.Commands();
                Core.Startup.KeyboardHooks();
                Core.Startup.LoadStats();

                MessagesHandler.Init();
                DocumentsHandler.Init();
                ContactsHandler.Init();
                UserStatusHandler.Init();

                // Can also help in ssl debugging with Fiddler2
                if (SettingsManager.ClientSettings.AppConfiguration.IgnoreSslCertificateIssues)
                {
                    ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }
                }
                ;

                OverrideDependencyProperties();

                var window = new MainWindow();
                window.Show();

                stopwatch.Start();

                startupSuccess = true;
            }
        }