Esempio n. 1
0
        private bool _closingAnimationNotCompleted = true; // status of whether closing animation is complete

        /// <summary>
        /// Initializes the Tag Details Window
        /// </summary>
        /// <param name="main">Reference to the Main Window</param>
        /// <param name="tagname">Tag to show in the Details Window</param>
        public TagDetailsWindow(MainWindow main, string tagname)
        {
            try
            {
                InitializeComponent();
                _main = main;
                _tagname = tagname;

                // Sets up general window properties
                Owner = _main;
                ShowInTaskbar = false;

                // Sets up all components to their default state
                filters = _main.LogicLayer.GetAllFilters(_tagname);
                if(filters != null)
                {
                    PopulateListBoxFilter(false);
                    LblTag_Details.Content = "Tag Details for " + _tagname;
                    TxtBoxPattern.IsEnabled = false;
                    CmbBoxMode.IsEnabled = false;
                } else
                {
                    DialogHelper.ShowError(this, "Error Retrieving Filters", "An error occurred while trying to retrieve the tag filters");
                }
            }
            catch (UnhandledException)
            {
                DialogHelper.DisplayUnhandledExceptionMessage(this);
            }
        }
Esempio n. 2
0
        private bool _isInvalidFolder; // Check if folder browsed is an invalid folder

        /// <summary>
        /// Initialize the Tag Window
        /// </summary>
        /// <param name="main">Reference to MainWindow</param>
        /// <param name="path">Path to initially use if user tags from the shell or drag a folder into Syncless</param>
        /// <param name="tagname">A pre-specified tagname to use</param>
        /// <param name="notifyUser">Whether or not to notify the user through tray notification</param>
        public TagWindow(MainWindow main, string path, string tagname, bool notifyUser)
        {
            InitializeComponent();

            // Set up Tag Window Properties
            _main = main;
            Owner = _main;
            ShowInTaskbar = false;

            // Trim the length of the Tag to 20 characters at most.
            if (tagname != null)
            {
                int maxlength = tagname.Length > 20 ? 20 : tagname.Length;
                tagname = tagname.Substring(0, maxlength);
            }

            _selectedTag = tagname;
            _notifyUser = notifyUser;

            // Initialize the two different folder dialogs used
            InitializeFolderDialogs();

            // Disable the AutoCompleteBox at the startup
            ACBName.IsEnabled = false;
            
            // if there is already a specified, the tagging operation has not been done through the Tag button on MainWindow
            _isTaggedNormally = path == "" ? true : false;
            _isInvalidFolder = false;

            // if no specified path onstartup, choose a path, if not use the specified paths
            _path = path == "" ? SelectPath() : path;

            // if user cancels the tagging operation, close the window
            if (_cancelstatus)
            {
                Close();
            }
            else
            {
                // Processes the path to see if the autocomplete box can be enabled
                ProcessPath(_path, _selectedTag);
                //if the path is an invalid folder and not tagged normally, it must have come from shell/drag and drop,
                // thus close the screen
                if (!_isTaggedNormally && _isInvalidFolder)
                {
                    Close();
                }
                else
                {
                    try
                    {
                        ShowDialog();
                    }
                    catch (InvalidOperationException)
                    {
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes the ShortcutsWindow
        /// </summary>
        /// <param name="main">Reference to the Main Window</param>
        public ShortcutsWindow(MainWindow main)
        {
            InitializeComponent();
            _main = main;

            // Sets up general window properties
            Owner = _main;
            ShowInTaskbar = false;
        }
Esempio n. 4
0
        /// <summary>
        /// On Application Startup, Load Resource Dictionary and creates the Main Window
        /// </summary>
        /// <param name="e">Arguments Passed Into The Program. Eg. Commandline</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Application.Current.Resources.MergedDictionaries.Add(
                Application.LoadComponent(new Uri("SynclessUI;component/AppResourceDictionary.xaml", UriKind.Relative))
                as ResourceDictionary);

            main = new MainWindow();

            ProcessArgs(e.Args);
        }
Esempio n. 5
0
        private bool _closingAnimationNotCompleted = true; // status of whether closing animation is complete

        /// <summary>
        /// 
        /// </summary>
        /// <param name="main">Reference to Main Window</param>
        /// <param name="path">Path to untag from</param>
        /// <param name="notifyUser">If true, tray notification enabled. Else if false, do not notify.</param>
        public UntagWindow(MainWindow main, string path, bool notifyUser)
        {
            InitializeComponent();

            // Set up window properties
            _main = main;
            _notifyUser = notifyUser;
            Owner = _main;
            ShowInTaskbar = false;

            try
            {
                // Gets tag list for folder which was tagged
                List<string> tagListByFolder = null;

                // Check if directory selected is valid, and if it is, get the tag list of folders.
                DirectoryInfo di;
                try
                {
                    di = new DirectoryInfo(path);
                    tagListByFolder = _main.LogicLayer.GetTags(di);
                }
                catch {}

                // if there are tags on the folder
                if (tagListByFolder != null && tagListByFolder.Count != 0)
                {
                    TxtBoxPath.Text = path;
                    taglist.ItemsSource = tagListByFolder;
                    // Populate the list and selects the first tag on the list if there is only 1 tag involved.
                    if (tagListByFolder.Count == 1)
                    {
                        taglist.SelectedIndex = 0;
                        taglist.Focus();
                    }
                    ShowDialog();
                    Topmost = true;
                    Topmost = false;
                }
                else
                {
                    DialogHelper.ShowError(this, "No Tags Found",
                                           "The folder you were trying to untag had no tags on it.");

                    Close();
                }
            }
            catch (UnhandledException)
            {
                DialogHelper.DisplayUnhandledExceptionMessage(this);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes the PreviewSyncWindow
        /// </summary>
        /// <param name="main">Reference to the Main Window</param>
        /// <param name="selectedTag">Tagname to preview</param>
        public PreviewSyncWindow(MainWindow main, string selectedTag)
        {
            _selectedTag = selectedTag;

            InitializePreviewSyncDataTable();

            _main = main;
            Owner = _main;
            ShowInTaskbar = false;

            InitializePreviewWorker(selectedTag);

            InitializeComponent();
        }
Esempio n. 7
0
        private SyncConfig _currentSyncConfig; // Current Synchronization Configuration object

        /// <summary>
        /// Initializes the WelcomeScreenWindow
        /// </summary>
        /// <param name="main">Reference to the Main Window</param>
        public OptionsWindow(MainWindow main)
        {
            _main = main;

            // Get Current Sync Config
            _currentSyncConfig = _main.LogicLayer.GetSyncConfig();

            InitializeComponent();
            InitializeSyncConfigComponents();
            InitializeComponentsFromSettings();

            // Sets up general window properties
            Owner = _main;
            ShowInTaskbar = false;
        }
        /// <summary>
        /// Initializes the WelcomeScreenWindow
        /// </summary>
        /// <param name="main">Reference to the Main Window</param>
        public WelcomeScreenWindow(MainWindow main)
        {
            InitializeComponent();

            _main = main;

            // Sets up general window properties
            try
            {
                ShowInTaskbar = false;
                Owner = main;
            }
            catch (InvalidOperationException)
            {
            }

            // Initializes the Checkbox From Application Settings
            ChkBoxWelcomeOnStartup.IsChecked = Properties.Settings.Default.DisplayWelcomeScreen;
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes the LogWindow. LogWindow will not show if any error is encountered during initialization
        /// of the log data table.
        /// </summary>
        /// <param name="main">Reference to the Main Window</param>
        public LogWindow(MainWindow main)
        {
            bool encounteredInitError = false;
            _main = main;

            // Sets up general window properties
            Owner = _main;
            ShowInTaskbar = false;

            // Attempts to initialize and populate the Log DataTable. If any error occurs, esp if log file corrupted
            // , display error msg.
            try
            {
                InitializeLogDataTable();
                PopulateLogDataTable();
            }
            catch (LogFileCorruptedException)
            {
                encounteredInitError = true;
                DialogHelper.ShowError(this, "Log File Corrupted",
                                       "Stored log files have been corrupted and will be deleted.");
            }
            catch (UnhandledException)
            {
                encounteredInitError = true;
                DialogHelper.DisplayUnhandledExceptionMessage(this);
            }

            // If no error, proceed on to display the window and its components
            if (!encounteredInitError)
            {
                InitializeComponent();
                ChkBoxApplicationLog.IsChecked = _showApplicationLog;
                ChkBoxSynchronizationLog.IsChecked = _showSynchronizationLog;
                ChkBoxFileSystem.IsChecked = _showFileSystemLog;
                ShowDialog();
                dataGrid.UpdateLayout();
            }
        }