Esempio n. 1
0
		private void ExportTypeCtrlSelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			ExportType = (ExportTypes)ExportTypeCtrl.SelectedIndex;

			ExportTypeCtrl.SelectionChanged -= ExportTypeCtrlSelectionChanged;

			try
			{
				ExportTypeCtrl.SelectedIndex = -1;
				ExportStarted.SafeInvoke();
			}
			finally
			{
				ExportTypeCtrl.SelectionChanged += ExportTypeCtrlSelectionChanged;
			}
		}
Esempio n. 2
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            if (ExportType.SelectedItems.Count == 0)
            {
                return;
            }

            string path   = null;
            var    dialog = new Microsoft.Win32.SaveFileDialog();

            dialog.Title    = "Select a Directory"; // instead of default "Save As"
            dialog.Filter   = "Directory|*.Folder"; // Prevents displaying files
            dialog.FileName = "Select";             // Filename will then be "select.this.directory"
            if (dialog.ShowDialog() == true)
            {
                path = dialog.FileName;
                // Remove fake filename from resulting path
                path = path.Replace("\\Select.Folder", "");
                path = path.Replace(".Folder", "");
                // If user has changed the filename, create the new directory
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path);
                }
                // Our final value is in path
            }
            else
            {
                return;
            }

            foreach (ListBoxItem lb in ExportType.SelectedItems)
            {
                var         s  = lb.Content.ToString().Replace(" ", "");
                ExportTypes et = (ExportTypes)Enum.Parse(typeof(ExportTypes), s);
                ExportTextures(path, et);
            }
        }
Esempio n. 3
0
		/// <summary>
		/// Сгенерировать имя эспортируемого файла.
		/// </summary>
		/// <param name="security">Инструмент.</param>
		/// <param name="dataType">Тип маркет-данных.</param>
		/// <param name="arg">Параметр свечи.</param>
		/// <param name="from">Дата начала.</param>
		/// <param name="to">Дата окончания.</param>
		/// <param name="type">Тип экспорта.</param>
		/// <returns>Имя эспортируемого файла.</returns>
		public static string GetFileName(this Security security, Type dataType, object arg, DateTime? from, DateTime? to, ExportTypes type)
		{
			if (dataType == null)
				throw new ArgumentNullException(nameof(dataType));

			if (security == null && dataType != typeof(NewsMessage) && dataType != typeof(SecurityMessage))
				throw new ArgumentNullException(nameof(security));

			string fileName;

			if (dataType == typeof(QuoteChangeMessage))
				fileName = "depths";
			else if (dataType == typeof(Level1ChangeMessage))
				fileName = "level1";
			else if (dataType.IsSubclassOf(typeof(CandleMessage)))
				fileName = "candles_{0}_{1}".Put(typeof(TimeFrameCandle).Name, arg).Replace(':', '_');
			else if (dataType == typeof(NewsMessage))
				fileName = "news";
			else if (dataType == typeof(SecurityMessage))
				fileName = "securities";
			else if (dataType == typeof(ExecutionMessage))
			{
				switch ((ExecutionTypes)arg)
				{
					case ExecutionTypes.Tick:
						fileName = "trades";
						break;
					case ExecutionTypes.OrderLog:
						fileName = "orderLog";
						break;
					case ExecutionTypes.Order:
						fileName = "executions";
						break;
					default:
						throw new ArgumentOutOfRangeException(nameof(arg));
				}
			}
			else
				throw new ArgumentOutOfRangeException(nameof(dataType));

			if (security != null)
				fileName += security.Id.SecurityIdToFolderName();

			if (from != null && to != null)
				fileName += "_{0:yyyy_MM_dd}_{1:yyyy_MM_dd}".Put(from, to);

			switch (type)
			{
				case ExportTypes.Excel:
					fileName += ".xlsx";
					break;
				case ExportTypes.Xml:
					fileName += ".xml";
					break;
				case ExportTypes.Txt:
					fileName += ".csv";
					break;
				case ExportTypes.Sql:
					break;
				case ExportTypes.Bin:
					fileName += ".bin";
					break;
				default:
					throw new ArgumentOutOfRangeException(nameof(type));
			}

			return fileName;
		}
Esempio n. 4
0
        /// <summary>
        /// Creates an instance of the ProfileProductionDataRequest class and populate it with data needed for a design profile.
        /// </summary>
        public ExportReport CreateExportRequest(
            DateTime?startUtc,
            DateTime?endUtc,
            CoordType coordType,
            ExportTypes exportType,
            string fileName,
            bool restrictSize,
            bool rawData,
            OutputTypes outputType,
            string machineNames,
            double tolerance = 0.0)
        {
            // todo once the requirement for RAPTOR build to be able to call TRex endpoints is removed
            //      this whole tangle can be unraveled
            var liftSettings = SettingsManager.CompactionLiftBuildSettings(ProjectSettings);

#if RAPTOR
            T3DBoundingWorldExtent projectExtents = new T3DBoundingWorldExtent();
            TMachine[]             machineList    = null;
            machineNameList = new string[0];

            if (exportType == ExportTypes.SurfaceExport)
            {
                raptorClient.GetDataModelExtents(ProjectId,
                                                 RaptorConverters.convertSurveyedSurfaceExlusionList(Filter?.SurveyedSurfaceExclusionList), out projectExtents);
            }
            else
            {
                TMachineDetail[] machineDetails = raptorClient.GetMachineIDs(ProjectId);

                if (machineDetails != null)
                {
                    if (!string.IsNullOrEmpty(machineNames) && machineNames != "All")
                    {
                        machineNameList = machineNames.Split(',');
                        machineDetails  = machineDetails.Where(machineDetail => machineNameList.Contains(machineDetail.Name)).ToArray();
                    }

                    machineList = machineDetails.Select(m => new TMachine {
                        AssetID = m.ID, MachineName = m.Name, SerialNo = ""
                    }).ToArray();
                }
            }

            if (!string.IsNullOrEmpty(fileName))
            {
                fileName = StripInvalidCharacters(fileName);
            }

            return(new ExportReport(
                       ProjectId,
                       ProjectUid,
                       liftSettings,
                       Filter,
                       -1,
                       null,
                       false,
                       null,
                       coordType,
                       startUtc ?? DateTime.MinValue,
                       endUtc ?? DateTime.MinValue,
                       tolerance,
                       false,
                       restrictSize,
                       rawData,
                       RaptorConverters.convertProjectExtents(projectExtents),
                       false,
                       outputType,
                       RaptorConverters.convertMachines(machineList),
                       exportType == ExportTypes.SurfaceExport,
                       fileName,
                       exportType,
                       ConvertUserPreferences(userPreferences, projectDescriptor.ProjectTimeZone)));
#else
            if (exportType == ExportTypes.SurfaceExport)
            {
                if (!string.IsNullOrEmpty(machineNames) && machineNames != "All")
                {
                    machineNameList = machineNames.Split(',');
                }
            }
            return(new ExportReport(
                       ProjectId,
                       ProjectUid,
                       liftSettings,
                       Filter,
                       -1,
                       null,
                       false,
                       null,
                       coordType,
                       startUtc ?? DateTime.MinValue,
                       endUtc ?? DateTime.MinValue,
                       tolerance,
                       false,
                       restrictSize,
                       rawData,
                       null,//project extents are retrieved in the TRex gateway as part of this request
                       false,
                       outputType,
                       null,
                       exportType == ExportTypes.SurfaceExport,
                       fileName,
                       exportType,
                       ConvertUserPreferences(userPreferences, projectDescriptor.ProjectTimeZone)));
#endif
        }
Esempio n. 5
0
        /// <summary>
        /// Сгенерировать имя эспортируемого файла.
        /// </summary>
        /// <param name="security">Инструмент.</param>
        /// <param name="dataType">Тип маркет-данных.</param>
        /// <param name="arg">Параметр свечи.</param>
        /// <param name="from">Дата начала.</param>
        /// <param name="to">Дата окончания.</param>
        /// <param name="type">Тип экспорта.</param>
        /// <returns>Имя эспортируемого файла.</returns>
        public static string GetFileName(this Security security, Type dataType, object arg, DateTime?from, DateTime?to, ExportTypes type)
        {
            if (dataType == null)
            {
                throw new ArgumentNullException(nameof(dataType));
            }

            if (security == null && dataType != typeof(NewsMessage) && dataType != typeof(SecurityMessage))
            {
                throw new ArgumentNullException(nameof(security));
            }

            string fileName;

            if (dataType == typeof(QuoteChangeMessage))
            {
                fileName = "depths";
            }
            else if (dataType == typeof(Level1ChangeMessage))
            {
                fileName = "level1";
            }
            else if (dataType.IsSubclassOf(typeof(CandleMessage)))
            {
                fileName = "candles_{0}_{1}".Put(typeof(TimeFrameCandle).Name, arg).Replace(':', '_');
            }
            else if (dataType == typeof(NewsMessage))
            {
                fileName = "news";
            }
            else if (dataType == typeof(SecurityMessage))
            {
                fileName = "securities";
            }
            else if (dataType == typeof(ExecutionMessage))
            {
                switch ((ExecutionTypes)arg)
                {
                case ExecutionTypes.Tick:
                    fileName = "trades";
                    break;

                case ExecutionTypes.OrderLog:
                    fileName = "orderLog";
                    break;

                case ExecutionTypes.Order:
                    fileName = "executions";
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(arg));
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException(nameof(dataType));
            }

            if (security != null)
            {
                fileName += security.Id.SecurityIdToFolderName();
            }

            if (from != null && to != null)
            {
                fileName += "_{0:yyyy_MM_dd}_{1:yyyy_MM_dd}".Put(from, to);
            }

            switch (type)
            {
            case ExportTypes.Excel:
                fileName += ".xlsx";
                break;

            case ExportTypes.Xml:
                fileName += ".xml";
                break;

            case ExportTypes.Txt:
                fileName += ".csv";
                break;

            case ExportTypes.Sql:
                break;

            case ExportTypes.Bin:
                fileName += ".bin";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type));
            }

            return(fileName);
        }
Esempio n. 6
0
 public DataExportEventArgs(ExportTypes exportType)
 {
     _exportType = exportType;
 }
Esempio n. 7
0
		public void EnableType(ExportTypes type, bool isEnabled)
		{
			((ListBoxItem)ExportTypeCtrl.Items[(int)type]).IsEnabled = isEnabled;
		}
Esempio n. 8
0
 public void EnableType(ExportTypes type, bool isEnabled)
 {
     ((ListBoxItem)ExportTypeCtrl.Items[(int)type]).IsEnabled = isEnabled;
 }
Esempio n. 9
0
 public void ExportReport(ReportDocument oReport, string cFileName, ExportTypes oExportTypes)
 {
     this.ExportReport(oReport, cFileName, oExportTypes, 0, 0);
 }
Esempio n. 10
0
 /// <summary>
 /// Overload constructor with parameters.
 /// </summary>>
 public ExportReport(long projectId, Guid?projectUid, LiftBuildSettings liftBuildSettings, FilterResult filter, long filterID, Guid?callid, bool cellSizeRq, string callerID, CoordType coordtype,
                     DateTime dateFromUTC, DateTime dateToUTC, double tolerance, bool timeStampRequired, bool restrictSize, bool rawData, BoundingExtents3D prjExtents, bool precheckOnly, OutputTypes outpuType,
                     Machine[] machineList, bool includeSrvSurface, string fileName, ExportTypes exportType, UserPreferences userPrefs)
 {
     ProjectId             = projectId;
     ProjectUid            = projectUid;
     LiftBuildSettings     = liftBuildSettings;
     Filter                = filter;
     FilterID              = filterID;
     CallId                = callid;
     CellSizeRequired      = cellSizeRq;
     CallerId              = callerID;
     CoordType             = coordtype;
     DateFromUTC           = dateFromUTC;
     DateToUTC             = dateToUTC;
     ExportType            = exportType;
     Filename              = fileName;
     IncludeSurveydSurface = includeSrvSurface;
     MachineList           = machineList;
     OutputType            = outpuType;
     Precheckonly          = precheckOnly;
     ProjectExtents        = prjExtents;
     RawData               = rawData;
     RestrictSize          = restrictSize;
     TimeStampRequired     = timeStampRequired;
     Tolerance             = tolerance;
     UserPrefs             = userPrefs;
 }
Esempio n. 11
0
 public object Any(ExportTypes request) => request;