Example #1
0
        public UCMain(MainWindow mainWindow, Tasks.Tasks tasks, UCMirrorFolders ucMirrorFolders, UCRemoveDuplicates ucRemoveDuplicates, UCOptimize ucOptimize)
        {
            this.ucMirrorFolders    = ucMirrorFolders;
            this.ucRemoveDuplicates = ucRemoveDuplicates;
            this.ucOptimize         = ucOptimize;
            this.mainWindow         = mainWindow;
            this.tasks = tasks;

            InitializeComponent();
        }
Example #2
0
        public MainWindow()
        {
            WLicense wLicense = new WLicense();

            //wLicense.Owner = this;

            if (wLicense.ShowDialog() == true)
            {
                // Lizenz zuerst zeigen aus Sicherheitsgründen

                tasks = new Tasks.Tasks(this);

                InitializeComponent();

                bLoadProfileEnabled = true;

                //ToolTipService ShowDuration changing global
                ToolTipService.ShowDurationProperty.OverrideMetadata(
                    typeof(DependencyObject), new FrameworkPropertyMetadata(120000));

                ucMirrorFolders    = new UCMirrorFolders(tasks);
                ucRemoveDuplicates = new UCRemoveDuplicates(tasks);
                ucOptimize         = new UCOptimize(tasks);

                //String appdir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(MainWindow)).CodeBase);
                //appdir = appdir.Replace("file:\\", "");

                //String path = appdir + "\\" + "default" + ".RMDPProf";

                String path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

                if (System.IO.Directory.Exists(path + "\\RoMoRDuP\\") == false)
                {
                    if (System.IO.Directory.CreateDirectory(path + "\\RoMoRDuP\\") == null)
                    {
                        MessageBox.Show("Cannot create Directory " + path + "\\RoMoRDuP\\");
                        return;
                    }
                }

                path = path + "\\RoMoRDuP\\" + "default" + ".RMDPProf";

                tasks.userOptions.profiles.LoadProfile(path);



                ucMain = new UCMain(this, tasks, ucMirrorFolders, ucRemoveDuplicates, ucOptimize);

                ParentPanel.Children.Add(ucMain);
                ParentPanel.Children.Add(ucMirrorFolders);
                ParentPanel.Children.Add(ucRemoveDuplicates);
                ParentPanel.Children.Add(ucOptimize);

                ShowMain();



                Closing += this.OnWindowClosing;


                // This line should fix window closing Issues
                this.Closed += (sender, e) => this.Dispatcher.InvokeShutdown();
            }
            else
            {
                Application.Current.Shutdown();
            }
        }