Esempio n. 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Core.ApplicationData.Instance.ActiveGeocache != null)
            {
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "";                    // Default file name
                dlg.DefaultExt = ".*";                  // Default file extension
                dlg.Filter     = "All files (*.*)|*.*"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    //add
                    _editingForComments = new GAPPSF.Attachement.Item();
                    _editingForComments.GeocacheCode = Core.ApplicationData.Instance.ActiveGeocache.Code;
                    _editingForComments.FileName     = dlg.FileName;
                    _editingForComments.Comment      = "";

                    inputDialog.Show(Localization.TranslationManager.Instance.Translate("Comment").ToString());
                    inputDialog.DialogClosed += newDialog_DialogClosed;
                }
            }
        }
Esempio n. 2
0
 private void newDialog_DialogClosed(object sender, EventArgs e)
 {
     inputDialog.DialogClosed -= newDialog_DialogClosed;
     if (inputDialog.DialogResult)
     {
         string s = inputDialog.InputText.Trim();
         if (_editingForComments != null)
         {
             _editingForComments.Comment = s;
             GAPPSF.Attachement.Manager.Instance.AddAttachement(_editingForComments);
             Attachements.Add(_editingForComments);
             SelectedItem = _editingForComments;
         }
     }
     _editingForComments = null;
 }