Пример #1
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            if (this.action == "view")
            {
                return;
            }

            GridView    view    = sender as GridView;
            GridHitInfo hitInfo = view.CalcHitInfo(view.GridControl.PointToClient(Cursor.Position));

            if (hitInfo.InRow && !view.IsGroupRow(hitInfo.RowHandle))
            {
                Model.process prcoess = bindingSource1.Current as Model.process;
                if (prcoess != null)
                {
                    ProcessEdit processedit = new ProcessEdit(prcoess.processId, "update");
                    if (processedit.ShowDialog(this) == DialogResult.OK)
                    {
                        loadprocess();
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
        /// <summary>
        /// Create a process action view model.
        /// </summary>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <param name="action">
        /// The action.
        /// </param>
        /// <returns>
        /// The <see cref="IProcessActionViewModel"/>.
        /// </returns>
        public IProcessActionViewModel CreateViewModel(ProcessEdit process, ProcessActionEdit action)
        {
            var viewModel = new ProcessActionViewModel(PropertyPathViewModelFactory);
            viewModel.Refresh(process, action);

            return viewModel;
        }
        /// <summary>
        /// Initializes the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="process">The process.</param>
        public void Initialize(ApprovalLevelDefinitionEdit model, ProcessEdit process)
        {
            Model = model;

            ApprovalMembersPropertyPath.Initialize(model.ApprovalMembersPropertyPath, process);
            OverrideMembersPropertyPath.Initialize(model.OverrideMembersPropertyPath, process);
        }
        /// <summary>
        /// Creates a property path view-model.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <returns>
        /// The <see cref="IPropertyPathViewModel"/>.
        /// </returns>
        public IPropertyPathViewModel CreateViewModel(PropertyPathEdit model, ProcessEdit process)
        {
            var viewModel = MefFactory.CreateExport().Value;
            viewModel.Initialize(model, process);

            return viewModel;
        }
Пример #5
0
        public static void Main(string[] args)
        {
            try {
                WriteInfo("initialize Shaiya Loader..");

                using (ProcessEdit shaiya = new ProcessEdit()) {
                    if (File.Exists("game.exe") == false)
                    {
                        WriteError("Game.exe not found in this location?");
                        Console.ReadKey();
                        return;
                    }

                    int     tryCount = 0;
                    Process p        = Process.Start("game.exe");
                    System.Threading.Thread.Sleep(50);
                    while (shaiya.OpenProcessAndThread(p.Id) == false && tryCount < 1000)
                    {
                        ;
                    }
                    if (shaiya.IsThreadOpen == false || shaiya.IsProcessOpen == false)
                    {
                        WriteError("failed to attach Shaiya Process.. oO");
                        p.Kill();
                        Console.ReadKey();
                        return;
                    }

                    Console.Clear();
                    WriteStatus("Shaiya Loader initialized.");


                    WriteInfo("start reading Debug Values...");
                    byte[] testBuf1 = shaiya.ReadBytes(0x0040AB0F, 2);
                    byte[] testBuf2 = shaiya.ReadBytes(0x0040AB33, 2);
                    byte[] testBuf3 = shaiya.ReadBytes(0x0040AB7A, 6);
                    byte[] testBuf4 = shaiya.ReadBytes(0x0040AE6D, 6);

                    WriteDebug("buf1: " + HexHelper.Encode(testBuf1));
                    WriteDebug("buf2: " + HexHelper.Encode(testBuf2));
                    WriteDebug("buf3: " + HexHelper.Encode(testBuf3));
                    WriteDebug("buf4: " + HexHelper.Encode(testBuf4));

                    WriteInfo("start writing Climb Patch Values...");
                    shaiya.WriteBytes(0x004416BA, new byte[6] {
                        0, 0, 0, 0, 0, 0
                    });


                    WriteStatus("All Operations finished - Press any Key to exit");
                    Console.ReadKey();
                }
            } catch (Exception e) {
                WriteError("Exception thrown!\n\n");
                Console.WriteLine(e);
                Console.ReadKey();
            }
        }
Пример #6
0
        public static void Main(string[] args)
        {
            using (ProcessEdit shaiya = new ProcessEdit()) {
                do
                {
                    Console.WriteLine("Please start Shaiya..");
                    System.Threading.Thread.Sleep(1000);
                } while(shaiya.OpenProcessAndThread("game") == false);

                Console.Clear();

                Console.WriteLine("Shaiya successful attached!");
                Console.WriteLine("\nPlease enter your desired Charname (the full length!)");
                Console.Write("Charname: ");
                string charname = Console.ReadLine();
                if (charname.Length <= 13)
                {
                    Console.WriteLine("\n\nCharname only contains " + charname.Length + " (max is 13) and is already valid!");
                }
                else
                {
                    string validCharname = charname.Substring(0, 13);
                    string patternMask   = new string( 'x', 13 );                   // all chars must match!
                    byte[] baCharname    = System.Text.ASCIIEncoding.Default.GetBytes(validCharname);
                    uint   patLoc        = shaiya.FindPattern(baCharname, patternMask);
                    if (patLoc != 0)
                    {
                        string patData = "";
                        if (patLoc > 0)
                        {
                            patData = shaiya.ReadASCIIString(patLoc, 13);
                        }

#if DEBUG
                        Console.WriteLine("[Debug] Pattern Location: 0x{0:X08}", patLoc);
                        Console.WriteLine("[Debug] Pattern Data (13 chars): {0}", patData);
#endif

                        Console.Write("\ntry to update Memory with real name..");
                        if (shaiya.WriteASCIIString(patLoc, charname) == true)
                        {
                            Console.WriteLine(" success!");
                        }
                        else
                        {
                            Console.WriteLine(" failed..");
                        }
                    }
                    else
                    {
                        Console.WriteLine("FAILED to find Namestring?");
                    }
                }

                Console.WriteLine("\n\nPress any Key to exit");
                Console.ReadKey();
            }
        }
 /// <summary>
 /// Opens an expression editor for the specified stored procedure parameter expression.
 /// </summary>
 /// <param name="parentWindow">The parent window.</param>
 /// <param name="process">The process.</param>
 /// <param name="parameter">The parameter.</param>
 public void EditExpression(ITopLevelWindow parentWindow, ProcessEdit process, DataTriggerStoredProcedureParameterEdit parameter)
 {
     EditExpression(
         parentWindow,
         process,
         DbTypeConverter.ConvertToType(parameter.DataType),
         parameter.Expression,
         () => SetExpression(parameter, GetXml()),
         null,
         () => SetExpression(parameter, null));
 }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessPublishEvent"/> class.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="publishTask">The publish task.</param>
        /// <exception cref="System.ArgumentNullException">
        /// process
        /// or
        /// publishTask
        /// </exception>
        /// <exception cref="ArgumentNullException">The <paramref name="process" /> parameter is null.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="publishTask" /> parameter is null.</exception>
        public ProcessPublishEvent(ProcessEdit process, Task publishTask)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            if (publishTask == null)
                throw new ArgumentNullException("publishTask");

            Process = process;
            PublishTask = publishTask;
        }
Пример #9
0
        /// <summary>
        ///  add process of the workflow event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(wf.WorkflowId))
            {
                ProcessEdit from = new ProcessEdit(wf.WorkflowId);

                if (from.ShowDialog() == DialogResult.OK)
                {
                    loadprocess();
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessSectionViewModel"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ProcessSectionViewModel(ISectionEdit section)
        {
            this._sectionEdit = section;
            FieldList = new ObservableCollection<ProcessFieldViewModel>();
            Fields = new ObservableCollection<ExpandableStepPropBag>();

            _showPaperclips = true;

            _process = section.GetParent<ProcessEdit>();
            this._simpleProcess = _process != null && _process.SimpleProcess;
            IsSystem = _process != null && _process.IsSystem;
        }
Пример #11
0
		public static void Main( string[] args ) {
			try {
				WriteInfo( "initialize Shaiya Loader.." );

				using( ProcessEdit shaiya = new ProcessEdit() ) {
					if( File.Exists( "game.exe" ) == false ) {
						WriteError( "Game.exe not found in this location?" );
						Console.ReadKey();
						return;
					}

					int tryCount = 0;
					Process p = Process.Start( "game.exe" );
					System.Threading.Thread.Sleep( 50 );
					while( shaiya.OpenProcessAndThread( p.Id ) == false && tryCount < 1000 )
						;
					if( shaiya.IsThreadOpen == false || shaiya.IsProcessOpen == false ) {
						WriteError( "failed to attach Shaiya Process.. oO" );
						p.Kill();
						Console.ReadKey();
						return;
					}

					Console.Clear();
					WriteStatus( "Shaiya Loader initialized." );


					WriteInfo( "start reading Debug Values..." );
					byte[] testBuf1 = shaiya.ReadBytes( 0x0040AB0F, 2 );
					byte[] testBuf2 = shaiya.ReadBytes( 0x0040AB33, 2 );
					byte[] testBuf3 = shaiya.ReadBytes( 0x0040AB7A, 6 );
					byte[] testBuf4 = shaiya.ReadBytes( 0x0040AE6D, 6 );

					WriteDebug( "buf1: " + HexHelper.Encode( testBuf1 ) );
					WriteDebug( "buf2: " + HexHelper.Encode( testBuf2 ) );
					WriteDebug( "buf3: " + HexHelper.Encode( testBuf3 ) );
					WriteDebug( "buf4: " + HexHelper.Encode( testBuf4 ) );

					WriteInfo( "start writing Climb Patch Values..." );
					shaiya.WriteBytes( 0x004416BA, new byte[ 6 ] { 0, 0, 0, 0, 0, 0 } );


					WriteStatus( "All Operations finished - Press any Key to exit" );
					Console.ReadKey();
				}
			} catch( Exception e ) {
				WriteError( "Exception thrown!\n\n" );
				Console.WriteLine( e );
				Console.ReadKey();
			}
		}
Пример #12
0
        /// <summary>
        /// Initializes the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="processEdit">The process edit.</param>
        /// <param name="fieldEdit">The field edit.</param>
        public void Init(ChecklistSettingsStepEdit model, ProcessEdit processEdit, FieldEdit fieldEdit)
        {
            StepModel = model;
            ProcessEdit = processEdit;
            FieldEdit = fieldEdit;

            FilterGuid = model.FilterGuid ?? Guid.Empty;
            FilterDefinition = model.FilterDefinition;

            var weakListener = new WeakEventListener<ChecklistFilterViewModel, ChecklistSettingsStepEdit, PropertyChangedEventArgs>(this, model);

            model.PropertyChanged += weakListener.OnEvent;
            weakListener.OnEventAction += OnReqStepPropertyChanged;
            weakListener.OnDetachAction += Static;

            LoadProcessInfo(model);
        }
Пример #13
0
		public static void Main( string[] args ) {
			using( ProcessEdit shaiya = new ProcessEdit() ) {
				do {
					Console.WriteLine( "Please start Shaiya.." );
					System.Threading.Thread.Sleep( 1000 );
				} while( shaiya.OpenProcessAndThread( "game" ) == false );

				Console.Clear();

				Console.WriteLine( "Shaiya successful attached!" );
				Console.WriteLine( "\nPlease enter your desired Charname (the full length!)" );
				Console.Write( "Charname: " );
				string charname = Console.ReadLine();
				if( charname.Length <= 13 ) {
					Console.WriteLine( "\n\nCharname only contains " + charname.Length + " (max is 13) and is already valid!" );
				} else {
					string validCharname = charname.Substring( 0, 13 );
					string patternMask = new string( 'x', 13 ); // all chars must match!
					byte[] baCharname = System.Text.ASCIIEncoding.Default.GetBytes( validCharname );
					uint patLoc = shaiya.FindPattern( baCharname, patternMask );
					if( patLoc != 0 ) {
						string patData = "";
						if( patLoc > 0 )
							patData = shaiya.ReadASCIIString( patLoc, 13 );

#if DEBUG
						Console.WriteLine( "[Debug] Pattern Location: 0x{0:X08}", patLoc );
						Console.WriteLine( "[Debug] Pattern Data (13 chars): {0}", patData );
#endif

						Console.Write( "\ntry to update Memory with real name.." );
						if( shaiya.WriteASCIIString( patLoc, charname ) == true )
							Console.WriteLine( " success!" );
						else
							Console.WriteLine( " failed.." );
					} else {
						Console.WriteLine( "FAILED to find Namestring?" );
					}
				}

				Console.WriteLine( "\n\nPress any Key to exit" );
				Console.ReadKey();
			}

		}
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionViewModel"/> class.
        /// </summary>
        /// <param name="selectedSection">The selected section.</param>
        /// <param name="parentModel">The parent model.</param>
        /// <param name="screenSecurity">The screen security.</param>
        public SectionViewModel(SectionEdit selectedSection, ProcessEdit parentModel, IFieldSecurityManager screenSecurity)
        {
            ProcessScreenSecuritySettings = screenSecurity;
            Fields = new ObservableCollection<ExpandableStepPropBag>();
            if (FieldList == null) 
                FieldList = new ObservableCollection<FieldEdit>();
            FieldList.Clear();

            _selectedSection = selectedSection;
            Id = selectedSection.Id;
            Name = selectedSection.Name;
            if (_selectedSection.FieldList != null)
            {
                foreach (var f in selectedSection.FieldList)
                {
                    AddField(selectedSection.Id, parentModel, f);
                }
            }
        }
Пример #15
0
        public static void Inject()
        {
            int         procId = ProcessHelper.GetProcessFromProcessName("game");
            ProcessEdit proc   = new ProcessEdit(procId);

            if (proc.IsProcessOpen == false)
            {
                Console.WriteLine("failed to open Shaiya Process");
                Console.Read();
                return;
            }

            byte[] pat1           = new byte[] { 0x8B, 0xCB, 0x8B, 0xD1, 0xC1, 0xE9, 0x02, 0x8D, 0x43, 0x02, 0x66, 0x89, 0x44, 0x24, 0x20 };
            byte[] pat2           = new byte[] { 0xB8, 0x8C, 0x60, 0x00, 0x00, 0xE8 };
            byte[] pat3           = new byte[] { 0x8B, 0x54, 0x24, 0x04, 0x0F, 0xB7, 0xC2, 0x3D };
            uint   Address        = proc.FindPattern(pat1, "xxxxxxxxxxxxxxx") - 0x38;
            uint   ReturnAddress  = Address + 6;
            uint   Address2       = proc.FindPattern(pat2, "xxxxxx");
            uint   ReturnAddress2 = Address2 + 5;
            uint   Address3       = proc.FindPattern(pat3, "xxxxxxxx");

            Console.WriteLine("Address: " + Address + " / " + Address.ToString("X8"));
            Console.WriteLine("ReturnAddress: " + ReturnAddress + " / " + ReturnAddress.ToString("X8"));
            Console.WriteLine("Address2: " + Address2 + " / " + Address2.ToString("X8"));
            Console.WriteLine("ReturnAddress2: " + ReturnAddress2 + " / " + ReturnAddress2.ToString("X8"));
            Console.WriteLine("Address3: " + Address3 + " / " + Address3.ToString("X8"));

            proc.Dispose();

            mInject = new ProcessInject(Address, procId);
            //mInject.WriteBytes( Address2, new byte[] { 0xE9 } ); // *(BYTE *)(Address2) = 0xE9;

            IntPtr endSceneAddr = mInject.GetObjectVtableFunction(mInject.Read <IntPtr>(Address), 0);

            mInject.Detours.CreateAndApply(mInject.RegisterDelegate <EndSceneDelegate>(endSceneAddr), EndSceneHandler, "EndScene");


            Console.WriteLine("alle done, moep o.o");
            Console.ReadKey();
        }
        /// <summary>
        /// Opens the data trigger field mapping designer window.
        /// </summary>
        /// <param name="parentWindow">The parent window.</param>
        /// <param name="process">The process.</param>
        /// <param name="trigger">The trigger.</param>
        /// <param name="saveAction">The save action.</param>
        /// <param name="cancelAction">The cancel action.</param>
        /// <param name="removeAction">The remove action.</param>
        public void EditExpression(ITopLevelWindow parentWindow, ProcessExternalDataEdit model, ProcessEdit process, ExternalDataConfigurationEdit externalData, Action saveAction, Action cancelAction, Action removeAction)
        {
            SaveAction = saveAction;
            CancelAction = cancelAction;
            RemoveAction = removeAction;

            ProcessEdit = process;

            ExpressionDesigner.LoadFromExpressionObjects(new List<IExpressionObjectBase>());

            if (externalData == null)
            {

                PopupFactory.NotifyFailure("Please select a Connection and try again.");
                CancelCommand.Execute(null);
                return;
            }

            LoadExpressionItems(process, externalData, model);

            _itemHashes = ExpressionDesigner.Diagram.Items.Select(x => x.GetHashCode()).ToList();
            WindowManager.Value.ShowChildWindow(parentWindow, this);
        }
Пример #17
0
		public static void Inject() {
			int procId = ProcessHelper.GetProcessFromProcessName( "game" );
			ProcessEdit proc = new ProcessEdit( procId );
			if( proc.IsProcessOpen == false ) {
				Console.WriteLine( "failed to open Shaiya Process" );
				Console.Read();
				return;
			}

			byte[] pat1 = new byte[] { 0x8B, 0xCB, 0x8B, 0xD1, 0xC1, 0xE9, 0x02, 0x8D, 0x43, 0x02, 0x66, 0x89, 0x44, 0x24, 0x20 };
			byte[] pat2 = new byte[] { 0xB8, 0x8C, 0x60, 0x00, 0x00, 0xE8 };
			byte[] pat3 = new byte[] { 0x8B, 0x54, 0x24, 0x04, 0x0F, 0xB7, 0xC2, 0x3D };
			uint Address = proc.FindPattern( pat1, "xxxxxxxxxxxxxxx" ) - 0x38;
			uint ReturnAddress = Address + 6;
			uint Address2 = proc.FindPattern( pat2, "xxxxxx" );
			uint ReturnAddress2 = Address2 + 5;
			uint Address3 = proc.FindPattern( pat3, "xxxxxxxx" );

			Console.WriteLine( "Address: " + Address + " / " + Address.ToString( "X8" ) );
			Console.WriteLine( "ReturnAddress: " + ReturnAddress + " / " + ReturnAddress.ToString( "X8" ) );
			Console.WriteLine( "Address2: " + Address2 + " / " + Address2.ToString( "X8" ) );
			Console.WriteLine( "ReturnAddress2: " + ReturnAddress2 + " / " + ReturnAddress2.ToString( "X8" ) );
			Console.WriteLine( "Address3: " + Address3 + " / " + Address3.ToString( "X8" ) );

			proc.Dispose();

			mInject = new ProcessInject( Address, procId );
			//mInject.WriteBytes( Address2, new byte[] { 0xE9 } ); // *(BYTE *)(Address2) = 0xE9;

			IntPtr endSceneAddr = mInject.GetObjectVtableFunction( mInject.Read<IntPtr>( Address ), 0 );
			mInject.Detours.CreateAndApply( mInject.RegisterDelegate<EndSceneDelegate>( endSceneAddr ), EndSceneHandler, "EndScene" );


			Console.WriteLine( "alle done, moep o.o" );
			Console.ReadKey();
		}
Пример #18
0
        //打开或新建工艺时初始化
        private void OpenOrCreateProjectInit()
        {
            //变量值
            IsProjectOpen = true;

            //控件状态
            pnlWelcome.Hide();
            pnlMain.Show();

            this.Text = ProPath + "\\" + ProName + ".3dppm";
            //更新会签
            if (NXFun.isFileExist(ToFullPath(NXFun.SignOffXML)))
            {
                bool result = XML3DPPM.UpdateSignOff(XmlFile, ToFullPath(NXFun.SignOffXML));
                if (result)
                {
                    NXFun.MessageBox("更新会签信息成功,请在\"编辑图纸->二维图表\"模块点击\"更新表头\"来刷新会签信息。");
                }
                else
                {
                    NXFun.MessageBox("更新会签信息失败,请确认会签文件是否有效!");
                }
            }
            //操作
            ProcessEdit.ProPath = ProPath;
            ProcessEdit.ProName = ProName;
            ProcessEdit.Init();

            ModelEdit.ProPath = ProPath;
            ModelEdit.ProName = ProName;
            ModelEdit.Init();

            SheetEdit.ProPath = ProPath;
            SheetEdit.ProName = ProName;
            SheetEdit.Init();
        }
Пример #19
0
        public void Initialize(ESyncProcessEdit process, ProcessEdit parentModel, ITopLevelWindow parentWindow)
        {
            if (process == null) throw new ArgumentNullException("process");

            Model = process;
            ParentModel = parentModel;
            ParentWindow = parentWindow;
            
            EndpointsViewModel.Initialize(process.Endpoints, parentWindow);
            SchedulerViewModel.Initialize(process.Scheduler);

            JobStatus = ESyncJobStatus.Unknown;
        }
Пример #20
0
        /// <summary>
        /// Initializes the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="process">The process.</param>
        public void Initialize(PropertyPathEdit model, ProcessEdit process)
        {
            Model = model;
            Process = process;
            _fieldName = Model.FieldName;

            var sortedFields = Model.Subfields.OrderBy(f => f.Index).ToArray();

            foreach (var field in sortedFields)
            {
                var vm = FieldViewModelFactory.CreateExport().Value;
                vm.Initialize(field, this);
                Subfields.Add(vm);
            }

            for (var i = 0; i < Subfields.Count - 1; ++i)
            {
                Subfields[i].Subfield = Subfields[i + 1];
            }

            _hasSubfield = Subfields.Count > 0;

            UpdateAvailableFields();
        }
Пример #21
0
        /// <summary>The setup tree view options.</summary>
        /// <param name="vm">The SimpleFilterViewModel.</param>
        /// <param name="model">The model.</param>
        public void SetupTreeViewOptions(SimpleFilterViewModel vm, ProcessEdit model)
        {
            if (model == null || vm == null || vm.SelectedMember == null)
            {
                return;
            }

            var propertyDefinition = (FieldPathPropertyDefinition)vm.SelectedMember.ItemPropertyDefinition;
            var columnType = propertyDefinition.ColumnType;

            if (columnType != ColumnTypes.TreeView || string.IsNullOrEmpty(propertyDefinition.ReferencedProcessSystemName))
            {
                return;
            }

            IsPublished = false;
            IsRefCrossRef = true;
            CrossRefDisplayFieldsList = propertyDefinition.ReferencedFieldSystemName;
            CrossRefFieldName = propertyDefinition.SystemName;
            RefCrossRefFieldName = propertyDefinition.LinkFieldSystemName;
            CrossRefAllowMultiple = propertyDefinition.AllowMultiple;
            CrossRefProcessName = propertyDefinition.ReferencedProcessSystemName;
        }
        /// <summary>
        /// Edits the expression.
        /// </summary>
        /// <param name="parentWindow">The parent window.</param>
        /// <param name="process">The process.</param>
        /// <param name="expressionDesignerString">The expression designer string.</param>
        /// <param name="parameterType">Type of the parameter.</param>
        /// <param name="saveAction">The save action.</param>
        /// <param name="cancelAction">The cancel action.</param>
        /// <param name="removeAction">The remove action.</param>
        public void EditExpression(ITopLevelWindow parentWindow, ProcessEdit process, string expressionDesignerString, SystemParameterType parameterType, Action saveAction, Action cancelAction, Action removeAction)
        {
            this.saveAction = saveAction;
            this.cancelAction = cancelAction;
            this.removeAction = removeAction;
            
            var source = new SourceFieldList {ExpressionName = process.Name, Top = 10, Left = 10};

            AddIdFields(process, source);
            AddProcessIdFields(process, source);
            AddStateFields(process, source);
            AddVersionFields(process, source);
            AddLastModifiedOnField(process, source);


            foreach (var field in process.GetAllFields())
            {
                if (field.FieldType.ColumnType == ColumnTypes.Reference)
                {
                    var crossRefStep = (CrossRefRequiredStepEdit)field.StepList.FirstOrDefault(x => x is CrossRefRequiredStepEdit);
                    if (crossRefStep != null)
                    {
                        if (crossRefStep.AllowMultiple)
                        {
                            source.Fields.Add(BuildSourceFieldForList(source, field, new CrSubfieldsRetriever(field.Id)));
                        }
                        else
                        {
                            source.Fields.Add(new SourceField(source)
                            {
                                DataType = NodeDataType.CrossReference,
                                Name = field.Name,
                                ConnectorOut =
                                    {
                                        DataType = NodeDataType.CrossReference,
                                        Name = field.Name
                                    },
                                SetName = SourceFieldSetNames.Item,
                                InnerName = field.SystemName,
                                SystemName = string.Format("{0}Member", field.SystemName),
                                SubfieldsRetriever = new CrSubfieldsRetriever(field.Id)
                            });
                        }
                    }
                }
                else
                {
                    if (field.FieldType.ColumnType == ColumnTypes.ReverseReference || field.FieldType.ColumnType == ColumnTypes.ReverseMultiReference)
                    {
                        var crossRefStep = (ReverseCrossRefRequiredStepEdit)field.StepList.FirstOrDefault(x => x is ReverseCrossRefRequiredStepEdit);
                        if (crossRefStep != null)
                        {
                            if (crossRefStep.DisplayMultiple)
                            {
                                source.Fields.Add(BuildSourceFieldForList(source, field, new ReverseCrSubfieldsRetriever(field.Id)));
                            }
                            else
                            {
                                source.Fields.Add(new SourceField(source)
                                {
                                    DataType = NodeDataType.ReverseCrossReference,
                                    Name = field.Name,
                                    ConnectorOut =
                                    {
                                        DataType = NodeDataType.ReverseCrossReference,
                                        Name = field.Name
                                    },
                                    SetName = SourceFieldSetNames.Item,
                                    InnerName = field.SystemName,
                                    SystemName = string.Format("{0}Member", field.SystemName),
                                    SubfieldsRetriever = new ReverseCrSubfieldsRetriever(field.Id)
                                });
                            }
                        }
                    }
                    else if (field.FieldType.ColumnType == ColumnTypes.Checklist)
                    {
                        source.Fields.Add(BuildSourceFieldForList(source, field, new ChecklistSubFieldsRetriever(field.Id)));
                    }
                    else if (field.FieldType.ColumnType == ColumnTypes.DisplayList)
                    {
                        source.Fields.Add(BuildSourceFieldForList(source, field, new DisplayListSubFieldsRetriever(field.Id)));
                    }
                    else if (field.FieldType.ColumnType == ColumnTypes.Result)
                    {
                        source.Fields.Add(new SourceField(source)
                        {
                            DataType = NodeDataType.Result,
                            Name = field.Name,
                            ConnectorOut =
                            {
                                DataType = NodeDataType.Result,
                                Name = field.Name
                            },
                            SetName = SourceFieldSetNames.Item,
                            InnerName = field.SystemName,
                            SystemName = field.SystemName
                        });
                    }
                    else
                    {
                        //var fieldType = GetType(field.FieldType);
                        var dataType = SourceNodeFactory.GetDataType(GetType(field.FieldType));
                        var sf = new SourceField(source)
                                     {
                                         DataType = dataType,
                                         Name = field.Name,
                                         ConnectorOut = { DataType = dataType, Name = field.Name },
                                         SetName = SourceFieldSetNames.Item,
                                         InnerName = field.SystemName,
                                         SystemName = field.SystemName
                                     };
                        source.Fields.Add(sf);
                    }
                }
            }

            var expressions = new List<IExpressionObjectBase>();

            var isNew = true;

            ExpressionContainer expressionsContainer;
            try
            {
                expressionsContainer = Serializer.Deserialize(expressionDesignerString);
            }
            catch
            {
                expressionsContainer = null;
            }

            if (!string.IsNullOrWhiteSpace(expressionDesignerString) && expressionsContainer != null)
            {
                isNew = false;
                expressions.AddRange(expressionsContainer.Expressions);
            }
            else
            {
                expressions.Add(source);
                var destination = new DestinationFieldList
                                      {
                                          Top = 200,
                                          Left = 600,
                                          ExpressionName = "Expression Result"
                                      };
                destination.Fields.Add(new DestinationField(destination)
                                           {
                                               Name = "Result",
                                               SystemName = "Result",
                                               InnerName = "Result",
                                               DataType = GetNodeType(parameterType),
                                               ConnectorIn = { Name = "Result", DataType = GetNodeType(parameterType) }
                                           });
                expressions.Add(destination);
            }

            if (expressionsContainer != null)
            {
                var sourceFieldList =
                   (from fl in expressions
                    where fl is SourceFieldList
                    select fl).Cast<SourceFieldList>().FirstOrDefault();

                if (sourceFieldList != null)
                {
                    var fieldList = sourceFieldList.Fields.Cast<IExpressionField>().ToList();
                    UpdateStoredFields(fieldList, source.Fields, (sf) => FinalizeUpdate(sourceFieldList, fieldList, source, expressions, parentWindow)); // Here we load all subtypes async that's why we need reload window after all subtypes are loaded
                }
            }

            if (!isNew)
            {
                return;
            }

            var userInfoSource = SourceNodeFactory.CreateUserInformationItem(CurrentUserInformationItemName);
            userInfoSource.Left = 175;
            userInfoSource.Top = 10;

            expressions.Add(userInfoSource);

            this.expressionDesigner.Diagram.Items.Clear();
            ExpressionTranslator.TranslateToDiagram(expressions, this.expressionDesigner.Diagram);

            WindowManager.Value.ShowChildWindow(parentWindow, this);
        }
        /// <summary>
        /// Adds the process identifier fields.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="source">The source.</param>
        private static void AddProcessIdFields(ProcessEdit process, SourceFieldList source)
        {
            const string IdName = "ProcessId";

            var dataType = SourceNodeFactory.GetDataType(typeof(int));
            var sf = new SourceField(source)
            {
                DataType = dataType,
                Name = IdName,
                ConnectorOut = { DataType = dataType, Name = IdName },
                SetName = SourceFieldSetNames.Item,
                InnerName = Constants.ProcessIdColumnName,
                SystemName = Constants.ProcessIdColumnName,
                ObjectName = "context"
            };
            source.Fields.Add(sf);
        }
        /// <summary>
        /// Edits the expression.
        /// </summary>
        /// <param name="parentWindow">The parent window.</param>
        /// <param name="process">The process.</param>
        /// <param name="syncProcess">The synchronize process.</param>
        /// <param name="saveAction">The save action.</param>
        /// <param name="cancelAction">The cancel action.</param>
        /// <param name="removeAction">The remove action.</param>
        public void EditExpression(
            ITopLevelWindow parentWindow,
            ProcessEdit process,
            ESyncProcessEdit syncProcess,
            Action saveAction,
            Action cancelAction,
            Action removeAction)
        {
            _saveAction = saveAction;
            _cancelAction = cancelAction;
            _removeAction = removeAction;

            _expressionDesigner.LoadFromExpressionObjects(new List<IExpressionObjectBase>());

            LoadExpressionItems(process, syncProcess);
            WindowManager.Value.ShowChildWindow(parentWindow, this);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="VersionMasterSubfieldsRetriever"/> class.
 /// </summary>
 /// <param name="process">The process.</param>
 public VersionMasterSubfieldsRetriever(ProcessEdit process)
 {
     _process = process;
 }
Пример #26
0
 /// <summary>
 /// Actions the specified obj.
 /// </summary>
 /// <param name="obj">The obj.</param>
 private void action(ProcessEdit obj)
 {
     obj.Name = "asdf";
 }
 public ProcessEditRetrieverMock(ProcessEdit process, FieldTypes fieldTypes)
 {
     this.LoadProperty(ProcessEditProperty, process);
     this.LoadProperty(FieldTypesProperty, fieldTypes);
 }
 /// <summary>
 /// Creates a question field using a field from root process.
 /// </summary>
 /// <param name="field">
 /// The field.
 /// </param>
 /// <param name="process">
 /// The process.
 /// </param>
 /// <returns>
 /// The <see cref="IChecklistQuestionField"/>.
 /// </returns>
 public IChecklistQuestionField CreateRootProcessField(FieldEdit field, ProcessEdit process)
 {
     return new ChecklistQuestionField(field, process, ChecklistQuestionFieldSource.RootProcess);
 }
Пример #29
0
        public void OnSaved(ESyncProcessEdit model, ProcessEdit parentModel)
        {
            Model = model;
            ParentModel = parentModel;

            if (Model != null)
            {
                EndpointsViewModel.OnSaved(Model.Endpoints);
                SchedulerViewModel.OnSaved(Model.Scheduler);
            }
            else
            {
                ThePopupFactory.NotifyFailure("Model is null after saving sync process");
                Logger.Log(LogSeverity.Error, GetType().ToString(), "Model is null after saving sync process");
            }
        }
        /// <summary>
        /// Loads the expression items.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="syncProcess">The synchronize process.</param>
        private void LoadExpressionItems(ProcessEdit process, ESyncProcessEdit syncProcess)
        {
            WindowManager.Value.ShowStatus(new Status { IsBusy = true });

            var expressions = new List<IExpressionObjectBase>();
            var newExpressions = new List<IExpressionObjectBase>();

            var syncContext = new NotifyClientAction(
                () =>
                    {
                        _expressionDesigner.LoadFromExpressionObjects(expressions);
                        WindowManager.Value.ShowStatus(new Status());
                    });

            syncContext.OperationStarted();

            var source = new SourceFieldList { ExpressionName = "Source", Top = 10, Left = 10 };

            foreach (var providerField in syncProcess.Endpoints.Source.ProviderFields)
            {
                var sourceField = CreateSourceField(providerField, source);

                if (sourceField != null)
                    source.Fields.Add(sourceField);
            }

            newExpressions.Add(source);

            var destination = new DestinationFieldList { ExpressionName = process.Name, Top = 10, Left = 600 };

            AddIdFields(destination);
            AddStateFields(process, destination);
            AddVersionFields(process, destination);

            foreach (var field in process.GetAllFields().Where(CanBeDestinationField))
            {
                var destinationField = CreateDestinationField(field, destination);

                if (destinationField != null)
                    destination.Fields.Add(destinationField);
            }

            newExpressions.Add(destination);

            if (!string.IsNullOrWhiteSpace(syncProcess.Map.Designer))
            {
                try
                {
                    var expressionsContainer = ExpressionsSerializer.Deserialize(syncProcess.Map.Designer);
                    ExpressionNodeFactory.RestoreConnections(expressionsContainer.Expressions);
                    expressions.AddRange(expressionsContainer.Expressions);
                }
                catch
                {
                    // Do nothing, new expressions will be used.
                }
            }

            UpdateStateList(process);

            UpdateStoredExpressions(expressions, newExpressions, syncContext);

            syncContext.OperationCompleted();
        }
Пример #31
0
        /// <summary>
        /// The refresh.
        /// </summary>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <param name="action">
        /// The action.
        /// </param>
        public void Refresh(ProcessEdit process, ProcessActionEdit action)
        {
            Model = action;
            ParentProcess = process;
            _actionType = Model.ActionType;
            RaisePropertyChanged(() => ActionType);

            UpdateAssignmentProperties();
        }
        /// <summary>
        /// Adds the state fields.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="destination">The destination.</param>
        private static void AddStateFields(ProcessEdit process, DestinationFieldList destination)
        {
            if (!process.IsStateEnabled)
                return;

            var dataType = DestinationNodeFactory.GetDataType(typeof(string));
            var df = new DestinationField(destination)
            {
                Name = "Current State",
                SystemName = Constants.CurrentStateColumnName,
                DataType = dataType,
                SetName = SourceFieldSetNames.Item,
                ConnectorIn = { DataType = dataType, Name = "Current State", IsNullable = false },
                IsKeyVisible = true,
                IsKeyEnabled = false
            };

            destination.Fields.Add(df);
        }
        private static void AddLastModifiedOnField(ProcessEdit process, SourceFieldList source)
        {
            const string LastModifiedOnDisplyField = "Last Modified On";

            var dataType = SourceNodeFactory.GetDataType(typeof(DateTime));

            var sf = new SourceField(source)
            {
                DataType = dataType,
                Name = LastModifiedOnDisplyField,
                ConnectorOut = { DataType = dataType, Name = LastModifiedOnDisplyField },
                SetName = SourceFieldSetNames.Item,
                InnerName = Constants.LastModifiedOn,
                SystemName = Constants.LastModifiedOn
            };

            source.Fields.Add(sf);
        }
        /// <summary>
        /// Adds the version fields.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="destination">The destination.</param>
        private static void AddVersionFields(ProcessEdit process, DestinationFieldList destination)
        {
            if (process.ProcessOptionChoose != ProcessOption.VersionEnabled)
                return;

            var dataType = DestinationNodeFactory.GetDataType(typeof(string));
            var df = new DestinationField(destination)
            {
                Name = "Version",
                SystemName = Constants.Version,
                DataType = dataType,
                SetName = SourceFieldSetNames.Item,
                ConnectorIn = { DataType = dataType, Name = Constants.Version, IsNullable = false },
                SubfieldsRetriever = new VersionSubfieldsRetriever(process),
                IsKeyVisible = true,
                IsKeyEnabled = false
            };

            destination.Fields.Add(df);
        }
        private async void LoadExpressionItems(ProcessEdit sourceProcess, ExternalDataConfigurationEdit externalDataConfiguration, ProcessExternalDataEdit model)
        {
            WindowManager.Value.ShowStatus(new Status { IsBusy = true });

            var expressions = new List<IExpressionObjectBase>();
            var newExpressions = new List<IExpressionObjectBase>();

            var syncContext = new NotifyClientAction(
                () =>
                {
                    ExpressionDesigner.LoadFromExpressionObjects(expressions);
                    WindowManager.Value.ShowStatus(new Status());
                });

            syncContext.OperationStarted();

            var source = new SourceFieldList
                {
                    ExpressionName = string.Format("{0} (source)", sourceProcess.Name),
                    UniqueName = SourceItemName,
                    Top = 10,
                    Left = 10
                };

            foreach (var field in sourceProcess.GetAllFields().Where(CanBeSourceField))
            {
                var sourceField = CreateSourceField(field, source);
                sourceField.ObjectName = SourceItemObjectName;
                source.Fields.Add(sourceField);
            }
            
            newExpressions.Add(source);

            var modifiedSource = new SourceFieldList
            {
                ExpressionName = string.Format("External Data: {0}", externalDataConfiguration.Name),
                UniqueName = SourceToModifyItemName,
                Top = 310,
                Left = 10
            };

            // add data variable
            foreach (var field in externalDataConfiguration.DataVariableList)
            {
                var sourceField = CreateSourceFieldFromDataVariable(field, modifiedSource);
                sourceField.ObjectName = ModifiedItemObjectName;
                modifiedSource.Fields.Add(sourceField);
            }

            newExpressions.Add(modifiedSource);
          
            SourceFieldList systemParameters;

            try
            {
                systemParameters = await CreateSystemParametersItemAsync(SystemParametersName);
            }
            catch (Exception)
            {
                systemParameters = null;
            }

            if (systemParameters != null)
            {
                systemParameters.Left = 350;
                systemParameters.Top = 10;
                newExpressions.Add(systemParameters);
            }

            var destination = new DestinationFieldList
            {
                ExpressionName = sourceProcess.Name,
                UniqueName = DestinationItemName,
                Top = 10,
                Left = 500
            };

            foreach (var field in sourceProcess.GetAllFields().Where(CanBeDestinationField))
            {
                var destinationField = CreateDestinationField(field, destination);
                destination.Fields.Add(destinationField);
            }

            newExpressions.Add(destination);


            if (!string.IsNullOrWhiteSpace(model.Expression))
            {
                try
                {
                    var expressionsContainer = Serializer.Deserialize(model.Expression);
                    expressions.AddRange(expressionsContainer.Expressions);
                }
                catch
                {
                    // Do nothing, new expressions will be used.
                }
            }

            UpdateStoredExpressions(expressions, newExpressions, syncContext);
            syncContext.OperationCompleted();
        }
Пример #36
0
        /// <summary>The setup cross ref options. Called from Process Builder.</summary>
        /// <param name="vm">The SimpleFilterViewModel.</param>
        /// <param name="model">The model.</param>
        public void SetupCrossRefOptions(SimpleFilterViewModel vm, ProcessEdit model)
        {
            if (vm == null || model == null || vm.SelectedMember == null)
            {
                return;
            }

            var propertyDefinition = (FieldPathPropertyDefinition)vm.SelectedMember.ItemPropertyDefinition;
            if (propertyDefinition.ColumnType != ColumnTypes.Reference && propertyDefinition.ColumnType != ColumnTypes.MultiReference)
            {
                return;
            }

            IsPublished = false;

            if (propertyDefinition.PropertyName == Constants.CurrentStateGuidColumnName)
            {
                var states = new CustomInfoList();
                states.AddRange(
                    model.StateList.OrderBy(s => s.Name).Select(state => new StateInfoClass { Id = state.Id, Name = state.Name, Guid = state.Guid }));

                FilteringProcessSystemName = null;
                CrossRefDisplayFieldsList = Constants.Name;
                CrossRefItems = states;
                CrossRefProcessName = Constants.StateProcessName;
                CrossRefAllowMultiple = false;

                return;
            }

            CrossRefFieldName = propertyDefinition.SystemName;
            CrossRefDisplayFieldsList = propertyDefinition.ReferencedFieldSystemName;
            CrossRefAllowMultiple = propertyDefinition.AllowMultiple;
            CrossRefProcessName = propertyDefinition.ReferencedProcessSystemName;
        }