Ejemplo n.º 1
0
        public App()
        {
            SquirrelSetup.HandleStartup();

            Logger.Log(string.Join("|", Environment.GetCommandLineArgs()));
        }
Ejemplo n.º 2
0
        private void contextMenu_Click(object sender, RoutedEventArgs e)
        {
            var item = e.Source as MenuItem;

            if (item == null)
            {
                return;
            }

            var tag = item.Tag.ToString();

            switch (tag)
            {
            case "SHOW":
                ShowWindow();
                Focus();
                break;

            case "SYNCALL":
                viewModel.SyncAll();
                break;

            case "NEWSYNC":
            {
                NewConfig wind = new NewConfig();
                wind.ShowNewConfigDialog();
                break;
            }

            case "SETTINGS":
            {
                //SettingsWindow setWin = new SettingsWindow();
                //setWin.ShowDialog(null);
                break;
            }

            case "INFO":
                SquirrelSetup.TryUpdateAsync();
                var version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(4);
                MessageBox.Show(this, "SPSync - Version " + version + " BETA\n(C) 2016 Marco Wiedemeyer\nMore on http://spsync.net", "SPSync", MessageBoxButton.OK, MessageBoxImage.Information);
                break;

            case "EXIT":
                shutdownInitiatedFromApplication = true;
                Application.Current.Shutdown();
                break;

            default:
            {
                var localFolder = tag.Split('|')[1];
                var conf        = viewModel.GetSyncConfiguration(localFolder);
                if (tag.StartsWith("SYNC|"))
                {
                    var t = viewModel.SyncAsync(localFolder);
                }
                if (tag.StartsWith("EDIT|"))
                {
                    EditConfWindow wind = new EditConfWindow();
                    wind.ShowDialog(conf);
                }
                if (tag.StartsWith("DELETE|"))
                {
                    var result = MessageBox.Show(this, "Are you sure you want to delete the configuration '" + conf.Name + "'?", "SPSync", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes);
                    if (result == MessageBoxResult.Yes)
                    {
                        viewModel.DeleteConfiguration(localFolder);
                    }
                }
                if (tag.StartsWith("ERROR|"))
                {
                    ErrorReport wind = new ErrorReport();
                    wind.ShowDialog(conf);
                }
                break;
            }
            }
        }