Exemplo n.º 1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            string username = this.usernameTxtBox.Text;
            string password = this.paswordTxtBox.Password;

            if (username.Equals(""))
            {
                UsefullMethods.setLabelAlert("danger", this.errorBox, "Missing username! Username field cannot be empty.");
                return;
            }

            if (password.Equals(""))
            {
                UsefullMethods.setLabelAlert("danger", this.errorBox, "Missing password! Password field cannot be empty.");
                return;
            }
            string token;
            BackupServiceClient server = null;

            try
            {
                if (Const <BackupServiceClient> .Instance().get() == null)
                {
                    server = logIn(username, password, out token);
                }
            }
            catch (LoginExcpetion ex)
            {
                UsefullMethods.setLabelAlert("danger", this.errorBox, ex.Message);
            }
            if (server != null)
            {
                Const <BackupServiceClient> .Instance().set(server);

                UsefullMethods.setLabelAlert("success", this.errorBox, "Log in succeed!");
                conf.userName.set(this.usernameTxtBox.Text);
                await Task.Delay(500);

                this.Hide();
                string targetPath = conf.targetPath.get();
                // if the path is not setted a windows for selecting the path must be shown
                if (targetPath == null)
                {
                    WelcomeWindows ww = new WelcomeWindows();
                    ww.parent = this;
                    ww.Show();
                    ww.Activate();
                }
                else
                {
                    TrayiconMode.Instance();
                }
            }
        }
Exemplo n.º 2
0
        private ControlView()
        {
            this.server = Const <BackupServiceClient> .Instance().get();

            InitializeComponent();
            targetPath         = conf.targetPath.get();
            se.threadCallback += ThreadMonitor;

            buildGraphic();
            versionView.MouseDoubleClick    += VersionView_MouseDoubleClick;
            revertList.MouseDoubleClick     += VersionView_MouseDoubleClick;
            versionView.SelectedItemChanged += VersionView_SelectedItemChanged;
        }
Exemplo n.º 3
0
        private SyncEngine()
        {
            status      = "Idle";
            this.server = Const <BackupServiceClient> .Instance().get();

            String dirPath = conf.targetPath.get();

            threadCallback       = new ThreadStatus(this.ThreadMonitor);
            watcher              = new FileSystemWatcher();
            watcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            // Add event handlers.
            watcher.Changed += new FileSystemEventHandler(OnChanged);
            watcher.Created += new FileSystemEventHandler(OnChanged);
            watcher.Deleted += new FileSystemEventHandler(OnChanged);
            watcher.Renamed += new RenamedEventHandler(OnChanged);
            watcher.IncludeSubdirectories = true;
            watcher.Path = dirPath;
            // Begin watching.
            watcher.EnableRaisingEvents = true;
            vb = new FBVersionBuilder(dirPath);
        }