Esempio n. 1
0
        private bool DoOpen()
        {
            DebugHelper.AssertUIThread();
            bool handled = false;

            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                if (data.SelectedItem is string)
                {
                    handled = true;

                    data.Open((string)data.SelectedItem);
                }
                else if (data.SelectedItem is KStudioFileInfo)
                {
                    handled = true;

                    this.DialogResult = true;

                    Close();
                }
            }

            return(handled);
        }
Esempio n. 2
0
        protected override void OnClosed(EventArgs e)
        {
            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                data.SaveSettings(this.DialogResult == true);
            }

            base.OnClosed(e);
        }
Esempio n. 3
0
        private void GoUp_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            DebugHelper.AssertUIThread();

            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                e.Handled = true;

                e.CanExecute = data.ParentDirectory != null;
            }
        }
Esempio n. 4
0
        private void Ok_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                if (data.IsSaveDialog)
                {
                    e.Handled = DoSave();
                }
                else
                {
                    e.Handled = DoOpen();
                }
            }
        }
Esempio n. 5
0
        private void GoUp_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            DebugHelper.AssertUIThread();

            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                using (WaitCursor waitCursor = new WaitCursor(this))
                {
                    e.Handled = true;

                    data.GoUp();
                }
            }
        }
Esempio n. 6
0
        private void Ok_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            DebugHelper.AssertUIThread();

            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                e.Handled = true;

                if (data.IsSaveDialog)
                {
                    e.CanExecute = !String.IsNullOrWhiteSpace(data.FileName);
                }
                else
                {
                    e.CanExecute = data.SelectedItem != null;
                }
            }
        }
Esempio n. 7
0
        private bool DoSave()
        {
            DebugHelper.AssertUIThread();
            bool handled = false;

            TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData;

            if (data != null)
            {
                if (data.IsValidFileName)
                {
                    handled = true;

                    this.DialogResult = true;

                    Close();
                }
            }

            return(handled);
        }