Exemplo n.º 1
0
        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command.Equals(ApplicationCommands.Open))
            {
                SyncPair      edited  = e.Parameter as SyncPair;
                DetailsWindow details = new DetailsWindow(edited);
                details.Owner = this;
                if (details.ShowDialog() == true)
                {
                    pairList.Remove(edited);
                    pairList.Add(details.EditedPair);
                }
            }
            else if (e.Command.Equals(ApplicationCommands.Delete))
            {
                SyncPair pair = e.Parameter as SyncPair;

                if (MessageBox.Show(String.Format(Properties.Resources.DeletePairFormat, pair.LocalPath, pair.RemotePath),
                                    Properties.Resources.DeletePairTitle, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    pair.IsEnabled = false;
                    pair.ClearMetadata();
                    pairList.Remove(pair);
                    StatusText = Properties.Resources.StatusDeleted;
                }
            }
            else if (e.Command.Equals(ApplicationCommands.New))
            {
                DetailsWindow details = new DetailsWindow(null);
                details.Owner = this;
                if (details.ShowDialog() == true)
                {
                    pairList.Add(details.EditedPair);
                    StatusText = Properties.Resources.StatusAdded;
                }
            }
            else if (e.Command.Equals(ApplicationCommands.Close))
            {
                this.Close();
            }
            else if (e.Command.Equals(ApplicationCommands.Stop))
            {
                cbPauseActivities_Checked(null, null);
            }
            else if (e.Command.Equals(ApplicationCommands.Help))
            {
                AboutWindow about = new AboutWindow();
                about.Owner = this;
                about.ShowDialog();
            }
            else if (e.Command.Equals(ApplicationCommands.Redo))
            {
                SyncPair pair = e.Parameter as SyncPair;
                if ((pair != null) && (!pair.IsEnabled))
                {
                    pair.IsEnabled = true;
                    StatusText     = Properties.Resources.StatusStarted;
                }
            }
        }
Exemplo n.º 2
0
        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command.Equals(ApplicationCommands.Open))
            {
                SyncPair edited = e.Parameter as SyncPair;
                DetailsWindow details = new DetailsWindow(edited);
                details.Owner = this;
                if (details.ShowDialog() == true)
                {
                    pairList.Remove(edited);
                    pairList.Add(details.EditedPair);
                }
            }
            else if (e.Command.Equals(ApplicationCommands.Delete))
            {
                SyncPair pair = e.Parameter as SyncPair;

                if (MessageBox.Show(String.Format(Properties.Resources.DeletePairFormat, pair.LocalPath, pair.RemotePath),
                    Properties.Resources.DeletePairTitle, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    pair.IsEnabled = false;
                    pair.ClearMetadata();
                    pairList.Remove(pair);
                    StatusText = Properties.Resources.StatusDeleted;
                }
            }
            else if (e.Command.Equals(ApplicationCommands.New))
            {
                DetailsWindow details = new DetailsWindow(null);
                details.Owner = this;
                if (details.ShowDialog() == true)
                {
                    pairList.Add(details.EditedPair);
                    StatusText = Properties.Resources.StatusAdded;
                }
            }
            else if (e.Command.Equals(ApplicationCommands.Close))
            {
                this.Close();
            }
            else if (e.Command.Equals(ApplicationCommands.Stop))
            {
                cbPauseActivities_Checked(null, null);
            }
            else if (e.Command.Equals(ApplicationCommands.Help))
            {
                AboutWindow about = new AboutWindow();
                about.Owner = this;
                about.ShowDialog();
            }
            else if (e.Command.Equals(ApplicationCommands.Redo))
            {
                SyncPair pair = e.Parameter as SyncPair;
                if ((pair != null) && (!pair.IsEnabled))
                {
                    pair.IsEnabled = true;
                    StatusText = Properties.Resources.StatusStarted;
                }

            }
        }