Пример #1
0
        private string CheckFileExists(string filename)
        {
            if (File.Exists(filename))
            {
                return(filename);
            }

            if (_textData.IsOpened && Path.GetFileName(_textData.Filename) == Path.GetFileName(filename))
            {
                return(filename);
            }

            string baseDir = Utilities.GetAbsolutePath(Properties.Settings.Default.ScriptPath);

            var files = Directory.GetFiles(baseDir, Path.GetFileName(filename), SearchOption.AllDirectories);

            if (files.Length == 0)
            {
                return(null);
            }

            var ktd = new KryptonTaskDialog
            {
                Icon            = MessageBoxIcon.Information,
                CommonButtons   = TaskDialogButtons.Cancel,
                WindowTitle     = "看上去这个存档中记录的路径信息不太正确",
                MainInstruction = "不过,下面这个文件可能是正确的 :",
                Content         = Utilities.GetRelativePath(files[0], Utilities.GetAbsolutePath("")),
            };

            var ktdcOk = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.OK,
                Image        = Properties.Resources.arrow_right_green,
                Text         = "好,就用这个",
            };
            var ktdcNo = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.Cancel,
                Image        = Properties.Resources.arrow_right_red,
                Text         = "不,这个是错误的",
            };

            ktd.CommandButtons.AddRange(new[] { ktdcOk, ktdcNo });
            if (ktd.ShowDialog() == DialogResult.OK)
            {
                return(files[0]);
            }

            return(null);
        }
Пример #2
0
 private void OnRadioButtonCheckedChanged(object sender, EventArgs e)
 {
     KryptonRadioButton button = (KryptonRadioButton)sender;
     _defaultRadioButton = (KryptonTaskDialogCommand)button.Tag;
     _taskDialog.DefaultRadioButton = _defaultRadioButton;
 }
Пример #3
0
        /// <summary>
        /// Initialize a new instance of the VisualTaskDialog class.
        /// </summary>
        /// <param name="taskDialog">Reference to component with definition of content.</param>
        public VisualTaskDialog(KryptonTaskDialog taskDialog)
        {
            // Must provide a valid reference
            if (taskDialog == null)
                throw new ArgumentNullException("taskDialog");

            _taskDialog = taskDialog;

            // Initialize with task dialog values
            _windowTitle = taskDialog.WindowTitle;
            _mainInstruction = taskDialog.MainInstruction;
            _content = taskDialog.Content;
            _mainIcon = taskDialog.Icon;
            _customMainIcon = taskDialog.CustomIcon;
            _radioButtons = taskDialog.RadioButtons;
            _commandButtons = taskDialog.CommandButtons;
            _commonButtons = taskDialog.CommonButtons;
            _defaultRadioButton = taskDialog.DefaultRadioButton;
            _defaultButton = taskDialog.DefaultButton;
            _footerIcon = taskDialog.FooterIcon;
            _customFooterIcon = taskDialog.CustomFooterIcon;
            _footerText = taskDialog.FooterText;
            _footerHyperlink = taskDialog.FooterHyperlink;
            _checkboxText = taskDialog.CheckboxText;
            _checkboxState = taskDialog.CheckboxState;
            _allowDialogClose = taskDialog.AllowDialogClose;

            InitializeComponent();
            UpdateContents();
        }
Пример #4
0
        private string CheckFileExists(string filename)
        {
            if (File.Exists(filename))
                return filename;

            if (_textData.IsOpened && Path.GetFileName(_textData.Filename) == Path.GetFileName(filename))
                return filename;

            string baseDir = Utilities.GetAbsolutePath(Properties.Settings.Default.ScriptPath);

            var files = Directory.GetFiles(baseDir, Path.GetFileName(filename), SearchOption.AllDirectories);
            if (files.Length == 0)
                return null;

            var ktd = new KryptonTaskDialog
            {
                Icon = MessageBoxIcon.Information,
                CommonButtons = TaskDialogButtons.Cancel,
                WindowTitle = "����ȥ����浵�м�¼��·����Ϣ��̫��ȷ",
                MainInstruction = "��������������ļ���������ȷ�ġ���",
                Content = Utilities.GetRelativePath(files[0], Utilities.GetAbsolutePath("")),
            };

            var ktdcOk = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.OK,
                Image = Properties.Resources.arrow_right_green,
                Text = "��������",
            };
            var ktdcNo = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.Cancel,
                Image = Properties.Resources.arrow_right_red,
                Text = "��������Ǵ����",
            };

            ktd.CommandButtons.AddRange(new[] { ktdcOk, ktdcNo });
            if (ktd.ShowDialog() == DialogResult.OK)
                return files[0];

            return null;
        }