Beispiel #1
0
        private void LoadDefinitionFile(string filename)
        {
            try
            {
                m_octopusInstance = new OctopusInstance(filename);
                m_octopusInstance.Load();

                m_paramsVM.ParameterCollection = m_octopusInstance.ParameterCollection;
                m_paramsVM.ParameterCollection.ItemPropertyChanged  += m_paramsVM.PropertyChangedHandler;
                m_paramsVM.ParameterCollection.ItemPropertyChanging += m_paramsVM.PropertyChangingHandler;
                m_machineVM.MachineCollection = m_octopusInstance.MachineCollection;
                m_machineVM.MachineCollection.ItemPropertyChanged += m_machineVM.PropertyChangedHandler;
                m_actionVM.ActionCollection = m_octopusInstance.ActionCollection;
                m_actionVM.ActionCollection.ItemPropertyChanged  += m_actionVM.PropertyChangedHandler;
                m_actionVM.ActionCollection.ItemPropertyChanging += m_actionVM.PropertyChangingHandler;
                m_taskVM.TaskCollection = m_octopusInstance.TaskCollection;
                m_taskVM.TaskCollection.ItemPropertyChanged += m_taskVM.PropertyChangedHandler;
                foreach (OctopusLib.Task task in m_taskVM.TaskCollection)
                {
                    task.TaskActionCollection.ItemPropertyChanged += m_taskVM.PropertyChangedHandler;
                }
                m_executionVM.OctopusInst = m_octopusInstance;
                m_executionVM.ConfigFile  = filename;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.currentFile = string.Empty;
            }
        }
Beispiel #2
0
        private void NewExecute(object sender, ExecutedRoutedEventArgs e)
        {
            if (m_actionVM != null && m_machineVM != null && m_paramsVM != null && m_taskVM != null)
            {
                if (m_actionVM.IsModified || m_machineVM.IsModified || m_paramsVM.IsModified || m_taskVM.IsModified)
                {
                    MessageBoxResult result = MessageBox.Show("Do you want to save the modification before create a new Octopus Definition file?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (result == MessageBoxResult.Yes)
                    {
                        if (!SaveDefinitionFile(currentFile))
                        {
                            return;
                        }
                    }
                }
            }
            m_executionVM.StopExecution();
            if (m_executionVM.RunInstanceCollection != null)
            {
                m_executionVM.RunInstanceCollection.Clear();
            }
            tabParams.IsSelected = true;

            InitializeVMCollection();
            m_octopusInstance = new OctopusInstance();
            m_paramsVM.ParameterCollection = m_octopusInstance.ParameterCollection;
            m_paramsVM.ParameterCollection.ItemPropertyChanged += m_paramsVM.PropertyChangedHandler;
            m_machineVM.MachineCollection = m_octopusInstance.MachineCollection;
            m_machineVM.MachineCollection.ItemPropertyChanged += m_machineVM.PropertyChangedHandler;
            m_actionVM.ActionCollection = m_octopusInstance.ActionCollection;
            m_actionVM.ActionCollection.ItemPropertyChanged  += m_actionVM.PropertyChangedHandler;
            m_actionVM.ActionCollection.ItemPropertyChanging += m_actionVM.PropertyChangingHandler;
            m_taskVM.TaskCollection = m_octopusInstance.TaskCollection;
            m_taskVM.TaskCollection.ItemPropertyChanged += m_taskVM.PropertyChangedHandler;
            foreach (OctopusLib.Task task in m_taskVM.TaskCollection)
            {
                task.TaskActionCollection.ItemPropertyChanged += m_taskVM.PropertyChangedHandler;
            }
            m_executionVM.OctopusInst = m_octopusInstance;
            CreateNewDefinition();
            currentFile = null;
            this.Title  = string.Format("{0} - Untitled*", windowTitle);
        }