Example #1
0
        // Методы
        #region Методы

        public static void InitializeProcessManager(MainWindow mainWindow)
        {
            m_MainWindow = mainWindow;
            m_TaskCounter = 0;
            m_Tasks = null;
            m_CurrentTask = null;
            m_DataReceivedHandler = null;
            m_RunMode = RunMode.All;
            m_IsCurrentlySomeTaskRunning = false;
        }
Example #2
0
 public TaskElement(MainWindow mainWindow, MyTask task, int processId)
 {
     InitializeComponent();
     m_MainWindow = mainWindow;
     m_ParentTask = task;
     m_TaskID = processId;
     m_IsCurrent = false;
     m_TaskElementState = TaskElementState.Normal;
     m_PreviousTaskElementState = m_TaskElementState;
     SetBackgroundBrush = TaskElement.m_NormalStateBrush;
     EventsAndOtherSettings();
 }
Example #3
0
        // Конструкторы
        #region Конструкторы
        public MyTask(MainWindow mainWindow)
        {
            m_TaskID = mainWindow.GetTasksCounter + 1;
            m_Process = new Process();
            m_TaskElement = new TaskElement(mainWindow, this, m_TaskID);
            m_UtilityName = String.Empty;
            m_SrcFileName = String.Empty;
            m_ThumbnailFile = String.Empty;
            //m_OutputFileName = "";
            m_ProcessArguments = String.Empty;
            m_IsEditing = false;
            m_State = TaskState.Default;
            m_IsThereOutput = false;

            // Необходимо для перенаправления входного и выходного потоков командной строки
            m_Process.StartInfo.UseShellExecute = false;
            // Разрешаем перенаправить выходной поток
            m_Process.StartInfo.RedirectStandardOutput = true;
            // Разрешаем перенаправить поток ошибок 
            m_Process.StartInfo.RedirectStandardError = true;
            // Устанавливаем кодировку выходного потока (поддержка русского языка)  
            m_Process.StartInfo.StandardOutputEncoding = Encoding.GetEncoding("cp866");
            m_Process.StartInfo.StandardErrorEncoding = Encoding.GetEncoding("cp866");
            // Не создавать окно процесса
            m_Process.StartInfo.CreateNoWindow = true;
            // Нужно, чтобы вызывалось событие Exited
            m_Process.EnableRaisingEvents = true;
            // Добавляем обработчик события Exited
            m_Process.Exited += new EventHandler(Process_Exited);
        }
Example #4
0
        public TaskElement(TaskElement copy, SelectTaskDialogWindow selectTaskDialogWindow)
        {
            InitializeComponent();
            this.m_MainWindow = null;
            this.m_SelectTaskDialogWindow = selectTaskDialogWindow;
            this.m_ParentTask = copy.m_ParentTask;
            this.m_TaskID = copy.m_TaskID;
            this.m_IsCurrent = false;
            this.m_TaskElementState = TaskElementState.Normal;
            this.m_PreviousTaskElementState = m_TaskElementState;
            this.SetBackgroundBrush = TaskElement.m_NormalStateBrush;

            this.SetImageToImagePreviewElement(this.m_ParentTask.ThumbnailPath);
            this.SetTaskIDToLabel(this.m_TaskID);
            this.SetUtilityNameToLabel(this.m_ParentTask.UtilityName);
            this.SetFileNameToLabelAndToolTip(this.m_ParentTask.SrcFileName);
            this.SetTaskElementState(TaskElementState.Normal);

            this.MouseEnter += new MouseEventHandler(taskElement_MouseEnter);
            this.MouseLeave += new MouseEventHandler(taskElement_MouseLeave);
            this.MouseLeftButtonDown += new MouseButtonEventHandler(taskElement_MouseLeftButtonDown_SelectTaskDialog);
            this.image_SrcImagePreview.MouseEnter += new MouseEventHandler(Image_SrcImagePreview_MouseEnter);
            this.image_SrcImagePreview.MouseLeave += new MouseEventHandler(Image_SrcImagePreview_MouseLeave);

            Binding myBinding = new Binding();
            myBinding.Path = new PropertyPath("SetBackgroundBrush");
            myBinding.Mode = BindingMode.TwoWay;
            myBinding.Source = this;
            myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            this.SetBinding(UserControl.BackgroundProperty, myBinding);
        }
        // Конструкторы
        #region Конструкторы
        public TaskEditWindow(MainWindow mainWindow)
        {
            InitializeComponent();
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            
            m_MainWindow = mainWindow;
            m_Task = new MyTask(m_MainWindow);
            m_IsThisTaskAdded = false;
            m_UtilitiesNames = new List<string>();
            m_UtilityParameters = new List<MyDataRow>();
            m_CurrentMode = InputMode.OneFile;
            m_FormedParametersArgument = String.Empty;
            m_AdditionalParametersInputs = new List<DataTable>();
            m_TaskEditWindowMode = TaskEditWindowMode.NewTask;
            m_InputModeChoices = new Dictionary<InputMode, string>();
            m_InputFiles = new List<string>();

            // Инициализируем экземпляр процесса, чтобы узнавать версии утилит
            m_ProcessForVersion = new Process();
            m_ProcessForVersion.StartInfo.UseShellExecute = false;
            m_ProcessForVersion.StartInfo.CreateNoWindow = true;
            m_ProcessForVersion.StartInfo.RedirectStandardOutput = true;
            m_ProcessForVersion.StartInfo.Arguments = "--version";
            m_ProcessForVersion.OutputDataReceived += new DataReceivedEventHandler(ProcessForVerion_DataReceived);

            EventAndPropertiesInitialization();
            ConnectToDbAndGetNecessaryData();
        }