aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddNewSegmentCommand.cs
blob: c8dff948c74bcf106808dbc1cd78f3da26f6126f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.PPC.Jobs.Models;

namespace Tango.PPC.Jobs.UndoRedoCommands
{
    public class AddNewSegmentCommand : IUndoRedoCommand
    {
        private JobModel _jobModel;
        private SegmentModel _newSegment;
        private int _index;
        private double _defaultLength;

        public AddNewSegmentCommand(JobModel job, ISegmentModel segment, double defaultLength)
        {
            _jobModel = job;
            _index = segment.SegmentIndex;
            _defaultLength = defaultLength;
        }

        public void Execute()
        {
            _newSegment = _jobModel.AddNewSegment(_defaultLength, _index);
        }

        public void UnExecute()
        {
            _jobModel.Segments.Remove(_newSegment);
            _jobModel.GroupingSegments.Remove(_newSegment);
            _jobModel.ArrangeSegmentsIndixes();

        }
    }
}
n>); } size_t stop_events_notification_request__pack_to_buffer (const StopEventsNotificationRequest *message, ProtobufCBuffer *buffer) { assert(message->base.descriptor == &stop_events_notification_request__descriptor); return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); } StopEventsNotificationRequest * stop_events_notification_request__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { return (StopEventsNotificationRequest *) protobuf_c_message_unpack (&stop_events_notification_request__descriptor, allocator, len, data); } void stop_events_notification_request__free_unpacked (StopEventsNotificationRequest *message, ProtobufCAllocator *allocator) { if(!message) return; assert(message->base.descriptor == &stop_events_notification_request__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } #define stop_events_notification_request__field_descriptors NULL #define stop_events_notification_request__field_indices_by_name NULL #define stop_events_notification_request__number_ranges NULL const ProtobufCMessageDescriptor stop_events_notification_request__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "", "", "", "", sizeof(StopEventsNotificationRequest), 0, stop_events_notification_request__field_descriptors, stop_events_notification_request__field_indices_by_name, 0, stop_events_notification_request__number_ranges, (ProtobufCMessageInit) stop_events_notification_request__init, NULL,NULL,NULL /* reserved[123] */ };