Esempio n. 1
0
        /// <summary>
        /// Удаление уже привязанных сигналов из списка сигналов
        /// </summary>
        /// <param name="items">Пары уже связанных сигналов</param>
        /// <param name="filterList">Какой проект проверяется</param>
        /// <returns></returns>
        private IEnumerable <ListViewItem> RemoveBindedSignals(
            IEnumerable <ListViewItem> items, FilterList filterList)
        {
            Dictionary <string, List <string[]> > allSignals =
                InterprojectExchange.GetInstance().GetBindedSignals();

            var projectSignals = new List <string>();

            foreach (var signalGroup in allSignals.Keys)
            {
                foreach (var signalPair in allSignals[signalGroup])
                {
                    var signal = signalPair[(int)filterList];
                    projectSignals.Add(signal);
                }
            }

            var filteredSignals = new List <ListViewItem>();
            int subItemIndex    = filterList == FilterList.CurrentProject ? 1 : 0;

            foreach (var item in items)
            {
                string itemName = item.SubItems[subItemIndex].Text;
                if (!projectSignals.Contains(itemName))
                {
                    filteredSignals.Add(item);
                }
            }

            return(filteredSignals);
        }
        /// <summary>
        /// Получить экземпляр класса. Singleton
        /// </summary>
        /// <returns></returns>
        public static InterprojectExchange GetInstance()
        {
            if (interprojectExchange == null)
            {
                interprojectExchange = new InterprojectExchange();
            }

            return(interprojectExchange);
        }
Esempio n. 3
0
        private void PACSettingsForm_Load(object sender, EventArgs e)
        {
            interprojectExchange    = InterprojectExchange.GetInstance();
            mainModel               = interprojectExchange.MainModel;
            projectsSendingFromMain = new Dictionary <string, PacInfo>();
            projectsSendingToMain   = new Dictionary <string, PacInfo>();
            WorkWithProjectsData(true);

            projectBeforeOpenForm = interprojectExchange.Models
                                    .Where(x => x.Selected == true)
                                    .Select(x => x.ProjectName)
                                    .FirstOrDefault();
        }
Esempio n. 4
0
        /// <summary>
        /// Настройки PAC
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pacSetUpBtn_Click(object sender, EventArgs e)
        {
            var form = new PACSettingsForm(InterprojectExchange.GetInstance()
                                           .EditMode);

            form.ShowDialog();

            string selectedModelName = advProjNameComboBox.Text;

            if (!string.IsNullOrEmpty(selectedModelName))
            {
                IProjectModel selectedModel = interprojectExchange.GetModel(
                    selectedModelName);
                interprojectExchange.SelectModel(selectedModel);
            }
        }
Esempio n. 5
0
        private void PACSettingsForm_Load(object sender, EventArgs e)
        {
            // Установка стандартного значения режима
            modeComboBox.SelectedValueChanged -=
                modeComboBox_SelectedValueChanged;
            modeComboBox.SelectedIndex = 0;
            editMode = EditMode.MainSource;
            modeComboBox.SelectedValueChanged +=
                modeComboBox_SelectedValueChanged;

            interprojectExchange    = InterprojectExchange.GetInstance();
            mainModel               = interprojectExchange.MainModel;
            projectsSendingFromMain = new Dictionary <string, PacInfo>();
            projectsSendingToMain   = new Dictionary <string, PacInfo>();
            WorkWithProjectsData(true);

            projectBeforeOpenForm = interprojectExchange.Models
                                    .Where(x => x.Selected == true)
                                    .Select(x => x.ProjectName)
                                    .FirstOrDefault();
        }
        public InterprojectExchangeForm()
        {
            InitializeComponent();

            // Получение основных экземпляров классов, подписка на событие
            // обновления списков через фильтр
            interprojectExchange = InterprojectExchange.GetInstance();
            filterConfiguration  = FilterConfiguration.GetInstance();
            filterConfiguration.SignalsFilterChanged += RefilterListViews;

            // Инициализация начальных списков
            currProjItems = new List <ListViewItem>();
            advProjItems  = new List <ListViewItem>();

            // Установлен первый элемент в списке "Источник >> Приемник"
            modeComboBox.SelectedValueChanged -=
                modeComboBox_SelectedValueChanged;
            modeComboBox.SelectedIndex = 0;
            interprojectExchange.ChangeEditMode(modeComboBox.SelectedIndex);
            modeComboBox.SelectedValueChanged +=
                modeComboBox_SelectedValueChanged;
        }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="owner">Класс-владелец</param>
 /// <param name="signalsFile">Имя файла, межконтроллерного обмена
 /// </param>
 public InterprojectExchangeSaver(InterprojectExchange owner,
                                  string signalsFile)
 {
     interprojectExchange = owner;
     SharedFile           = signalsFile;
 }
Esempio n. 8
0
 public InterprojectExchangeStarter()
 {
     interprojectExchange = InterprojectExchange.GetInstance();
     interprojectExchange.Clear();
 }