Exemplo n.º 1
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            this._inputReader = this.InputPointReader(this.Input.RecordInfo);
            if (this._inputReader == null)
            {
                args.Success = false;
                return;
            }

            this.Output?.Init(
                FieldDescription.CreateRecordInfo(
                    this.Input.RecordInfo,
                    new FieldDescription(
                        this.ConfigObject.OutputBinXFieldName,
                        FieldType.E_FT_Double,
                        source: "HexBin: X Co-ordinate of Center"),
                    new FieldDescription(
                        this.ConfigObject.OutputBinYFieldName,
                        FieldType.E_FT_Double,
                        source: "HexBin: Y Co-ordinate of Center")));
            this._outputBinXFieldBase = this.Output?[this.ConfigObject.OutputBinXFieldName];
            this._outputBinYFieldBase = this.Output?[this.ConfigObject.OutputBinYFieldName];

            args.Success = true;
        }
Exemplo n.º 2
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            // Get Input Field
            var inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);

            if (inputFieldBase == null)
            {
                args.Success = false;
                return;
            }

            // Create Output Format
            var fieldDescription = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                FieldType.E_FT_V_WString,
                this.ConfigObject.OutputFieldLength,
                source: nameof(StringFormatterEngine));

            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription));
            this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

            // Create the Copier
            this._copier = this.RecordCopierFactory.CreateCopier(
                this.Input.RecordInfo,
                this.Output?.RecordInfo,
                this.ConfigObject.OutputFieldName);

            // Create the Formatter function
            this._formatter = this.CreateFormatter(inputFieldBase);

            args.Success = this._formatter != null;
        }
Exemplo n.º 3
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            var fieldDescription = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                this.ConfigObject.OutputType,
                source: $"NumberParser: {this.ConfigObject.InputFieldName} parsed as a number");

            this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);
            if (this._inputFieldBase == null)
            {
                args.Success = false;
                return;
            }

            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription));
            this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

            // Create the Copier
            this._copier = this.RecordCopierFactory.CreateCopier(
                this.Input.RecordInfo,
                this.Output?.RecordInfo,
                this.ConfigObject.OutputFieldName);

            args.Success = true;
        }
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            // Get Input Field
            this._inputField = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);
            if (this._inputField == null)
            {
                args.Success = false;
                return;
            }

            // Create Output Format
            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo,
                                                                new FieldDescription(nameof(XmlUtils.NodeData.XPath), FieldType.E_FT_V_WString),
                                                                new FieldDescription(nameof(XmlUtils.NodeData.InnerText), FieldType.E_FT_V_WString),
                                                                new FieldDescription(nameof(XmlUtils.NodeData.InnerXml), FieldType.E_FT_V_WString)));

            // Create the Copier
            this._copier = this.RecordCopierFactory.CreateCopier(
                this.Input.RecordInfo,
                this.Output?.RecordInfo,
                nameof(XmlUtils.NodeData.XPath),
                nameof(XmlUtils.NodeData.InnerText),
                nameof(XmlUtils.NodeData.InnerXml));

            this._xpathField     = this.Output?[nameof(XmlUtils.NodeData.XPath)];
            this._innerTextField = this.Output?[nameof(XmlUtils.NodeData.InnerText)];
            this._innerXmlField  = this.Output?[nameof(XmlUtils.NodeData.InnerXml)];

            args.Success = true;
        }
Exemplo n.º 5
0
        void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            string           url    = e.Argument as string;
            SuccessEventArgs result = new SuccessEventArgs();

            MyBackgroundWorker bgw = sender as MyBackgroundWorker;

            bgw.ReportProgress(0, "Checking for new version ...");

            // Download xml file
            //using (XmlTextReader reader = new XmlTextReader(url))
            using (WebClient wc = new WebClient())
            {
                XmlDocument doc = new XmlDocument();
                string      s   = wc.DownloadString(url); //+"?Unused="+random.Next() // to disable caching
                doc.LoadXml(s);
                bgw.ReportProgress(0, "Downloaded new version information.");
                try
                {
                    result.LatestVersion = new Version(doc.SelectSingleNode("//latestversion").InnerText);
                    result.DownloadURL   = doc.SelectSingleNode("//downloadurl").InnerText;
                    result.WebpageURL    = doc.SelectSingleNode("//webpageurl").InnerText;
                }
                catch (Exception)
                {
                    throw new Exception("The version info file has a wrong format.");
                }
            }

            e.Result = result;
        }
Exemplo n.º 6
0
 // called by engine
 static bool RaiseStart()
 {
     var e = new SuccessEventArgs ();
     if(Start != null)
     {
         Start (null, e);
     }
     return e.Success;
 }
        public void OnSuccess(SuccessEventArgs e)
        {
            SuccessEventHandler handler = SuccessEvent;

            if (SuccessEvent != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Called by Alteryx to initialize the incoming connection.
        /// </summary>
        /// <param name="recordInfo">The record information.</param>
        /// <returns>True if OK</returns>
        public bool II_Init(RecordInfo recordInfo)
        {
            this.State      = ConnectionState.InitCalled;
            this.RecordInfo = recordInfo;

            var args = new SuccessEventArgs();

            this.InitCalled?.Invoke(this, args);
            return(args.Success);
        }
Exemplo n.º 9
0
        protected void _msAddTimeEntry_SearchSuccessful(object sender, SuccessEventArgs e)
        {
            _lblMessage.CssClass = "successMessage";
            _lblMessage.Text     = e.Message;

            if (_msAddTimeEntry.ClientRowCount == 0)
            {
                _ddlTimeType.Items.Clear();
            }
        }
Exemplo n.º 10
0
 void worker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled)
     {
         if (Status != null)
         {
             Status(this, new StatusEventArgs()
             {
                 HasFailed = true, Description = "Checking for new version cancelled"
             });
         }
     }
     else if (e.Error != null)
     {
         if (Status != null)
         {
             Status(this, new StatusEventArgs()
             {
                 HasFailed = true, Description = "Checking for new version failed: " + e.Error.Message
             });
         }
     }
     else if (!(e.Result is SuccessEventArgs))
     {
         if (Status != null)
         {
             Status(this, new StatusEventArgs()
             {
                 HasFailed = true, Description = "Checking for new version failed."
             });
         }
     }
     else
     {
         SuccessEventArgs           sea = e.Result as SuccessEventArgs;
         System.Reflection.Assembly A   = System.Reflection.Assembly.GetEntryAssembly();
         if (A != null)
         {
             sea.CurrentVersion = A.GetName().Version;
         }
         else
         {
             sea.CurrentVersion = new Version(0, 0);  // being here is an error.... However for the sake of unittests no error is reported
         }
         sea.HasNewerVersion = sea.LatestVersion > sea.CurrentVersion;
         if (Success != null)
         {
             Success(this, sea);
         }
     }
 }
Exemplo n.º 11
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            this._nextValue = this.CreateRandomFunc();

            var fieldDescription = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                this.ConfigObject.OutputType,
                source: $"RandomNumber: {this.ConfigObject.ToString().Replace($"{this.ConfigObject.OutputFieldName}=", string.Empty)}");

            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription));
            this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

            args.Success = true;
        }
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);
            if (this._inputFieldBase == null)
            {
                args.Success = false;
                return;
            }

            var field = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                FieldType.E_FT_V_String,
                256,
                source: nameof(HashCodeGeneratorEngine));

            this.Output.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, field));
            this._outputFieldBase = this.Output[this.ConfigObject.OutputFieldName];

            this._hashAlgorithm = this.GetAlgorithm();

            args.Success = true;
        }
Exemplo n.º 13
0
 private void OnSuccessReceived(SuccessEventArgs e)
 {
     Success?.Invoke(e);
 }
Exemplo n.º 14
0
        private void Success(Response response, Request request)
        {
            var args = new SuccessEventArgs(response, request);

            OnResponseEvent(args);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Called when an async result is returned
 /// </summary>
 /// <param name="e"></param>
 protected void OnResponseEvent(SuccessEventArgs e)
 {
     ResponseHandler?.Invoke(this, e);
 }
Exemplo n.º 16
0
 private void InputOnInitCalled(IInputProperty property, SuccessEventArgs args)
 {
     this._inputRecords = new Queue <Record>();
     this.Output?.Init(this.Input.RecordInfo);
 }
Exemplo n.º 17
0
		///// <summary>
		///// Discard the Enter key, to avoid the OS-generated "ding" sound.
		///// </summary>
		///// <param name="e"></param>
		//protected override void OnKeyDown(KeyEventArgs e)
		//{
		//    if (e.KeyCode == Keys.Enter && IgnoreEnterKey)
		//    {
		//        e.SuppressKeyPress = true;
		//        e.Handled = true;
		//    }
		//    else
		//    {
		//        base.OnKeyDown(e);
		//    }
		//}

		/// <summary>
		/// Raises the TextPasting event.
		/// </summary>
		protected void OnTextPasting()
		{
			if (TextPasting != null)
			{
				string txt = string.Empty;
				bool success = true;
				SuccessEventArgs args;

				if (Clipboard.ContainsText(TextDataFormat.CommaSeparatedValue) || Clipboard.ContainsText(TextDataFormat.Text) || Clipboard.ContainsText(TextDataFormat.UnicodeText))
				{
					txt = Clipboard.GetText();
				}
				else
				{
					success = false;
				}
				args = new SuccessEventArgs(success, txt);
				
				TextPasting(this, args);
			}
		}
Exemplo n.º 18
0
 // called by engine
 static bool RaiseStart()
 {
     SuccessEventArgs e = null;
     if (Start != null)
     {
         e = new SuccessEventArgs();
         Start(null, e);
     }
     return e != null ? e.Success : SuccessEventArgs.Default;
 }
Exemplo n.º 19
0
 private void OnLoaded(object sender, SuccessEventArgs e)
 {
     Device.BeginInvokeOnMainThread(async() => await newsList.FadeTo(1, easing: Easing.CubicInOut));
 }
Exemplo n.º 20
0
        void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            string url = e.Argument as string;
            SuccessEventArgs result = new SuccessEventArgs();

            MyBackgroundWorker bgw = sender as MyBackgroundWorker;
            bgw.ReportProgress(0, "Checking for new version ...");

            // Download xml file            
            //using (XmlTextReader reader = new XmlTextReader(url))
            using (WebClient wc = new WebClient())
            {
                XmlDocument doc = new XmlDocument();
                string s = wc.DownloadString(url); //+"?Unused="+random.Next() // to disable caching
                doc.LoadXml(s);
                bgw.ReportProgress(0, "Downloaded new version information.");
                try
                {
                    result.LatestVersion = new Version(doc.SelectSingleNode("//latestversion").InnerText);
                    result.DownloadURL = doc.SelectSingleNode("//downloadurl").InnerText;
                    result.WebpageURL = doc.SelectSingleNode("//webpageurl").InnerText;
                }
                catch (Exception)
                {
                    throw new Exception("The version info file has a wrong format.");
                }
            }

            e.Result = result;
            
        }