Exemple #1
0
        public MacPlatformService()
        {
            if (IntPtr.Size == 8)
            {
                throw new Exception("Mac integration is not yet 64-bit safe");
            }

            if (initedGlobal)
            {
                throw new Exception("Only one MacPlatformService instance allowed");
            }
            initedGlobal = true;

            timer.BeginTiming();

            systemVersion = Carbon.Gestalt("sysv");

            mimemap = new Lazy <Dictionary <string, string> > (LoadMimeMapAsync);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            CheckGtkVersion(2, 24, 14);

            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarWindowBackend, ExtendedTitleBarWindowBackend> ();
            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarDialogBackend, ExtendedTitleBarDialogBackend> ();
        }
Exemple #2
0
        public IActionResult BurialDetails(double burialId)
        {
            IEnumerable <Samples>        SamplesInfo      = _context.Samples.Where(b => b.BurialId == burialId);
            Dictionary <Samples, Carbon> samplesAndCarbon = new Dictionary <Samples, Carbon>();

            Console.WriteLine(burialId);

            foreach (var sample in SamplesInfo)
            {
                Carbon cDate = _context.Carbon.Where(c => c.SampleId == sample.SampleId).FirstOrDefault();
                if (cDate != null)
                {
                    samplesAndCarbon.Add(sample, cDate);
                }
                else
                {
                    samplesAndCarbon.Add(sample, null);
                }
            }

            if (samplesAndCarbon.Count == 0)
            {
                samplesAndCarbon = null;
            }

            return(View(new BurialDetailsViewModel
            {
                BurialInfo = _context.MainTbl.Where(b => b.BurialId == burialId).First(),
                BonesInfo = _context.Bones.Where(b => b.BurialId == burialId).FirstOrDefault(),
                BiologyInfo = _context.Biology.Where(b => b.BurialId == burialId).FirstOrDefault(),
                SamplesAndCarbon = samplesAndCarbon,
            }));
        }
Exemple #3
0
        public void TestCountValences()
        {
            IElement testSubject = new Hydrogen();
            var      testResult  = testSubject.CountValences;

            Console.WriteLine($"{testSubject.Name} {testResult}");
            Assert.AreEqual(1, testResult);

            testSubject = new Helium();
            testResult  = testSubject.CountValences;
            Console.WriteLine($"{testSubject.Name} {testResult}");
            Assert.AreEqual(0, testResult);

            testSubject = new Oxygen();
            testResult  = testSubject.CountValences;
            Console.WriteLine($"{testSubject.Name} {testResult}");
            Assert.AreEqual(2, testResult);

            testSubject = new Nitrogen();
            testResult  = testSubject.CountValences;
            Console.WriteLine($"{testSubject.Name} {testResult}");
            Assert.AreEqual(3, testResult);

            testSubject = new Carbon();
            testResult  = testSubject.CountValences;
            Console.WriteLine($"{testSubject.Name} {testResult}");
            Assert.AreEqual(4, testResult);

            testSubject = new Silicon();
            testResult  = testSubject.CountValences;
            Console.WriteLine($"{testSubject.Name} {testResult}");
        }
Exemple #4
0
        public void TestShellMaxElectrons()
        {
            IElement testSubject = new Carbon();

            Console.WriteLine(testSubject.MaxElectrons);
            Assert.AreEqual(10, testSubject.MaxElectrons);
        }
Exemple #5
0
        public static void Destroy(bool removeRoot)
        {
            if (mainMenus.Count > 0)
            {
                foreach (IntPtr ptr in mainMenus)
                {
                    HIToolbox.DeleteMenu(ptr);
                    CoreFoundation.Release(ptr);
                }
                DestroyOldMenuObjects();
                mainMenus.Clear();
                linkCommands.Clear();
                idSeq = 1;
            }

            HIToolbox.ClearMenuBar();

            if (removeRoot && rootMenu != IntPtr.Zero)
            {
                HIToolbox.DeleteMenu(rootMenu);
                CoreFoundation.Release(rootMenu);
                HIToolbox.CheckResult(HIToolbox.SetRootMenu(IntPtr.Zero));
                Carbon.RemoveEventHandler(commandHandlerRef);
                Carbon.RemoveEventHandler(openingHandlerRef);
                Carbon.RemoveEventHandler(closedHandlerRef);
                commandHandlerRef = openingHandlerRef = rootMenu = IntPtr.Zero;
                idSeq             = 0;
            }
        }
Exemple #6
0
        public async Task <IActionResult> Edit(double id, [Bind("SampleId,CarbonId,Rack,Tube,Description,SizeMl,Foci,C14Sample2017,Location,QuestionS,Unknown,Conventional14cAgeBp,_14cCalendarDate,Calibrated95CalendarDateMax,Calibrated95CalendarDateMin,Calibrated95CalendarDateSpan,Calibrated95CalendarDateAvg,Category,Notes")] Carbon carbon)
        {
            if (id != carbon.CarbonId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carbon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarbonExists(carbon.CarbonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SampleId"] = carbon.SampleId;
            double?currBurialId = _context.Samples.Where(s => s.SampleId == carbon.SampleId).First().BurialId;

            return(RedirectToAction("BurialDetails", "Home", new { burialId = currBurialId }));
        }
        public MacPlatformService()
        {
            if (initedGlobal)
            {
                throw new Exception("Only one MacPlatformService instance allowed");
            }
            initedGlobal = true;

            timer.BeginTiming();

            systemVersion = Carbon.Gestalt("sysv");

            mimemap = new Lazy <Dictionary <string, string> > (LoadMimeMapAsync);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            Cocoa.InitMonoMac();

            CheckGtkVersion(2, 24, 14);

            timer.Trace("Installing App Event Handlers");
            GlobalSetup();

            timer.EndTiming();
        }
Exemple #8
0
        internal static void RunMenuCommand(CarbonCommandID commandID)
        {
            var item = HIToolbox.GetMenuItem((uint)commandID);
            var cmd  = new CarbonHICommand((uint)commandID, item);

            Carbon.ProcessHICommand(ref cmd);
        }
Exemple #9
0
        public MacPlatformService()
        {
            if (initedGlobal)
            {
                throw new Exception("Only one MacPlatformService instance allowed");
            }
            initedGlobal = true;

            timer.BeginTiming();

            var dir = Path.GetDirectoryName(typeof(MacPlatformService).Assembly.Location);

            if (ObjCRuntime.Dlfcn.dlopen(Path.Combine(dir, "libxammac.dylib"), 0) == IntPtr.Zero)
            {
                LoggingService.LogFatalError("Unable to load libxammac");
            }

            mimemap = new Lazy <Dictionary <string, string> > (LoadMimeMapAsync);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            CheckGtkVersion(2, 24, 14);

            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarWindowBackend, ExtendedTitleBarWindowBackend> ();
            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarDialogBackend, ExtendedTitleBarDialogBackend> ();
        }
Exemple #10
0
        static void InstallRootMenu()
        {
            HIToolbox.CheckResult(HIToolbox.SetRootMenu(rootMenu));

            openingHandlerRef = Carbon.InstallApplicationEventHandler(HandleMenuOpening, CarbonEventMenu.Opening);
            closedHandlerRef  = Carbon.InstallApplicationEventHandler(HandleMenuClosed, CarbonEventMenu.Closed);
            commandHandlerRef = Carbon.InstallApplicationEventHandler(HandleMenuCommand, CarbonEventCommand.Process);
        }
Exemple #11
0
        public IActionResult Create(double sampleId)
        {
            Carbon lastCarbon = _context.Carbon.AsEnumerable().LastOrDefault();

            ViewData["SampleId"] = sampleId;
            ViewData["CarbonId"] = lastCarbon.CarbonId + 1;
            return(View());
        }
Exemple #12
0
 static void Main(string[] args)
 {
     Oxygen        oxs = Oxygen.GetElement();
     Carbon        c   = new Carbon();
     CarbonDioxide co2 = oxs.SustainLife(c); //fabryka ew builder, bo zmniejsza ilość węgla
     HumanCell     h1  = new HumanCell();    //klon
     HumanCell     h2  = h1.Divide();
 }
Exemple #13
0
        public void TestIsIon()
        {
            IElement testSubject = new Carbon();

            Assert.IsFalse(testSubject.IsIon);
            testSubject.AddElectron();
            Assert.IsTrue(testSubject.IsIon);
        }
Exemple #14
0
        public void TestIsCation()
        {
            IElement testSubject = new Carbon();

            Assert.IsFalse(testSubject.IsCation);
            testSubject.RemoveElectron();
            Assert.IsTrue(testSubject.IsCation);
        }
Exemple #15
0
        public void TestGetAtoms()
        {
            IElement testSubject = new Carbon();
            var      testResult  = testSubject.GetAtoms(0.5);

            Console.WriteLine(testResult);

            Assert.IsTrue(testResult > 2.5E+22 && testResult < 2.6E+22);
        }
Exemple #16
0
        public void TestCountElectrons()
        {
            IElement testSubject = new Carbon();

            var testResult = testSubject.CountElectrons;

            Console.WriteLine(testResult);
            Assert.AreEqual(6, testResult);
        }
Exemple #17
0
        public void TestProcessName()
        {
            string processName = "HelloWorld";

            Carbon.SetProcessName(processName);

            Process currentProcess = Process.GetCurrentProcess();

            Assert.AreEqual(processName, currentProcess.ProcessName);
        }
Exemple #18
0
    //we inform the bodypart of the changes that happened to the owner, or give it the informations from a source mob.
    // see body_parts.dm /obj/item/bodypart/proc/update_limb(dropping_limb, mob/living/carbon/source)
    public void UpdateLimb(Carbon source)
    {
        // need to add animal checks etc here

        if (source is Human)
        {
            Human s = (Human)source;
            DamageOverlayType = s.DamageOverlayType;
        }
    }
Exemple #19
0
        public void TestValenceShell()
        {
            IElement testSubject = new Carbon();

            var testResult = testSubject.ValenceShell;

            Assert.IsNotNull(testResult);
            Assert.IsTrue(testResult is LShell);
            Assert.AreEqual(4, testResult.GetCountElectrons());
        }
Exemple #20
0
        public void TestEquals()
        {
            IElement testSubject = new Carbon();

            //this should do nothing
            Assert.AreEqual(1, testSubject.Shells.Count(s => s is KShell));

            testSubject.Shells.Add(new KShell(testSubject));

            Assert.AreEqual(1, testSubject.Shells.Count(s => s is KShell));
        }
        static MacPlatform()
        {
            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName("MonoDevelop");

            GlobalSetup();
            mimemap = new Dictionary <string, string> ();
            LoadMimeMap();

            CheckGtkVersion(2, 17, 9);
        }
 public void Persistent(Carbon entry, Action <string, object> callback)
 {
     callback(ResourceManage.SQL_WORKFLOW_NODE_CARBON_INSERT, new
     {
         NID = Guid.NewGuid().ToString(),
         entry.ID,
         entry.RelationshipID,
         entry.Name,
         entry.InstanceID
     });
 }
Exemple #23
0
        public void TestProperties()
        {
            IElement testSubject = new Carbon();

            Assert.IsTrue(testSubject.AtomicNumber > 0);
            Assert.IsNotNull(testSubject.Symbol);
            Assert.AreNotEqual(0D, testSubject.AtomicMass);
            Console.WriteLine(testSubject.RoomTempPhase);
            Assert.IsFalse(testSubject.IsRadioactive);
            Assert.IsFalse(testSubject.IsArtificial);
        }
Exemple #24
0
        //updates commands and populates arrays and dynamic menus
        static CarbonEventHandlerStatus HandleMenuOpening(IntPtr callRef, IntPtr eventRef, IntPtr user_data)
        {
            DestroyOldMenuObjects();
            menuOpenDepth++;
            try {
                IntPtr menuRef = Carbon.GetEventParameter(eventRef, CarbonEventParameterName.DirectObject, CarbonEventParameterType.MenuRef);

                //don't update dynamic menus recursively
                if (!mainMenus.Contains(menuRef) && menuRef != appMenu)
                {
                    return(CarbonEventHandlerStatus.NotHandled);
                }

                //	uint cmd = HIToolbox.GetMenuItemCommandID (new HIMenuItem (menuRef, 0));

                CommandTargetRoute route = new CommandTargetRoute();
                ushort             count = HIToolbox.CountMenuItems(menuRef);
                for (ushort i = 1; i <= count; i++)
                {
                    HIMenuItem mi       = new HIMenuItem(menuRef, i);
                    uint       macCmdID = HIToolbox.GetMenuItemCommandID(mi);
                    object     cmdID;

                    //link items
                    if (macCmdID == linkCommandId)
                    {
                        if (IsGloballyDisabled)
                        {
                            HIToolbox.DisableMenuItem(mi);
                        }
                        else
                        {
                            HIToolbox.EnableMenuItem(mi);
                        }
                        continue;
                    }

                    //items that map to command objects
                    if (!commands.TryGetValue(macCmdID, out cmdID) || cmdID == null)
                    {
                        continue;
                    }

                    CommandInfo cinfo = manager.GetCommandInfo(cmdID, route);
                    menuIdMap[cmdID] = HIToolbox.GetMenuID(menuRef);
                    UpdateMenuItem(menuRef, menuRef, ref i, ref count, macCmdID, cinfo);
                }
            } catch (Exception ex) {
                System.Console.WriteLine(ex);
            }

            return(CarbonEventHandlerStatus.NotHandled);
        }
Exemple #25
0
        public async Task <IActionResult> Create([Bind("SampleId,CarbonId,Rack,Tube,Description,SizeMl,Foci,C14Sample2017,Location,QuestionS,Unknown,Conventional14cAgeBp,_14cCalendarDate,Calibrated95CalendarDateMax,Calibrated95CalendarDateMin,Calibrated95CalendarDateSpan,Calibrated95CalendarDateAvg,Category,Notes")] Carbon carbon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carbon);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SampleId"] = carbon.SampleId;
            double?currBurialId = _context.Samples.Where(s => s.SampleId == carbon.SampleId).First().BurialId;

            return(RedirectToAction("BurialDetails", "Home", new { burialId = currBurialId }));
        }
Exemple #26
0
        public void TestPrintElectronShellCfg()
        {
            IElement testSubject = new Carbon();
            var      testResult  = testSubject.PrintElectronShellCfg(false);

            Console.WriteLine(testResult);
            Assert.AreEqual("1s2 2s2 2p_x^1 2p_y^1 2p_z^0", testResult);

            testResult = testSubject.PrintElectronShellCfg();
            Assert.AreEqual("1s2 2s2 2p2", testResult);
            Console.WriteLine(testResult);

            Console.WriteLine(new Sodium().PrintElectronShellCfg());
        }
Exemple #27
0
        public void TestPrintOrbitalToString()
        {
            IElement testSubject = new Carbon();

            foreach (var shell in testSubject.Shells)
            {
                foreach (var orbitalGrp in shell.Orbitals)
                {
                    Console.WriteLine($"{shell.GetType().Name} {orbitalGrp.GetType().Name}");
                    foreach (var orbital in orbitalGrp.AssignedElectrons)
                    {
                        Console.Write(orbital.ToString());
                    }
                }
                Console.WriteLine();
            }
        }
Exemple #28
0
        static void OnApplicationMenuNameChanged()
        {
            Command aboutCommand = IdeApp.CommandService.GetCommand(HelpCommands.About);

            if (aboutCommand != null)
            {
                aboutCommand.Text = GetAboutCommandText();
            }

            Command hideCommand = IdeApp.CommandService.GetCommand(MacIntegrationCommands.HideWindow);

            if (hideCommand != null)
            {
                hideCommand.Text = GetHideWindowCommandText();
            }

            Carbon.SetProcessName(ApplicationMenuName);
        }
Exemple #29
0
        static MacPlatform()
        {
            timer.BeginTiming();

            LoadMimeMapAsync();

            CheckGtkVersion(2, 17, 9);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName("MonoDevelop");

            timer.Trace("Initializing NSApplication");
            MonoMac.AppKit.NSApplication.Init();

            timer.Trace("Installing App Event Handlers");
            GlobalSetup();

            timer.EndTiming();
        }
Exemple #30
0
        static MacPlatformService()
        {
            timer.BeginTiming();

            systemVersion = Carbon.Gestalt("sysv");

            LoadMimeMapAsync();

            CheckGtkVersion(2, 24, 0);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            MonoDevelop.MacInterop.Cocoa.InitMonoMac();

            timer.Trace("Installing App Event Handlers");
            GlobalSetup();

            timer.EndTiming();
        }
		public bool ApplyChanges(ISupportsEditing editableObject, Carbon.Configuration.SupportedEditingActions actions)
		{
			XmlConfigurationCategoryCollection categories = editableObject as XmlConfigurationCategoryCollection;
			if (categories != null)
			{					
				foreach(XmlConfigurationCategory category in categories)
				{					
					XmlConfigurationCategory myCategory = this[category.ElementName];
					if (myCategory != null)
					{
						try
						{
							myCategory.ApplyChanges((ISupportsEditing)category, actions);
						}
						catch(Exception ex)
						{
							Debug.WriteLine(ex);
						}
					}
				}

			}
			return true;
		}
		public bool ApplyChanges(ISupportsEditing editableObject, Carbon.Configuration.SupportedEditingActions actions)
		{
			XmlConfigurationOptionCollection options = editableObject as XmlConfigurationOptionCollection;
			if (options != null)
			{	
				foreach(XmlConfigurationOption option in options)
				{					
					XmlConfigurationOption myOption = this[option.ElementName];
					if (myOption != null)
					{
						try
						{
							myOption.ApplyChanges((ISupportsEditing)option, actions);
						}
						catch(Exception ex)
						{
							Debug.WriteLine(ex);
						}
					}
				}

			}
			return true;
		}
 public static extern int GetCurrentProcess(ref Carbon.ProcessSerialNumber psn);
 public static extern int SetFrontProcess(ref Carbon.ProcessSerialNumber psn);
 public static extern int TransformProcessType(ref Carbon.ProcessSerialNumber psn, ProcessApplicationTransformState type);
		public virtual bool ApplyChanges(ISupportsEditing editableObject, Carbon.Configuration.SupportedEditingActions actions)
		{
			if (actions == SupportedEditingActions.None)
				return true;

			XmlConfigurationElement element = editableObject as XmlConfigurationElement;			
			if (element != null)
			{
				/// do we match in full paths?
				if (string.Compare(this.Fullpath, element.Fullpath, true) == 0)
				{
					/// does the element have changes, if not we don't need to bother
					if (element.HasChanges)
					{				
						/// yes so apply it's changed features
						this.ElementName = element.ElementName;
						this.Description = element.Description;
						this.Category = element.Category;
						this.DisplayName = element.DisplayName;
						this.Hidden = element.Hidden;
						this.Readonly = element.Readonly;
						this.Persistent = element.Persistent;
					}
					return true;
				}
			}


			return false;
		}