public ComputationOfTwoColumnsCommand(Column column, Column column2, Del del)
 {
     this.column = column;
     this.column2 = column2;
     newRows = new List<Cell>();
     this.del = del;
 }
Пример #2
0
        //[/GLdescription]

        //[LockPositions]
        void LockPos(Del f)
        {
            CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsResourceSetMapFlags(_resources[0],
                (uint) CUDAInterop.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY));
            CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsResourceSetMapFlags(_resources[1],
                (uint) CUDAInterop.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD));
            CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsMapResourcesEx(2u, _resources, IntPtr.Zero));

            var bytes = IntPtr.Zero;
            var handle0 = IntPtr.Zero;
            var handle1 = IntPtr.Zero;
            unsafe
            {
                CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsResourceGetMappedPointer(&handle0, &bytes, 
                                                                                      _resources[0]));
                CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsResourceGetMappedPointer(&handle1, &bytes, 
                                                                                      _resources[1]));
            }
            var pos0 = new deviceptr<float4>(handle0);
            var pos1 = new deviceptr<float4>(handle1);
            try
            {
                f(pos0, pos1);
            }
            finally
            {
                CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsUnmapResourcesEx(2u, _resources, IntPtr.Zero));
            }
        }
Пример #3
0
        public void HttpGet(string url,HTTPMETHODS method, string content, Del del)
        {
            AsyncCall t = new AsyncCall(url, method ,content,del);
            Thread th = new Thread(new ThreadStart(t.runThread));

            th.Start();
        }
 public FilterCommand(Column column,Del del)
 {
     invalidRows = new List<int>();
     foreach (Cell cell in column.Cells)
     {
         if (!del.Invoke(cell.Content)) invalidRows.Add(column.Cells.IndexOf(cell));
     }
 }
Пример #5
0
 public StartScreen()
 {
     InitializeComponent();
     // Instantiate the delegate.
     handler = makeVisible;
     join = joining;
     start = starting;
     invisible = makeInvisible;
 }
Пример #6
0
 public override void AssignTask(Task Task)
 {
     //Create the instance for the condition
     object[] Constructors = new object[1];
     Constructors[1] = this.Args;
     this.ConditionInstance = Compiler.SourceToInstance(this.Source.CodeList().ToArray(), this.Source.ReferencedAssemblies.ToArray(), Conf.ConditionCriticals.Namespace, Conf.ConditionCriticals.Class, Constructors);
     this.IsConditionMet = (Del)Delegate.CreateDelegate(typeof(Del), this.ConditionInstance.GetType().GetMethod(Conf.ConditionCriticals.Methods.First()));
     base.AssignTask(Task);
 }
Пример #7
0
        public MainPage()
        {
            this.InitializeComponent();
            ShowLoggedButton = delegate ()
            {
                AppBarLogoutButton.Visibility = Visibility.Visible;

                AppBarConnectButton.Visibility = Visibility.Collapsed;
                AppBarRegisterButton.Visibility = Visibility.Collapsed;
            };
        }
        static void Main(string[] args)
        {
            Del handler = new Del(DelegateMethod);
            handler("Hello World");
            Program.DelegateMethod("Hello again...");

            X xObj = new X();
            xObj.HeyAlso();
            X.Hey();

            Console.ReadKey();
        }
Пример #9
0
        public void ExecuteTest2()
        {
            var exp = new Del(new Add(new Add(new Mul(new Number(2), new Variable("x1")), new Pow(new Variable("x2"), new Number(2))), new Pow(new Variable("x3"), new Number(3))));
            exp.Differentiator = new Differentiator();
            exp.Simplifier = new Simplifier();

            var expected = new Vector(new IExpression[] {
                                        new Number(2),
                                        new Mul(new Number(2), new Variable("x2")),
                                        new Mul(new Number(3), new Pow(new Variable("x3"), new Number(2)))
                                    });

            Assert.Equal(expected, exp.Execute());
        }
Пример #10
0
 public LobbyVM()
 {
     del = new Del(DealReceivePre);
     CanJoin = true;
     RoomInfoList = new ObservableCollection<RoomInfo>();
     UserInfo = App.userInfo;
     thReceive = new Thread(ReceiveSocket);
     thReceive.IsBackground = true;
     thReceive.Start(App.clientNetControl.SocketClient);
     //首先请求更新信息
     App.clientNetControl.Send("1|2|0|");
     BtnJoin = new RelayCommand(new Action(Join));
     BtnCreate = new RelayCommand(new Action(Create));
     BtnTest = new RelayCommand(new Action(Test));
 }
Пример #11
0
        Thread ThreadListen; //поток для прослушки

        #endregion Fields

        #region Constructors

        //==============конструкторы==============
        /// <summary>
        /// Конструктор прослушивателя
        /// </summary>
        /// <param name="newport">Порт прослушки (не помню точно :) )</param>
        /// <param name="d1">Делегат на вызов запроса подтверждения приходящего вызова</param>
        /// <param name="name">Наше имя</param>
        /// <param name="d2">Делегат на закрытие сессии</param>
        public Listener(int newport, DelRequest d1, string name, DelCloseSession d2, Del OUT, DelStopListener DelSL)
        {
            DelRequest1 = d1;
            DelClosesession = d2;
            DelOutput = OUT;
            DelClosesession += CloseSession;
            Delstoplistener = DelSL;
            StopFlag = false;

            myName = name;

            myIP = System.Net.Dns.GetHostByName(host).AddressList[0];
            port = newport;
            ThreadListen = new Thread(ListenSockets);
            ThreadListen.Start();
        }
Пример #12
0
        static void Main(string[] args)
        {
            Del del = new Del(M1);
            del += MM;

            // del += M2;

            DelInt delint = new DelInt(M2);
            Console.WriteLine(delint(40));
            del();
            Console.WriteLine("del-M1");
            del -= M1;
            del();

            Console.Read();
        }
        public void LoadFromFile(Del Callback)
        {
            if (System.IO.File.Exists(filepath))
            {
                List<SerializerItem> returFeed;

                var xml = new System.Xml.Serialization.XmlSerializer(typeof(List<SerializerItem>));
                using (var s = System.IO.File.Open(filepath, System.IO.FileMode.Open))
                {
                    returFeed = xml.Deserialize(s) as List<SerializerItem>;
                    s.Flush();
                    s.Close();
                }

                returFeed.ForEach(x => Callback(x));

            }
        }
        public IHttpActionResult GetRouteByID(int routeID)
        {
            WebResponseContentModel <RouteModel> tmpUser = new WebResponseContentModel <RouteModel>();
            Del <RouteModel> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = routeRepo.GetRouteByID(routeID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetAllSuppliers()
        {
            WebResponseContentModel <List <SupplierModel> > tmpUser = new WebResponseContentModel <List <SupplierModel> >();
            Del <List <SupplierModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = sqlFunctionRepo.GetListOfSupplier();
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetListOfOpenedOrderPositionsBySupplier(string supplier, int clientID = 0)
        {
            WebResponseContentModel <List <OrderPositionModelNew> > tmpUser = new WebResponseContentModel <List <OrderPositionModelNew> >();
            Del <List <OrderPositionModelNew> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = sqlFunctionRepo.GetListOfOpenedOrderPositions(supplier, clientID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #17
0
        public IHttpActionResult GetOrderPositionsByOrderID(int oID)
        {
            WebResponseContentModel <List <OrderPDOPositionModel> > tmpUser = new WebResponseContentModel <List <OrderPDOPositionModel> >();
            Del <List <OrderPDOPositionModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = orderRepo.GetOrderPositionsByOrderID(oID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #18
0
        public IHttpActionResult GetProductBySupplierAndName(string supplier, string name)
        {
            WebResponseContentModel <List <ProductModel> > tmpUser = new WebResponseContentModel <List <ProductModel> >();
            Del <List <ProductModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = mssqlRepo.GetProductBySupplierAndName(supplier, name);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #19
0
        public IHttpActionResult GetOrderByInquiryIDForNewOrder(int iID)
        {
            WebResponseContentModel <InquiryFullModel> tmpUser = new WebResponseContentModel <InquiryFullModel>();
            Del <InquiryFullModel> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = orderRepo.GetOrderPositionsByInquiryIDForNewOrder(iID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetListOfOrderNumber10()
        {
            WebResponseContentModel <List <OrderPositionModelNew> > tmpUser = new WebResponseContentModel <List <OrderPositionModelNew> >();
            Del <List <OrderPositionModelNew> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = sqlFunctionRepo.GetListOfOrderNumber10();
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #21
0
    public IEnumerator Restart()
    {
        List <ActiveTile> tmp = new List <ActiveTile>(activetiles);                       // Generate temporary list for foreach, since CheckNeighbors modifies activetiles

        updateneeded = false;
        foreach (var tile in tmp)
        {
            cdqueue += GetTileAt(tile.X, tile.Y).DestroyChild;
        }
        cdqueue();
        yield return(new WaitForSeconds(.15f));

        cdqueue      = () => { };
        updateneeded = false;
        locked       = false;
        UI.SetWLStatus();
        GenerateLevel();
    }
        public IHttpActionResult GetMailByID(int mailID)
        {
            WebResponseContentModel <PDOEmailModel> tmpUser = new WebResponseContentModel <PDOEmailModel>();
            Del <PDOEmailModel> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = mailsRepo.GetMailByID(mailID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetAllRoutes()
        {
            WebResponseContentModel <List <RouteModel> > tmpUser = new WebResponseContentModel <List <RouteModel> >();
            Del <List <RouteModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = routeRepo.GetAllRoutes();
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetTenderListByRouteIDAndRecallID(int routeID, int recallID)
        {
            WebResponseContentModel <List <TenderPositionModel> > tmpUser = new WebResponseContentModel <List <TenderPositionModel> >();
            Del <List <TenderPositionModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = tenderRepo.GetTenderListByRouteIDAndRecallID(routeID, recallID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetCategoryList()
        {
            WebResponseContentModel <List <ProductCategory> > tmpUser = new WebResponseContentModel <List <ProductCategory> >();
            Del <List <ProductCategory> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = sqlFunctionRepo.GetCategoryList();
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #26
0
        public static int MainMethod(string[] args)
        {
            dynamic b = new Test();

            try
            {
                Del     ddd = new Del(b.Method);
                dynamic d1  = 1;
                dynamic d2  = 2;
                ddd(d1, d2);
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                return(0);
            }

            return(1);
        }
        public IHttpActionResult GetRoutesByCarrierIDAndRouteID(int carrierID, int routeID)
        {
            WebResponseContentModel <List <RouteModel> > tmpUser = new WebResponseContentModel <List <RouteModel> >();
            Del <List <RouteModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = routeRepo.GetRoutesByCarrierIDAndRouteID(carrierID, routeID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
    static void Main()
    {
        MathClass m = new MathClass();

        // Delegate instantiation using "MultiplyNumbers"
        Del d = m.MultiplyNumbers;

        // Invoke the delegate object.
        System.Console.WriteLine("Invoking the delegate using 'MultiplyNumbers':");
        for (int i = 1; i <= 5; i++)
        {
            d(i, 2);
        }

        // Keep the console window open in debug mode.
        System.Console.WriteLine("Press any key to exit.");
        System.Console.ReadKey();
    }
Пример #29
0
        void OnEnable()
        {
            // 텍스트 박스가 잘 보일때는 알파값은 1이다.
            alphaVal = 1f;
            // 최초의 알파는 투명해야 되니 값을 0으로 지정한다.
            alphaChanged = 0f;
            // 처음에 대화창이 나올때는 투명에서 시작한다.
            baseImage.color = ChangeAlpha(alphaChanged, baseImage.color);
            // 글씨 투명도 역시 똑같이 변화하게 해준다.
            bubbleText.color = ChangeAlpha(alphaChanged, bubbleText.color);
            // 알파값을 변화시켜주는 함수를 delegate 등록한다.
            delUpdate += ShowTextBox;

            sLength = 0f;

            isRolling = false;
            spendTime = 0f;
        }
Пример #30
0
        public IHttpActionResult GetOptimalStockOrderByID(int ID)
        {
            WebResponseContentModel <OptimalStockOrderModel> tmpUser = new WebResponseContentModel <OptimalStockOrderModel>();
            Del <OptimalStockOrderModel> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = optimalStockOrderRepo.GetOptimalStockOrderByID(ID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetTenderByID(int tenderID)
        {
            WebResponseContentModel <TenderFullModel> tmpUser = new WebResponseContentModel <TenderFullModel>();
            Del <TenderFullModel> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = tenderRepo.GetTenderModelByID(tenderID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetLowestAndMostRecentPriceByRouteID(int routeID)
        {
            WebResponseContentModel <decimal> tmpUser = new WebResponseContentModel <decimal>();
            Del <decimal> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = tenderRepo.GetLowestAndMostRecentPriceByRouteID(routeID);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
        public IHttpActionResult GetTenderList(string dtFrom, string dtTo)
        {
            WebResponseContentModel <List <TenderFullModel> > tmpUser = new WebResponseContentModel <List <TenderFullModel> >();
            Del <List <TenderFullModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = tenderRepo.GetTenderList(dtFrom, dtTo);
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #34
0
    public static float minArg(Del function, float startValue)
    {
        float stepBase = 0.1f;
        int   stepCnt  = 0;

        while (stepBase > 1e-6 && stepCnt < 1e5)
        {
            float step = (function(startValue) < function(startValue + stepBase)) ? -stepBase : stepBase;

            while (function(startValue) > function(startValue + step))
            {
                startValue += step;
                stepCnt++;
            }
            stepBase *= 0.1f;
        }
        return(startValue);
    }
Пример #35
0
 // Delete the data on SQL databate
 public void SQLDelete(Del Del)
 {
     if (System.IO.File.Exists(@Del.fullname))
     {
         Error++; // Count the error
         ListBoxPrint.Items.Add("Error! File still not delete.");
     }
     else
     {
         ListBoxPrint.Items.Add("Data deleted. Faxid : " + Del.faxid);
         sql     = "delete from faxcontent where faxid = @faxid ";
         command = new SqlCommand(sql, connection);
         command.Parameters.Add("@faxid", SqlDbType.Int);
         command.Parameters["@faxid"].Value = Del.faxid;
         command.ExecuteNonQuery();
         command.Dispose();
     }
 }
        public IHttpActionResult GetAppSettings()
        {
            WebResponseContentModel <SettingsModel> tmpUser = new WebResponseContentModel <SettingsModel>();
            Del <SettingsModel> responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = settingsRepo.GetLatestSettings();
                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #37
0
        ///<summary>
        /// The main function to calculate the adjusted forward.
        ///</summary>
        ///<param name="futuresPrice"> Vector of futures prices.</param>
        ///<param name="volatility"> Vector of futures</param>
        ///<param name="correlation"> Correlation between forwards. Can be a
        /// scalar input or a correlation matrix.</param>
        ///<param name="shift"> The shift parameters from the BGM
        /// calibration.</param>
        ///<param name="coverage"> The vector of time intervals between model
        /// time nodes.</param>
        ///<param name="timeNodes"> The model time nodes</param>
        ///<returns> optOut, an array OptimisationOuput types, with one element
        /// for each time node.</returns>
        public static OptimisationOutput[] CalculateCashForward(double[] futuresPrice,
                                                                double[,] volatility,
                                                                double[, ,] correlation,
                                                                double[] shift,
                                                                double[] coverage,
                                                                double[] timeNodes)
        {
            var          terminalNode       = futuresPrice.Length - 1;
            var          optOut             = new OptimisationOutput[terminalNode + 1];
            var          cashForward        = new double[terminalNode + 1];
            const double tolerance          = 0.000000001;
            const int    maxIterations      = 100;
            const int    approximationOrder = 3;

            Del delObjective = Difference;

            // This assumes that if vol is input as a column vector (for
            // terminal node greater than 1) then the vol is meant to be
            // constant for each time node.
            if (volatility.GetLength(1) == 1 &&
                volatility.GetLength(0) == terminalNode + 1 && terminalNode > 1)
            {
                volatility = Utilities.Transpose(volatility);
            }

            for (var j = 1; j <= terminalNode; j++)
            {
                var    fixingNode   = j;
                double initialValue = j > 1 ? cashForward[j - 1] : futuresPrice[j];

                var targetPrice = futuresPrice[j];

                optOut[j] = Optimiser.Secant(delObjective, initialValue,
                                             tolerance, maxIterations, cashForward,
                                             approximationOrder, fixingNode, volatility,
                                             correlation, shift, coverage, timeNodes,
                                             targetPrice);

                cashForward[j] = optOut[j].X;
            }


            return(optOut);
        }
Пример #38
0
        public static Message Parse(string s)
        {
            Del subjectHandler   = assignSubject;
            Del senderHandler    = assignSender;
            Del recipientHandler = assignRecipent;
            Del dateHandler      = assignDate;
            Del mimeHandler      = assignMime;
            Del encodingHandler  = assignEncoding;

            Dictionary <string, Delegate> d = new Dictionary <string, Delegate>();

            d.Add("Date: ", dateHandler);
            d.Add("Mime-Version: ", mimeHandler);//most parsing occurs therein
            d.Add("Subject: ", subjectHandler);
            d.Add("From: ", senderHandler);
            d.Add("To: ", recipientHandler);
            d.Add("charset=", encodingHandler);

            mimeHandled  = false;
            multiHandled = false;
            Message m = new Message("", s, "", "", "");

            foreach (string headerCheck in splitToLines(returnHeader(s)))
            {
                //Console.WriteLine(headerCheck);
                foreach (KeyValuePair <string, Delegate> k in d)
                {
                    if (headerCheck.StartsWith(k.Key))
                    {
                        k.Value.DynamicInvoke(headerCheck.Substring(k.Key.Length), m);
                    }
                }
            }
            if (!mimeHandled)
            {
                ParsePlainText(m.body, m);
            }
            if (multiHandled)
            {
                m.body = removeHeader(m.body);
            }
            Console.WriteLine("returning m");
            return(m);
        }
Пример #39
0
        static void Main(string[] args)
        {
            /*
             * Создайте делегат Del, параметризированный местом заполнения типом T, и сообщаемый с методом,
             * который ничего не возвращает и принимает два аргумента типа T – оба по ссылке.
             * Создать методы, сообщаемые с Del:
             * 1.	Меняющий значения переменных местами.
             * 2.	Выводящий на экран строку: «значение первого аргумента – {0}, значение второго аргумента – {1}»;
             * Сообщите методы с экземпляром делегата del1, закрытым интом, в таком порядке: 2, 1, 2.
             * Создайте другой экземпляр делегата - del2, закрытый строкой, и сообщите с ним методы в таком же порядке.
             * Проверьте работу делегата целочисленными значениями и со строковыми значениями.
             */

            int x = 10;
            int y = 20;

            Del <int> del1 = new Del <int>(Display);

            del1(ref x, ref y);

            del1 = new Del <int>(Swap);
            del1(ref x, ref y);

            del1 = new Del <int>(Display);
            del1(ref x, ref y);

            Console.WriteLine("------------");
            //2
            string x1 = "Привет";
            string y1 = "Пока";

            Del <string> del2 = new Del <string>(Display);

            del2(ref x1, ref y1);

            del2 = new Del <string>(Swap);
            del2(ref x1, ref y1);

            del2 = new Del <string>(Display);
            del2(ref x1, ref y1);


            Console.ReadKey();
        }
Пример #40
0
 public LobbyVM()
 {
     del = new Del(DealReceivePre);
     RoomNum = 0;
     SeatNum = 0;
     CanJoin = false;
     CanCreat = true;
     CanStart = false;
     IsEnable = true;
     RoomList = new ObservableCollection<LobbyRoom>();
     PlayerList = new ObservableCollection<LobbyPlayer>();
     ThReceive = new Thread(ReceiveSocket);
     ThReceive.IsBackground = true;
     ThReceive.Start(App.NetCtrl.SocketClient);
     App.NetCtrl.Send("2|3|1|");
     BtnJoinCmd = new RelayCommand(new Action(Join));
     BtnCreatCmd = new RelayCommand(new Action(Creat));
     BtnStartCmd = new RelayCommand(new Action(Start));
 }
Пример #41
0
        /// <summary>
        /// Sets a blank state, turn/win variables to defualt, starts socket and ip info form
        /// </summary>
        public SocTacToe()
        {
            InitializeComponent();

            State.ResetState(button_A1, button_A2, button_A3, button_B1, button_B2, button_B3, button_C1, button_C2, button_C3, Lbl_Msg, ref _turnNumber, ref _winner, _pictureBox1, ref _turn); //zero out _state
            State.SetState(button_A1, button_A2, button_A3, button_B1, button_B2, button_B3, button_C1, button_C2, button_C3, Lbl_Msg, ref _turn); //set _state to current buttons

            using (IpPortForm ipPortForm = new IpPortForm())
            {
                if (ipPortForm.ShowDialog() == DialogResult.OK)
                {
                }
                _ip = ipPortForm.GetIp();
                _port = ipPortForm.GetPort();
                delegateHandler = UpdateBoard;
                Thread clientThread = new Thread(() => SynchronousSocketClient.StartClient(_ip, _port, delegateHandler));
                clientThread.Start();
            }
        }
Пример #42
0
        static void Main(string[] args)
        {
            Del <int>    m1 = new Del <int>(CHECK);
            Del <string> m2 = new Del <string>(CHECK);

            MyGenericClass <string> generic_obj_string = new MyGenericClass <string>("Meow");

            generic_obj_string.genericMethod("MEOW");

            Console.WriteLine("----");
            MyGenericClass <bool> generic_obj_boolean = new MyGenericClass <bool>(true);

            generic_obj_boolean.genericMethod(true);

            Console.WriteLine("----");
            MyGenericClass <int> generic_obj_int = new MyGenericClass <int>(42342);

            generic_obj_int.genericMethod(228123);
        }
Пример #43
0
        static void Main(string[] args)
        {
            Del d = MethodOne;

            d += MethodTwo;
            d += MethodThree;

            d -= MethodOne; //One will be removed

            //Find How many methods delegate gonna call
            int methodCount = d.GetInvocationList().Count();

            Console.WriteLine("Delegate will call {0} methods", methodCount);

            d();


            Console.ReadLine();
        }
Пример #44
0
        public IHttpActionResult GetCarriersInquiry(int recallID)
        {
            WebResponseContentModel <List <CarrierInquiryModel> > tmpUser = new WebResponseContentModel <List <CarrierInquiryModel> >();
            Del <List <CarrierInquiryModel> > responseStatusHandler       = ProcessContentModel;

            try
            {
                tmpUser.Content = recallRepo.GetCarriersInquiry(recallID);

                responseStatusHandler(tmpUser);
            }
            catch (Exception ex)
            {
                responseStatusHandler(tmpUser, ex);
                return(Json(tmpUser));
            }

            return(Json(tmpUser));
        }
Пример #45
0
        static void Main(string[] args)
        {
            Del del = new Del(M1);

            del += MM;

            // del += M2;


            DelInt delint = new DelInt(M2);

            Console.WriteLine(delint(40));
            del();
            Console.WriteLine("del-M1");
            del -= M1;
            del();

            Console.Read();
        }
Пример #46
0
 public static async void WithDialog(JToken Json, string Confirmation, Del callback = null)
 {
     Debug.WriteLine(Json);
     if (Json != null)
     {
         if ((string)Json.SelectToken("status") == "error" || Json.SelectToken("errors") != null)
         {
             var errors = Json.SelectToken("errors");
             MessageDialog messageDialog = new MessageDialog("Erreur :\n" + errors.First);
             messageDialog.CancelCommandIndex = 1;
             await messageDialog.ShowAsync();
         }
         else
         {
             Utils.Notify(Confirmation, "");
             if (callback != null)
                 callback();
         }
     }
 }
        public static int MainMethod(string[] args)
        {
            dynamic b = new Test();
            try
            {
                Del ddd = new Del(b.Method);
                dynamic d1 = 1;
                dynamic d2 = 2;
                ddd(d1, d2);
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                return 0;
            }

            return 1;
        }
Пример #48
0
 /// <summary>
 /// This method is called whenever the timer's event is fired
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void timerHasTriggered(object sender, ElapsedEventArgs e)
 {
     Del caller = new Del(_gui.refreshScreen);
     _grid.timeTick();
     Grid tempCopy = ObjectCopier.Clone<Grid>(_grid); //creates a temporary copy of the object _grid
     try
     {
         _gui.Invoke(caller, new object[] { tempCopy });             //and sends that copy as a parameter to the GUI
     }
     catch { }
 }
Пример #49
0
    public static int Main()
    {
        object x = 5;
        if (printInt (x) != 6)
            return 1;

        Del del = new Del (TestMethod);
        callFunction (del);

        return 0;
    }
Пример #50
0
 public NoArgsSuffix(Del del, string description = ""):base(description)
 {
     this.del = del;
 }
Пример #51
0
 public MenuItem(Game1 game,Color col,Vector2 pos,string txt,Del trig)
 {
     _normalcolour = col;
     _color = _normalcolour;
     displayText = txt;
     _position = pos;
     TriggerMethod = trig;
     textures = game.Services.GetService<Textures>();
 }
Пример #52
0
    void Start()
    {
        input_ip = "127.0.0.1";
        input_name = "car";

        statics.read_object_list = new ArrayList();
        statics.read_object_byte_list = new ArrayList();
        StartCoroutine(fast_update());

        cmd = (control_cmd)quad.GetComponent("control_cmd");
        sendtexture = (send_texture)GetComponent("send_texture");

        a = new Del (call);

        Animation anim = (Animation)Car.GetComponent ("Animation");
        anim ["car"].speed = 1f;
        anim.Play ();
    }
 public ComputationOfOneColumnCommand(Column column, Del del)
 {
     this.column = column;
     newRows = new List<Cell>();
     this.del = del;
 }
Пример #54
0
        private void Load(string world, Del done)
        {
            ThreadStart loadThread = delegate()
            {
                try
                {
                    currentWorld = world;
                    bool foundInvalid = false;

                    string invalid = "";
                    using (BinaryReader b = new BinaryReader(File.Open(world, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
                    {
                        int version = b.ReadInt32(); //now we care about the version
                        if (version > MapVersion) // new map format
                            throw new Exception("Unsupported map version: " + version);
                        string title = b.ReadString();
                        Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            Title = title;
                        }));
                        worldID = b.ReadInt32();
                        b.BaseStream.Seek(16, SeekOrigin.Current); //skip bounds
                        tilesHigh = b.ReadInt32();
                        tilesWide = b.ReadInt32();
                        moonType = 0;
                        if (version >= 63)
                            moonType = b.ReadByte();
                        treeX[0] = treeX[1] = treeX[2] = 0;
                        treeStyle[0] = treeStyle[1] = treeStyle[2] = treeStyle[3] = 0;
                        if (version >= 44)
                        {
                            treeX[0] = b.ReadInt32();
                            treeX[1] = b.ReadInt32();
                            treeX[2] = b.ReadInt32();
                            treeStyle[0] = b.ReadInt32();
                            treeStyle[1] = b.ReadInt32();
                            treeStyle[2] = b.ReadInt32();
                            treeStyle[3] = b.ReadInt32();
                        }
                        caveBackX[0] = caveBackX[1] = caveBackX[2] = 0;
                        caveBackStyle[0] = caveBackStyle[1] = caveBackStyle[2] = caveBackStyle[3] = 0;
                        iceBackStyle = jungleBackStyle = hellBackStyle = 0;
                        if (version >= 60)
                        {
                            caveBackX[0] = b.ReadInt32();
                            caveBackX[1] = b.ReadInt32();
                            caveBackX[2] = b.ReadInt32();
                            caveBackStyle[0] = b.ReadInt32();
                            caveBackStyle[1] = b.ReadInt32();
                            caveBackStyle[2] = b.ReadInt32();
                            caveBackStyle[3] = b.ReadInt32();
                            iceBackStyle = b.ReadInt32();
                            if (version >= 61)
                            {
                                jungleBackStyle = b.ReadInt32();
                                hellBackStyle = b.ReadInt32();
                            }
                        }
                        spawnX = b.ReadInt32();
                        spawnY = b.ReadInt32();
                        groundLevel = (int)b.ReadDouble();
                        rockLevel = (int)b.ReadDouble();
                        gameTime = b.ReadDouble();
                        dayNight = b.ReadBoolean();
                        moonPhase = b.ReadInt32();
                        bloodMoon = b.ReadBoolean();
                        eclipse = false;
                        if (version >= 70)
                            eclipse = b.ReadBoolean();
                        dungeonX = b.ReadInt32();
                        dungeonY = b.ReadInt32();
                        crimson = false;
                        if (version >= 56)
                            crimson = b.ReadBoolean();
                        killedBoss1 = b.ReadBoolean();
                        killedBoss2 = b.ReadBoolean();
                        killedBoss3 = b.ReadBoolean();
                        killedQueenBee = false;
                        if (version >= 66)
                            killedQueenBee = b.ReadBoolean();
                        killedMechBoss1 = killedMechBoss2 = killedMechBoss3 = killedMechBossAny = false;
                        if (version >= 44)
                        {
                            killedMechBoss1 = b.ReadBoolean();
                            killedMechBoss2 = b.ReadBoolean();
                            killedMechBoss3 = b.ReadBoolean();
                            killedMechBossAny = b.ReadBoolean();
                        }
                        killedPlantBoss = killedGolemBoss = false;
                        if (version >= 64)
                        {
                            killedPlantBoss = b.ReadBoolean();
                            killedGolemBoss = b.ReadBoolean();
                        }
                        savedTinkerer = savedWizard = savedMechanic = killedGoblins = killedClown = killedFrost = killedPirates = false;
                        if (version >= 29)
                        {
                            savedTinkerer = b.ReadBoolean();
                            savedWizard = b.ReadBoolean();
                            if (version >= 34)
                                savedMechanic = b.ReadBoolean();
                            killedGoblins = b.ReadBoolean();
                            if (version >= 32)
                                killedClown = b.ReadBoolean();
                            if (version >= 37)
                                killedFrost = b.ReadBoolean();
                            if (version >= 56)
                                killedPirates = b.ReadBoolean();
                        }
                        smashedOrb = b.ReadBoolean();
                        meteorSpawned = b.ReadBoolean();
                        shadowOrbCount = b.ReadByte();
                        altarsSmashed = 0;
                        hardMode = false;
                        if (version >= 23)
                        {
                            altarsSmashed = b.ReadInt32();
                            hardMode = b.ReadBoolean();
                        }
                        goblinsDelay = b.ReadInt32();
                        goblinsSize = b.ReadInt32();
                        goblinsType = b.ReadInt32();
                        goblinsX = b.ReadDouble();

                        isRaining = false;
                        rainTime = 0;
                        maxRain = 0.0F;
                        oreTier1 = 107;
                        oreTier2 = 108;
                        oreTier3 = 111;
                        if (version >= 23 && altarsSmashed == 0)
                            oreTier1 = oreTier2 = oreTier3 = -1;
                        if (version >= 53)
                        {
                            isRaining = b.ReadBoolean();
                            rainTime = b.ReadInt32();
                            maxRain = b.ReadSingle();
                            if (version >= 54)
                            {
                                oreTier1 = b.ReadInt32();
                                oreTier2 = b.ReadInt32();
                                oreTier3 = b.ReadInt32();
                            }
                        }
                        if (version >= 55)
                        {
                            int numstyles = 3;
                            if (version >= 60)
                                numstyles = 8;
                            for (int i = 0; i < numstyles; i++)
                                styles[i] = b.ReadByte();
                            //skip clouds
                            if (version >= 60)
                            {
                                b.BaseStream.Seek(4, SeekOrigin.Current);
                                if (version >= 62) //skip wind
                                    b.BaseStream.Seek(6, SeekOrigin.Current);
                            }
                        }

                        ResizeMap();
                        for (int x = 0; x < tilesWide; x++)
                        {
                            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                            {
                                serverText.Text = ((int)((float)x * 100.0 / (float)tilesWide)) + "% - Reading tiles";
                            }));
                            for (int y = 0; y < tilesHigh; y++)
                            {
                                tiles[x, y].isActive = b.ReadBoolean();
                                if (tiles[x, y].isActive)
                                {
                                    tiles[x, y].type = b.ReadByte();
                                    if (tiles[x, y].type > MaxTile) // something screwy in the map
                                    {
                                        tiles[x, y].isActive = false;
                                        foundInvalid = true;
                                        invalid = String.Format("{0} is not a valid tile type", tiles[x, y].type);
                                    }
                                    else if (tileInfos[tiles[x, y].type].hasExtra)
                                    {
                                        // torches and platforms didn't have extra in older versions.
                                        if ((version < 28 && tiles[x, y].type == 4) ||
                                            (version < 40 && tiles[x, y].type == 19))
                                        {
                                            tiles[x, y].u = -1;
                                            tiles[x, y].v = -1;
                                        }
                                        else
                                        {
                                            tiles[x, y].u = b.ReadInt16();
                                            tiles[x, y].v = b.ReadInt16();
                                            if (tiles[x, y].type == 144) //timer
                                                tiles[x, y].v = 0;
                                        }
                                    }
                                    else
                                    {
                                        tiles[x, y].u = -1;
                                        tiles[x, y].v = -1;
                                    }

                                    if (version >= 48 && b.ReadBoolean())
                                    {
                                        tiles[x, y].color = b.ReadByte();
                                    }
                                }
                                if (version <= 25)
                                    b.ReadBoolean(); //skip obsolete hasLight
                                if (b.ReadBoolean())
                                {
                                    tiles[x, y].wall = b.ReadByte();
                                    if (tiles[x, y].wall > MaxWall)  // bad wall
                                    {
                                        foundInvalid = true;
                                        invalid = String.Format("{0} is not a valid wall type", tiles[x, y].wall);
                                        tiles[x, y].wall = 0;
                                    }
                                    if (version >= 48 && b.ReadBoolean())
                                        tiles[x, y].wallColor = b.ReadByte();
                                    tiles[x, y].wallu = -1;
                                    tiles[x, y].wallv = -1;
                                }
                                else
                                    tiles[x, y].wall = 0;
                                if (b.ReadBoolean())
                                {
                                    tiles[x, y].liquid = b.ReadByte();
                                    tiles[x, y].isLava = b.ReadBoolean();
                                    if (version >= 51)
                                        tiles[x, y].isHoney = b.ReadBoolean();
                                }
                                else
                                    tiles[x, y].liquid = 0;
                                tiles[x, y].hasRedWire = false;
                                tiles[x, y].hasGreenWire = false;
                                tiles[x, y].hasBlueWire = false;
                                tiles[x, y].half = false;
                                tiles[x, y].actuator = false;
                                tiles[x, y].inactive = false;
                                tiles[x, y].slope = 0;
                                if (version >= 33)
                                {
                                    tiles[x, y].hasRedWire = b.ReadBoolean();
                                    if (version >= 43)
                                    {
                                        tiles[x, y].hasGreenWire = b.ReadBoolean();
                                        tiles[x, y].hasBlueWire = b.ReadBoolean();
                                    }
                                    if (version >= 41)
                                    {
                                        tiles[x, y].half = b.ReadBoolean();
                                        if (version >= 49)
                                            tiles[x, y].slope = b.ReadByte();
                                        if (!tileInfos[tiles[x, y].type].solid)
                                        {
                                            tiles[x, y].half = false;
                                            tiles[x, y].slope = 0;
                                        }
                                        if (version >= 42)
                                        {
                                            tiles[x, y].actuator = b.ReadBoolean();
                                            tiles[x, y].inactive = b.ReadBoolean();
                                        }
                                    }
                                }
                                if (version >= 25) //RLE
                                {
                                    int rle = b.ReadInt16();
                                    for (int r = y + 1; r < y + 1 + rle; r++)
                                    {
                                        tiles[x, r].isActive = tiles[x, y].isActive;
                                        tiles[x, r].type = tiles[x, y].type;
                                        tiles[x, r].u = tiles[x, y].u;
                                        tiles[x, r].v = tiles[x, y].v;
                                        tiles[x, r].wall = tiles[x, y].wall;
                                        tiles[x, r].wallu = -1;
                                        tiles[x, r].wallv = -1;
                                        tiles[x, r].liquid = tiles[x, y].liquid;
                                        tiles[x, r].isLava = tiles[x, y].isLava;
                                        tiles[x, r].isHoney = tiles[x, y].isHoney;
                                        tiles[x, r].hasRedWire = tiles[x, y].hasRedWire;
                                        tiles[x, r].hasGreenWire = tiles[x, y].hasGreenWire;
                                        tiles[x, r].hasBlueWire = tiles[x, y].hasBlueWire;
                                        tiles[x, r].half = tiles[x, y].half;
                                        tiles[x, r].slope = tiles[x, y].slope;
                                        tiles[x, r].actuator = tiles[x, y].actuator;
                                        tiles[x, r].inactive = tiles[x, y].inactive;
                                        tiles[x, r].color = tiles[x, y].color;
                                        tiles[x, r].wallColor = tiles[x, y].wallColor;
                                    }
                                    y += rle;
                                }
                            }
                        }
                        int itemsPerChest = 40;
                        if (version < 58)
                            itemsPerChest = 20;
                        chests.Clear();
                        for (int i = 0; i < 1000; i++)
                        {
                            if (b.ReadBoolean())
                            {
                                Chest chest = new Chest();
                                chest.items = new ChestItem[itemsPerChest];
                                chest.x = b.ReadInt32();
                                chest.y = b.ReadInt32();
                                for (int ii = 0; ii < itemsPerChest; ii++)
                                {
                                    if (version < 59)
                                        chest.items[ii].stack = b.ReadByte();
                                    else
                                        chest.items[ii].stack = b.ReadInt16();
                                    if (chest.items[ii].stack > 0)
                                    {
                                        string name = "Unknown";
                                        if (version >= 38) //item names not stored
                                        {
                                            Int32 itemid = b.ReadInt32();
                                            if (itemid < 0)
                                            {
                                                itemid = -itemid;
                                                if (itemid < itemNames2.Length)
                                                    name = itemNames2[itemid];
                                            }
                                            else if (itemid < itemNames.Length)
                                                name = itemNames[itemid];
                                        }
                                        else
                                            name = b.ReadString();
                                        string prefix = "";
                                        if (version >= 36) //item prefixes
                                        {
                                            int pfx = b.ReadByte();
                                            if (pfx < prefixes.Length)
                                                prefix = prefixes[pfx];
                                        }
                                        chest.items[ii].name = name;
                                        chest.items[ii].prefix = prefix;
                                    }
                                }
                                chests.Add(chest);
                            }
                        }
                        signs.Clear();
                        for (int i = 0; i < 1000; i++)
                        {
                            if (b.ReadBoolean())
                            {
                                Sign sign = new Sign();
                                sign.text = b.ReadString();
                                sign.x = b.ReadInt32();
                                sign.y = b.ReadInt32();
                                signs.Add(sign);
                            }
                        }
                        npcs.Clear();
                        Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            NPCs.Items.Clear();
                            serverText.Text = "Loading NPCs...";
                        }));
                        while (b.ReadBoolean())
                        {
                            NPC npc = new NPC();
                            npc.title = b.ReadString();
                            npc.name = "";
                            npc.x = b.ReadSingle();
                            npc.y = b.ReadSingle();
                            npc.isHomeless = b.ReadBoolean();
                            npc.homeX = b.ReadInt32();
                            npc.homeY = b.ReadInt32();

                            npc.order = -1;
                            npc.num = 0;
                            npc.sprite = 0;
                            for (int i = 0; i < friendlyNPCs.Length; i++)
                                if (friendlyNPCs[i].title == npc.title)
                                {
                                    npc.sprite = friendlyNPCs[i].id;
                                    npc.num = friendlyNPCs[i].num;
                                    npc.order = friendlyNPCs[i].order;
                                }

                            npcs.Add(npc);
                            addNPCToMenu(npc);
                        }
                        if (version >= 31) //read npcs
                        {
                            int numNames = 9;
                            if (version >= 34)
                                numNames++;
                            if (version >= 65)
                                numNames += 8;
                            for (int i = 0; i < numNames; i++)
                            {
                                string name = b.ReadString();
                                for (int j = 0; j < npcs.Count; j++)
                                {
                                    if (npcs[j].order == i)
                                    {
                                        npcs[j].name = name;
                                        addNPCToMenu(npcs[j]);
                                    }
                                }
                            }
                        }
                    }
                    if (foundInvalid)
                    {
                        Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            MessageBox.Show("Found problems with the map: " + invalid + "\nIt may not display properly.", "Warning");
                        }));
                    }
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                    {
                        serverText.Text = "Loading Fog of War...";
                    }));
                    //load player's map
                    loadPlayerMap();

                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            QuickHiliteToggle.IsEnabled = true;
                            render.SetWorld(tilesWide, tilesHigh, groundLevel, rockLevel, styles, treeX, treeStyle, caveBackX, caveBackStyle, jungleBackStyle, hellBackStyle, npcs);
                            loaded = true;
                            done();
                        }));
                    calculateLight();
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            serverText.Text = "";
                        }));
                }
                catch (Exception e)
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            MessageBox.Show(e.Message);
                            loaded = false;
                            serverText.Text = "";
                            done();
                        }));
                }
            };
            new Thread(loadThread).Start();
        }
	void HandlesDel(Del del)
	{
		del();
	}
Пример #56
0
 public void MethodWithCallback(string name, Del callBack)
 {
     string cadena = "Metodo con callback (" + name + ")";
     callBack(cadena);
 }
Пример #57
0
 public static void MethodWithCallback(int param1, int param2, Del callback)
 {
     callback("The number is: " + (param1 + param2).ToString());
 }
Пример #58
0
 public ControllerPlayer(Del.None win)
 {
     mWin = win;
     mMouse = new Mouse(null, onDragLeft, onClickRight, null);
 }
Пример #59
0
        private void Load(string world, Del done)
        {
            ThreadStart loadThread = delegate()
            {
                try
                {
                    currentWorld = world;
                    bool foundInvalid = false;

                    string invalid = "";
                    using (BinaryReader b = new BinaryReader(File.Open(world, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
                    {
                        int version = b.ReadInt32(); //now we care about the version
                        if (version > MapVersion)
                            throw new Exception("Unsupported map version: " + version);
                        if (version > 87) //new map format
                            foundInvalid = LoadNewMap(b, version, out invalid);
                        else
                            foundInvalid = LoadOldMap(b, version, out invalid);
                    }
                    if (foundInvalid)
                    {
                        Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            MessageBox.Show("Found problems with the map: " + invalid + "\nIt may not display properly.", "Warning");
                        }));
                    }
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                    {
                        serverText.Text = "Loading Fog of War...";
                        //FogOfWar.IsChecked = false;
                    }));

                    //load player's map
                    loadPlayerMap();

                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            QuickHiliteToggle.IsEnabled = true;
                            render.SetWorld(tilesWide, tilesHigh, groundLevel, rockLevel, styles, treeX, treeStyle, caveBackX, caveBackStyle, jungleBackStyle, hellBackStyle, npcs);
                            loaded = true;
                            done();
                        }));
                    calculateLight();
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            serverText.Text = "";
                        }));
                }
                catch (Exception e)
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            MessageBox.Show(e.Message);
                            loaded = false;
                            serverText.Text = "";
                            done();
                        }));
                }
            };
            new Thread(loadThread).Start();
        }
Пример #60
0
 public Boolean runTest()
   {
   int iCountTestcases = 0;
   int iCountErrors    = 0;
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_int_int_int inst_dlg_int_int_int = new dlg_int_int_int (instCo1901Clone.return_int_add_int_int);
   inst_dlg_int_int_int = inst_dlg_int_int_int;				
   int numberInvoked = CheckInvkList_int_int_int(inst_dlg_int_int_int);
   dlg_int_int_int delClone_int_int_int = (dlg_int_int_int) inst_dlg_int_int_int.Clone();
   if (numberInvoked!=(CheckInvkList_int_int_int(inst_dlg_int_int_int)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x001: inst_dlg_int_int_int returned a wrong result");
     }
   int yehInt = delClone_int_int_int (2, -4);
   if (yehInt!= -2)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_001: invokation list changed");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_001,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_void inst_dlg_void = new dlg_void (instCo1901Clone.return_void);
   dlg_void static_dlg_void = new dlg_void (Co1901Clone.static_return_void);
   inst_dlg_void = inst_dlg_void;
   inst_dlg_void = (dlg_void) Delegate.Combine (inst_dlg_void, static_dlg_void);
   int numberInvoked = CheckInvkList_void (inst_dlg_void);
   dlg_void dlgClone_void = (dlg_void) inst_dlg_void.Clone();		
   if (numberInvoked!=(CheckInvkList_void (inst_dlg_void)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x002: invokation list changed");
     }
   dlgClone_void ();
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_002,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_Boolean_Boolean inst_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (instCo1901Clone.return_Boolean_Boolean);
   dlg_Boolean_Boolean static_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (Co1901Clone.static_return_Boolean_Boolean);
   inst_dlg_Boolean_Boolean = (dlg_Boolean_Boolean) Delegate.Combine (static_dlg_Boolean_Boolean, inst_dlg_Boolean_Boolean);
   int numberInvoked = CheckInvkList_Boolean_Boolean (inst_dlg_Boolean_Boolean);
   dlg_Boolean_Boolean dlgClone_Boolean_Boolean = (dlg_Boolean_Boolean) inst_dlg_Boolean_Boolean.Clone();		
   if (numberInvoked != (CheckInvkList_Boolean_Boolean (inst_dlg_Boolean_Boolean)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x003: invokation list changed");
     }
   Boolean yehBool	= dlgClone_Boolean_Boolean (true);
   if (yehBool!= true)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_003: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_003,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_SByte_SByte inst_dlg_SByte_SByte = new dlg_SByte_SByte (instCo1901Clone.return_SByte_SByte);
   dlg_SByte_SByte static_dlg_SByte_SByte = new dlg_SByte_SByte (Co1901Clone.static_return_SByte_SByte);
   static_dlg_SByte_SByte = (dlg_SByte_SByte) Delegate.Combine (static_dlg_SByte_SByte, inst_dlg_SByte_SByte);
   static_dlg_SByte_SByte = static_dlg_SByte_SByte;
   int numberInvoked = CheckInvkList_SByte_SByte (static_dlg_SByte_SByte);
   dlg_SByte_SByte dlgClone_SByte_SByte = (dlg_SByte_SByte) static_dlg_SByte_SByte.Clone();		
   if (numberInvoked != (CheckInvkList_SByte_SByte (static_dlg_SByte_SByte)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x004: invokation list changed");
     }
   SByte yehSByte = dlgClone_SByte_SByte (-1);
   if (yehSByte!= -1)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_004: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_004,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_Byte_Byte inst_dlg_Byte_Byte = new dlg_Byte_Byte (instCo1901Clone.return_Byte_Byte);
   dlg_Byte_Byte static_dlg_Byte_Byte = new dlg_Byte_Byte (Co1901Clone.static_return_Byte_Byte);
   static_dlg_Byte_Byte = static_dlg_Byte_Byte;
   static_dlg_Byte_Byte = (dlg_Byte_Byte) Delegate.Combine (inst_dlg_Byte_Byte, static_dlg_Byte_Byte);
   int numberInvoked = CheckInvkList_Byte_Byte (static_dlg_Byte_Byte);
   dlg_Byte_Byte dlgClone_Byte_Byte = (dlg_Byte_Byte) static_dlg_Byte_Byte.Clone();		
   if (numberInvoked != (CheckInvkList_Byte_Byte (static_dlg_Byte_Byte)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x005: invokation list changed");
     }
   Byte yehByte = dlgClone_Byte_Byte (0);
   if (yehByte!= 0)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_005: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_005,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_char_char inst_dlg_char_char = new dlg_char_char (instCo1901Clone.return_char_char);
   dlg_char_char static_dlg_char_char = new dlg_char_char (Co1901Clone.static_return_char_char);
   inst_dlg_char_char = (dlg_char_char) Delegate.Combine (static_dlg_char_char, inst_dlg_char_char);
   static_dlg_char_char = (dlg_char_char) Delegate.Combine (inst_dlg_char_char, static_dlg_char_char);
   inst_dlg_char_char = (dlg_char_char) Delegate.Combine (static_dlg_char_char, inst_dlg_char_char);
   static_dlg_char_char = (dlg_char_char) Delegate.Combine (inst_dlg_char_char, static_dlg_char_char);
   inst_dlg_char_char = (dlg_char_char) Delegate.Combine (inst_dlg_char_char, static_dlg_char_char);
   int numberInvoked = CheckInvkList_char_char (inst_dlg_char_char);
   dlg_char_char dlgClone_char_char = (dlg_char_char) inst_dlg_char_char.Clone();		
   if (numberInvoked != (CheckInvkList_char_char (inst_dlg_char_char)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x006: invokation list changed");
     }
   numberInvoked = CheckInvkList_char_char (inst_dlg_char_char);
   dlgClone_char_char = (dlg_char_char) dlgClone_char_char.Clone();		
   if (numberInvoked != (CheckInvkList_char_char (dlgClone_char_char)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x006a: invokation list changed");
     }
   char yehChar = dlgClone_char_char ('a');
   if (yehChar!= 'a')
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_006: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_006,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_double_double inst_dlg_double_double = new dlg_double_double (instCo1901Clone.return_double_double);
   int numberInvoked = CheckInvkList_double_double (inst_dlg_double_double);
   dlg_double_double dlgClone_double_double = (dlg_double_double) inst_dlg_double_double.Clone();		
   if (numberInvoked != (CheckInvkList_double_double (inst_dlg_double_double)))
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_x007: invokation list changed");
     }
   double yehDouble = dlgClone_double_double (332);
   if (yehDouble!= 332)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_007: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_007,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   dlg_double_double static_dlg_double_double = new dlg_double_double (Co1901Clone.static_return_double_double);
   dlg_double_double dlgClone_double_double = (dlg_double_double) static_dlg_double_double.Clone();		
   double yehDouble = dlgClone_double_double (332);
   if (yehDouble!= 332)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_007a: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_007a,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_float_float inst_dlg_float_float = new dlg_float_float (instCo1901Clone.return_float_float);
   dlg_float_float dlgClone_float_float = (dlg_float_float) inst_dlg_float_float.Clone();		
   float yehFloat = (float)-2.2;
   yehFloat = dlgClone_float_float (yehFloat);
   if (yehFloat!= (float)-2.2)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_008: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_008,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   dlg_float_float static_dlg_float_float = new dlg_float_float (Co1901Clone.static_return_float_float);
   dlg_float_float dlgClone_float_float = (dlg_float_float) static_dlg_float_float.Clone();		
   float yehFloat = (float)-2.2;
   yehFloat = dlgClone_float_float (yehFloat);
   if (yehFloat!= (float)-2.2)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_008a: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_008a,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_long_long inst_dlg_long_long = new dlg_long_long (instCo1901Clone.return_long_long);
   dlg_long_long dlgClone_long_long = (dlg_long_long) inst_dlg_long_long.Clone();		
   long yehLong = (long)-2;  
   yehLong = dlgClone_long_long (yehLong);
   if (yehLong!= (long)-2)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_009: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_009,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   dlg_long_long static_dlg_long_long = new dlg_long_long (Co1901Clone.static_return_long_long);
   dlg_long_long dlgClone_long_long = (dlg_long_long) static_dlg_long_long.Clone();		
   long yehLong = (long)-2;  
   yehLong = dlgClone_long_long (yehLong);
   if (yehLong!= (long)-2)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_009a: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_009a,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_short_short inst_dlg_short_short = new dlg_short_short (instCo1901Clone.return_short_short);
   dlg_short_short dlgClone_short_short = (dlg_short_short) inst_dlg_short_short.Clone();		
   short yehShort = (short)-2;
   yehShort = dlgClone_short_short (yehShort);
   if (yehShort!= (short)-2)
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_010: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_010,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   Co1901Clone instCo1901Clone = new Co1901Clone();
   dlg_string_string inst_dlg_string_string = new dlg_string_string (instCo1901Clone.return_String_String);
   dlg_string_string dlgClone_string_string = (dlg_string_string) inst_dlg_string_string.Clone();		
   String yehString = "anything\\,\\+weird";
   yehString = dlgClone_string_string (yehString);
   if (yehString!= "anything\\,\\+weird")
     {
     iCountErrors++;
     Console.WriteLine ("Yeh_Err_001: inst_dlg_int_int_int returned a wrong result");
     }
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Yeh_Ex_011,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   someclass sc  = new someclass();
   Del del1 = new Del(sc.counter);
   Del del2 = (Del) del1.Clone();
   if (del1() != 1)
     throw new Exception("wrong return from del1()");
   if (del2() != 2)
     throw new Exception("wrong return from del1()");
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }